Skip to content

Commit

Permalink
Merge branch 'beamline_readers'
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Jul 26, 2024
2 parents 8a99ec5 + 9ffb4fa commit d87289c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
Binary file modified conversion_examples/Fe_XDIFiles/fe_xas_nexus.h5
Binary file not shown.
17 changes: 10 additions & 7 deletions conversion_examples/Fe_XDIFiles/make_xas.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def xdi2nexus(filename, nxroot, entry_name='entry',
preline = f"({preline})*energy(-{dat.nvict})"

proc = ["processing done with xraylarch version 0.9.80",
f" larch.xafs.pre_edge(data, {kwargs})",
f"larch.xafs.pre_edge(data, {kwargs})",
"using 'data' from arrays in rawdata",
"energy = data[:,0] # column 1: energy (eV)",
"itrans = data[:, 2] # column 3: transmitted beam intensity",
Expand Down Expand Up @@ -103,17 +103,20 @@ def xdi2nexus(filename, nxroot, entry_name='entry',
root['process'] = nexus.NXprocess(program='xraylarch', version='0.9.80',
notes=notes)



# rawdata
root['rawdata'] = rawdata
root['rawdata'].attrs['column_labels'] = json.dumps(["energy", "intensity", "itrans", "i0"])
root['rawdata'].attrs['data_collector'] = 'Matthew Newville'
root['rawdata'].attrs['filename'] = filename
array_labels = json.dumps(["energy", "intensity", "itrans", "i0"])
root['rawdata'] = rawdata.T
root['rawdata'].attrs['array_labels'] = array_labels


root['reference'] = 'None'

# scan
scan = root['scan'] = nexus.NXcollection()
scan.attrs['data_collector'] = 'Matthew Newville'
scan.attrs['filename'] = filename


scan.headers = json.dumps(dat.attrs)

for key, val in dat.attrs['scan'].items():
Expand Down
Binary file modified conversion_examples/KEK_PFdata/Fe_XAS_PF9A_nexus.h5
Binary file not shown.
13 changes: 6 additions & 7 deletions conversion_examples/KEK_PFdata/make_xas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from larch.utils import gformat




PLANCK_HC = 12398.419843320027
DEG2RAD = 0.017453292519943295

Expand Down Expand Up @@ -94,7 +92,7 @@ def kekpf2nexus(filename, nxroot, entry_name='entry', metadata=None):
preline = f"({preline})*energy(-{dat.nvict})"

proc = ["processing done with xraylarch version 0.9.80",
f" larch.xafs.pre_edge(data, {kwargs})",
f"larch.xafs.pre_edge(data, {kwargs})",
"energy = col1 # column 1: energy (eV)",
"ifluor = col3 # column 3: fluorescence intensity",
"i0 = col4 # column 4: incident beam intensity",
Expand Down Expand Up @@ -144,15 +142,16 @@ def kekpf2nexus(filename, nxroot, entry_name='entry', metadata=None):
notes=notes)

# rawdata
root['rawdata'] = np.array(coldata)
root['rawdata'].attrs['column_labels'] = json.dumps(array_labels)
root['rawdata'].attrs['data_collector'] = 'KEK PF BL9A'
root['rawdata'].attrs['filename'] = filename
root['rawdata'] = np.array(coldata).T
root['rawdata'].attrs['array_labels'] = json.dumps(array_labels)

root['reference'] = 'None'

# scan
scan = root['scan'] = nexus.NXcollection()
scan.headers = json.dumps(meta)
scan.data_collector = 'KEK PF BL9A'
scan.filename = filename

if 'scan' in meta:
for key, val in meta['scan'].items():
Expand Down
Binary file modified conversion_examples/MultiElementFluor/V_XANES_nexus.h5
Binary file not shown.
11 changes: 6 additions & 5 deletions conversion_examples/MultiElementFluor/make_xas.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def xdi2nexus(filename, nxroot, entry_name='entry',
dtc = "with deadtime corection from columns in the data"
nd = len(coldata)
proc = ["processing done with xraylarch version 0.9.80",
f" larch.xafs.pre_edge(data, {kwargs})",
f"larch.xafs.pre_edge(data, {kwargs})",
f"using col1..col{nd} for {nd} from arrays in rawdata",
"energy = col1 # column 1: energy (eV)",
"i0 = col4 # column 4: incident beam intensity",
Expand Down Expand Up @@ -171,15 +171,16 @@ def xdi2nexus(filename, nxroot, entry_name='entry',
notes=notes)

# rawdata
root['rawdata'] = np.array(coldata)
root['rawdata'].attrs['column_labels'] = json.dumps(array_labels)
root['rawdata'].attrs['data_collector'] = 'Matthew Newville'
root['rawdata'].attrs['filename'] = filename
root['rawdata'] = np.array(coldata).T
root['rawdata'].attrs['array_labels'] = json.dumps(array_labels)

root['reference'] = 'None'

# scan
scan = root['scan'] = nexus.NXcollection()
scan.headers = json.dumps(meta)
scan.data_collector = 'Tony Lanzirotti'
scan.filename = filename

for key, val in meta['scan'].items():
setattr(scan, key, val)
Expand Down

0 comments on commit d87289c

Please sign in to comment.