Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use multiformat reader #6

Merged
merged 27 commits into from
Aug 14, 2024
Merged

Use multiformat reader #6

merged 27 commits into from
Aug 14, 2024

Conversation

domna
Copy link
Collaborator

@domna domna commented Feb 23, 2024

This changes the reader to use the multi format reader to align reading of json and other files.

This is the original PR for pynxtools: FAIRmat-NFDI/pynxtools#250

@domna domna marked this pull request as ready for review July 17, 2024 15:58
@domna domna requested a review from lukaspie July 17, 2024 15:58
@domna domna requested a review from rettigl July 17, 2024 18:16
@rettigl
Copy link
Collaborator

rettigl commented Jul 18, 2024

Not sure I understand how to use this. If I run the example 3 of specsscan, it produces the following warnings:
Using mpes reader to convert the given files:

• ../specsscan/config/NXmpes_arpes_config.json
The required group, /ENTRY[entry]/geometries, hasn't been supplied.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/depends_on is required and hasn't been supplied by the reader.
The required group, /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/transformations, hasn't been supplied.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]/pass_energy requires a unit in the unit category NX_ENERGY.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]/scheme is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/energy_resolution/physical_quantity is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/energy_resolution/resolution requires a unit in the unit category NX_ENERGY.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/energy_resolution/physical_quantity is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/energy_resolution/resolution requires a unit in the unit category NX_ENERGY.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/associated_beam is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/type is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/associated_beam is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/type is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/temperature_sensor/measurement is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/temperature_sensor/value requires a unit in the unit category NX_TEMPERATURE.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/drain_current_amperemeter/measurement is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/drain_current_amperemeter/value requires a unit in the unit category NX_CURRENT.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/pressure_gauge/value requires a unit in the unit category NX_PRESSURE.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/pressure_gauge/measurement is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/situation is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/depends_on is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_polar requires a unit in the unit category NX_ANGLE.
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_polar/@transformation_type"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_polar/@vector"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_polar/@depends_on"
The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/offset_polar is required and hasn't been supplied by the reader.
The value at /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt should be one of: (<class 'int'>, <class 'float'>, <class 'numpy.ndarray'>, <class 'numpy.signedinteger'>, <class 'numpy.unsignedinteger'>, <class 'numpy.floating'>, <class 'dict'>), as defined in the NXDL as NX_NUMBER.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt requires a unit in the unit category NX_ANGLE.
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt/@transformation_type"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt/@vector"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt/@depends_on"
The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/offset_tilt is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_azimuth requires a unit in the unit category NX_ANGLE.
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_azimuth/@transformation_type"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_azimuth/@vector"
Missing attribute: "/ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_azimuth/@depends_on"
The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/offset_azimuth is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/collection_time requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/angular_resolution/resolution requires a unit in the unit category NX_ANGLE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]/center_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/amplifier_bias requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/amplifier_voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/detector_voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency requires a unit in the unit category NX_FREQUENCY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency requires a unit in the unit category NX_FREQUENCY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength requires a unit in the unit category NX_WAVELENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power requires a unit in the unit category NX_POWER.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_z] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] requires a unit in the unit category NX_TRANSFORMATION.
The output file generated: FSmapping.nxs.

On main of pynxtools-mpes there are no warnings.

@rettigl
Copy link
Collaborator

rettigl commented Jul 18, 2024

These are the warnings for the sed example 3:

Using mpes reader to convert the given files:  
• ../sed/config/NXmpes_config.json
Could not find value for key /ENTRY[entry]/PROCESS_MPES[process]/energy_calibration/original_axis with value metadata/energy_calibration/tof.
Tried prefixes: ['attrs'].
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/type is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/associated_beam is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/type is required and hasn't been supplied by the reader.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/associated_beam is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent requires a unit in the unit category NX_LENGTH.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/energy_resolution/physical_quantity is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/energy_resolution/resolution requires a unit in the unit category NX_ENERGY.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]/scheme is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]/pass_energy requires a unit in the unit category NX_ENERGY.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/temperature_sensor/measurement is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/temperature_sensor/value requires a unit in the unit category NX_TEMPERATURE.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/sample_bias_voltmeter/measurement is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]/sample_bias_voltmeter/value requires a unit in the unit category NX_VOLTAGE.
The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/pressure_gauge/measurement is required and hasn't been supplied by the reader.
Field /ENTRY[entry]/INSTRUMENT[instrument]/pressure_gauge/value requires a unit in the unit category NX_PRESSURE.
Field /ENTRY[entry]/PROCESS_MPES[process]/energy_calibration/calibrated_axis requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/PROCESS_MPES[process]/kx_calibration/calibrated_axis requires a unit in the unit category NX_WAVENUMBER.
Field /ENTRY[entry]/PROCESS_MPES[process]/ky_calibration/calibrated_axis requires a unit in the unit category NX_WAVENUMBER.
Field /ENTRY[entry]/duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/collection_time requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/momentum_resolution/resolution requires a unit in the unit category NX_WAVENUMBER.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/extractor_voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/extractor_current requires a unit in the unit category NX_CURRENT.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_A]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_B]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_C]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_D]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_E]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_F]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_G]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_H]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_I]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_UCA]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_UFA]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/LENS_EM[lens_Foc]/voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/field_aperture/size requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]/contrast_aperture/size requires a unit in the unit category NX_LENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/amplifier_bias requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/amplifier_voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]/detector_voltage requires a unit in the unit category NX_VOLTAGE.
Field /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency requires a unit in the unit category NX_FREQUENCY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency requires a unit in the unit category NX_FREQUENCY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength requires a unit in the unit category NX_WAVELENGTH.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration requires a unit in the unit category NX_TIME.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy requires a unit in the unit category NX_ENERGY.
Field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power requires a unit in the unit category NX_POWER.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[rot_omg] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[rot_phi] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[rot_tht] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_z] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] requires a unit in the unit category NX_TRANSFORMATION.
Field /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] requires a unit in the unit category NX_TRANSFORMATION.
The output file generated: /mnt/pcshare/users/Laurenz/AreaB/sed/sed/tutorial/datasets/WSe2/binned.nxs.

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

There was a small error I introduced in the multi format reader (not sure why the ci didn't fail on this though). It should be fixed now. This is what I'm getting with specsanalyzer now:

The value at /ENTRY[entry]/SAMPLE[sample]/TRANSFORMATIONS[transformations]/sample_tilt should be one of: (<class 'int'>, <class 'float'>, <class 'numpy.ndarray'>, <class 'numpy.signedinteger'>, <class 'numpy.unsignedinteger'>, <class 'numpy.floating'>, <class 'dict'>), as defined in the NXDL as NX_NUMBER.

this seems to be a bug with the linking. I'll investigate and fix it.

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

This is actually kind of confusing. In the config file it reads

"sample_tilt": "@attrs:metadata/scan_info/trARPES:Carving:PHI.RBV",

https://github.com/OpenCOMPES/specsanalyzer/blob/ce82506501adea328f882b7900e2ae0b56237836/specsscan/config/NXmpes_arpes_config.json#L290

but in the file it writes @link:/entry/data/angular1.

If I change the config to

"sample_tilt": "@link:/entry/data/angular1",

everything is fine and without errors.

Do you write the @link inside the metadata? The multi format reader does resolve the @ keywords only directly in the json dict and not in the data which is written in it. I would suggest to use the @link in the config file directly, or is this problematic because you want to dynamically change the link?

@rettigl
Copy link
Collaborator

rettigl commented Jul 19, 2024

Do you write the @link inside the metadata? The multi format reader does resolve the @ keywords only directly in the json dict and not in the data which is written in it. I would suggest to use the @link in the config file directly, or is this problematic because you want to dynamically change the link?

Yes, exactly, the idea is to create links dynamically depending on which axis is actually scanned. For this, I write the link string into the attrs. I added extra code to resolve links once more after template filling here:
dae454e
Can this be done similarly for the multiformat reader?

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

Can this be done similarly for the multiformat reader?

Yes. I forgot about this part, sorry. I'll add it to the multiformat reader

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

I added it. I don't get any warnings with the specsanalyzer anymore.

@rettigl
Copy link
Collaborator

rettigl commented Jul 19, 2024

I added it. I don't get any warnings with the specsanalyzer anymore.

Thanks, but this still needs the fix you did in c1ecb70 I think.

@rettigl
Copy link
Collaborator

rettigl commented Jul 19, 2024

I added it now

@rettigl
Copy link
Collaborator

rettigl commented Jul 19, 2024

This works well for files where all entries are present. Created files are the same as per h5diff (apart from @file_time and @file_update_time).
One thing that differs is that in sed, example 3 it produces the following warning:

Could not find value for key /ENTRY[entry]/PROCESS_MPES[process]/energy_calibration/original_axis with value metadata/energy_calibration/tof.
Tried prefixes: ['attrs'].

Which the old reader did not. The reason is that this entry is None in the dict. But I can change this in sed, and fill 0.

However, I think the "!" notation does not work properly/the same way as in the old reader. Both in sed and in specsscan, the corresponding tests fail:

From sed:
New reader:

--------------------------------------------------- Captured log call ----------------------------------------------------
INFO     pynxtools.dataconverter.convert:convert.py:149 Using mpes reader to convert the given files:  
• /mnt/pcshare/users/Laurenz/AreaB/transformations_testing/sed/sed/../tests/data/loader/mpes/../../../../sed/config/NXmpes_config.json
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/USER[user]/role with value metadata/user0/role.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/USER[user]/address with value metadata/user0/address.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/slow_axes with value metadata/instrument/analyzer/slow_axes.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution with value metadata/instrument/analyzer/spatial_resolution.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency with value metadata/instrument/beam/probe/frequency.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread with value metadata/instrument/beam/probe/incident_energy_spread.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration with value metadata/instrument/beam/probe/pulse_duration.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_polarization with value metadata/instrument/beam/probe/incident_polarization.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent with value metadata/instrument/beam/probe/extent.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency with value metadata/instrument/beam/pump/frequency.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy with value metadata/instrument/beam/pump/incident_energy.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread with value metadata/instrument/beam/pump/incident_energy_spread.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength with value metadata/instrument/beam/pump/incident_wavelength.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration with value metadata/instrument/beam/pump/pulse_duration.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_polarization with value metadata/instrument/beam/pump/incident_polarization.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy with value metadata/instrument/beam/pump/pulse_energy.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power with value metadata/instrument/beam/pump/average_power.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent with value metadata/instrument/beam/pump/extent.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/fluence with value metadata/instrument/beam/pump/fluence.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/SAMPLE[sample]/history/notes/description with value metadata/sample/sample_history.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/SAMPLE[sample]/description with value metadata/sample/chemical_formula.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/SAMPLE[sample]/SUBSTANCE[substance]/molecular_formula_hill with value metadata/sample/chemical_formula.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/symmetry with value metadata/momentum_correction/correction/rotation_symmetry.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_centre with value metadata/momentum_correction/correction/center_point.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_points with value metadata/momentum_correction/correction/outer_points.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/cdeform_field with value metadata/momentum_correction/correction/cdeform_field.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/rdeform_field with value metadata/momentum_correction/correction/rdeform_field.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/depends_on with value metadata/momentum_correction/registration/depends_on.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] with value metadata/momentum_correction/registration/trans_x/value.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@transformation_type with value metadata/momentum_correction/registration/trans_x/type.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@units with value metadata/momentum_correction/registration/trans_x/units.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@vector with value metadata/momentum_correction/registration/trans_x/vector.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@depends_on with value metadata/momentum_correction/registration/trans_x/depends_on.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] with value metadata/momentum_correction/registration/trans_y/value.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@units with value metadata/momentum_correction/registration/trans_y/units.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@transformation_type with value metadata/momentum_correction/registration/trans_y/type.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@vector with value metadata/momentum_correction/registration/trans_y/vector.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@depends_on with value metadata/momentum_correction/registration/trans_y/depends_on.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z] with value metadata/momentum_correction/registration/rot_z/value.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@units with value metadata/momentum_correction/registration/rot_z/units.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@transformation_type with value metadata/momentum_correction/registration/rot_z/type.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@offset with value metadata/momentum_correction/registration/rot_z/offset.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@vector with value metadata/momentum_correction/registration/rot_z/vector.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@depends_on with value metadata/momentum_correction/registration/rot_z/depends_on.
Tried prefixes: ['attrs'].
WARNING  pynxtools.dataconverter.readers.multi.reader:reader.py:184 Could not find value for key /ENTRY[entry]/PROCESS_MPES[process]/energy_calibration/original_axis with value metadata/energy_calibration/tof.
Tried prefixes: ['attrs'].
INFO     pynxtools.dataconverter.readers.multi.reader:reader.py:199 Main element /ENTRY[entry]/data/AXISNAME[delay]/@units not provided. Removing the parent group /ENTRY[entry]/data/AXISNAME[delay].
INFO     pynxtools.dataconverter.readers.multi.reader:reader.py:199 Main element /ENTRY[entry]/data/AXISNAME[delay]/@units not provided. Removing the parent group /ENTRY[entry]/data/AXISNAME[delay].
WARNING  pynxtools.dataconverter.helpers:helpers.py:95 The data entry corresponding to /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy is required and hasn't been supplied by the reader.
WARNING  pynxtools.dataconverter.helpers:helpers.py:129 There were attributes set for the field /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy, but the field does not exist.

Old reader:

Using mpes reader to convert the given files:  
• /mnt/pcshare/users/Laurenz/AreaB/transformations_testing/sed/sed/../tests/data/loader/mpes/../../../../sed/config/NXmpes_config.json
[info]: Path /ENTRY[entry]/USER[user]/role not found. Skipping the entry.
[info]: Path /ENTRY[entry]/USER[user]/address not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/slow_axes not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/fluence not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/history/notes/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/SUBSTANCE[substance]/molecular_formula_hill not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/symmetry not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_centre not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_points not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/cdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/rdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@offset not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@depends_on not found. Skipping the entry.
The output file generated: output.nxs.
Using mpes reader to convert the given files:  
• /mnt/pcshare/users/Laurenz/AreaB/transformations_testing/sed/sed/../tests/data/loader/mpes/../../../../sed/config/NXmpes_config.json
[info]: Path /ENTRY[entry]/USER[user]/role not found. Skipping the entry.
[info]: Path /ENTRY[entry]/USER[user]/address not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/slow_axes not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/fluence not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/history/notes/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/name not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/SUBSTANCE[substance]/molecular_formula_hill not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/symmetry not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_centre not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_points not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/cdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/rdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@offset not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@depends_on not found. Skipping the entry.
Using mpes reader to convert the given files:  
• /mnt/pcshare/users/Laurenz/AreaB/transformations_testing/sed/sed/../tests/data/loader/mpes/../../../../sed/config/NXmpes_config.json
• temp_eln.yaml
[info]: Path /ENTRY[entry]/USER[user]/role not found. Skipping the entry.
[info]: Path /ENTRY[entry]/USER[user]/address not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/slow_axes not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/spatial_resolution/resolution not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]/frequency not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_energy_spread not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_wavelength not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_duration not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/incident_polarization not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/pulse_energy not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/average_power not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/extent not found. Skipping the entry.
[info]: Path /ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]/fluence not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/history/notes/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/description not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/name not found. Skipping the entry.
[info]: Path /ENTRY[entry]/SAMPLE[sample]/SUBSTANCE[substance]/molecular_formula_hill not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/symmetry not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_centre not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/original_points not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/cdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]/rdeform_field not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_x]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[trans_y]/@depends_on not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z] not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@units not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@transformation_type not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@offset not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@vector not found. Skipping the entry.
[info]: Path /ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]/TRANSFORMATIONS[transformations]/AXISNAME[rot_z]/@depends_on not found. Skipping the entry.
The output file generated: result.nxs.

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

Is there actually with the multiformat reader a way to also define the dict keys dynamically? E.g. to have a config that allows multiple entries, where the name for the entry comes from some key in the data?

This would be great, if we could e.g. pass two xarrays to save two scans into a file.

Yes, this is possible. We can just pass multiple objects to handle_objects and there is the get_entry_names to retrieve a list of entry names to process. It will just replace ENTRY[entry] from the config dict with the respective name. We would need to add something to the config to replace like @data:entry/<path> to replace the entry path and use this to resolve to the correct xarray.

I actually use multiple entry writing for the igor reader. Can be implemented very similar here.

@rettigl
Copy link
Collaborator

rettigl commented Jul 19, 2024

I actually use multiple entry writing for the igor reader. Can be implemented very similar here.

Yes, I have seen this, but I did not quite understand how this is reflected in the config. I will have a closer look.

@domna
Copy link
Collaborator Author

domna commented Jul 19, 2024

I actually use multiple entry writing for the igor reader. Can be implemented very similar here.

Yes, I have seen this, but I did not quite understand how this is reflected in the config. I will have a closer look.

I prefix the internal igor dict with the current entry name, that way I can automatically get the path from the current entry. We could also prefix the xarray's by entry name then we wouldn't need to change anything in the config file (we could just enumerate entry1 for the first xarray, entry2 for the next and so on). But it kind of assumes that the literal config values do not change in the json config dict.

@domna
Copy link
Collaborator Author

domna commented Jul 22, 2024

@rettigl Which test is this? I tried to get this logging output in specsanalyzer but I'm not able to find which test produces this output

@rettigl
Copy link
Collaborator

rettigl commented Jul 24, 2024

@rettigl Which test is this? I tried to get this logging output in specsanalyzer but I'm not able to find which test produces this output

This one: https://github.com/OpenCOMPES/specsanalyzer/blob/ce82506501adea328f882b7900e2ae0b56237836/tests/test_specsscan.py#L306

Co-authored-by: Lukas Pielsticker <[email protected]>
Copy link
Contributor

@lukaspie lukaspie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the linting. Maybe add a pre-commit for ruff?

pyproject.toml Outdated Show resolved Hide resolved
@domna
Copy link
Collaborator Author

domna commented Jul 26, 2024

Maybe add a pre-commit for ruff?

That wouldn't have worked here, because I did it via the gh web interface. But I can add it

Copy link
Collaborator

@rettigl rettigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand the ELN part, and if or how the config file should be changed.

Otherwise, a few comments and suggestions.

dev-requirements.txt Outdated Show resolved Hide resolved
pynxtools_mpes/mappings.py Outdated Show resolved Hide resolved
pynxtools_mpes/mappings.py Outdated Show resolved Hide resolved
pynxtools_mpes/reader.py Outdated Show resolved Hide resolved
pynxtools_mpes/reader.py Outdated Show resolved Hide resolved
Comment on lines +222 to +226
if (
isinstance(objects, tuple)
and len(objects) > 0
and isinstance(objects[0], xr.DataArray)
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could also handle dicts here as ELN entries.

pynxtools_mpes/reader.py Show resolved Hide resolved
try:
return iterate_dictionary(self.data_xarray.attrs, path)
except KeyError:
logger.info(f"Path {path} not found. Skipping the entry.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the key is not found in attrs, but maybe later in eln, this info is still issued, no? Isn't there a corresponding warning also in the multi reader, that collects all these?

tests/data/config_file.json Outdated Show resolved Hide resolved
tests/data/example.nxs Outdated Show resolved Hide resolved
Copy link
Collaborator

@rettigl rettigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging of PR #25 this should work now.

@rettigl rettigl requested a review from lukaspie August 5, 2024 12:00
rettigl and others added 2 commits August 12, 2024 12:49
* remove mappings, and adopt eln retrieval to use path rather than key

* enable tests temporarily

* Add units to h5 test data

* re-disable tests

* Add tests for new eln data formalism

* Cleanup eln testing file

---------

Co-authored-by: domna <[email protected]>
@rettigl
Copy link
Collaborator

rettigl commented Aug 13, 2024

@domna @lukaspie is anything blocking this from merging, and making a new release?

@lukaspie
Copy link
Contributor

@domna @lukaspie is anything blocking this from merging, and making a new release?

From my side, all looks good. If you want, I can make the release now.

@rettigl
Copy link
Collaborator

rettigl commented Aug 14, 2024

@domna @lukaspie is anything blocking this from merging, and making a new release?

From my side, all looks good. If you want, I can make the release now.

Yes, would be great.

@lukaspie lukaspie merged commit 336ccd3 into main Aug 14, 2024
6 checks passed
@lukaspie lukaspie deleted the use-multiformat-reader branch August 14, 2024 10:48
@lukaspie
Copy link
Contributor

Done. I went with v0.2 since there were some major changes how the reader works internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants