8000 Reader for native SPECS SLE format by lukaspie · Pull Request #110 · FAIRmat-NFDI/pynxtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Reader for native SPECS SLE format #110

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

Merged
merged 15 commits into from
Jun 1, 2023
Merged

Reader for native SPECS SLE format #110

merged 15 commits into from
Jun 1, 2023

Conversation

lukaspie
Copy link
Collaborator
  • Implement reader for different versions of .sle file.

    • These parsers read the schedule (as xml) as well as the data from the SLE datafiles (which are SQLlite databases)
    • The output of the SleParsers is a flattened list of dictionaries, which each dict containing the data and metadata of one
      spectrum (including the individual channel scans).
  • Mapping from parser output to a dictionary that has a similar structure as the output of the XmlSpecs parser, which can then be used to write the nxmpes structure using config files.

  • Different config files for xml and sle parsing are read automatically based on the file extension.

    • Config file for SLE is already compatible with NXmpes_xps application definition.
  • Keyword arguments can be passed from convert to the individual parsers. For SLE files, one can e.g. remove the initial position alignment scans which improves the reading time.

Not working:

  • Channel readout and calibration (see method _get_calibrated_data in xps_reader_utils). This is related to the initial parsing of the data from the SLE file and can be fixed later. At the moment, the "calibrated" data is currently just the scan of the first channel.
  • For the data field, some information that is now hardcoded in the config_file is also available in the file, but parsing from the file currently breaks the code (because of XPS_DATA_TOCKEN).

@coveralls
Copy link
coveralls commented May 10, 2023

Pull Request Test Coverage Report for Build 5142075054

  • 97 of 626 (15.5%) changed or added relevant lines in 3 files are covered.
  • 136 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-2.3%) to 51.388%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pynxtools/dataconverter/readers/xps/reader.py 4 7 57.14%
pynxtools/dataconverter/readers/xps/reader_utils.py 30 125 24.0%
pynxtools/dataconverter/readers/xps/sle_parsers.py 63 494 12.75%
Files with Coverage Reduction New Missed Lines %
pynxtools/dataconverter/readers/transmission/reader.py 2 97.67%
pynxtools/dataconverter/writer.py 10 92.73%
pynxtools/nexus/nexus.py 124 74.0%
Totals Coverage Status
Change from base Build 4926761525: -2.3%
Covered Lines: 5185
Relevant Lines: 10090

💛 - Coveralls

lukaspie added 11 commits May 17, 2023 17:31
Initial commit for XPS reader for SLE files (native format of SPECS Prodigy)
- Add sle_parsers which read the schedule (as xml) as well as the data from the SLE datafiles (which are SQLlite databases)
 - Implement interface in dataconverter/xps/reader_utils for SLE readers for different versions of .sle files

Currently missing:
 - mapping from output format of parse_file method of the different SleParsers to get_dict method of parse_xml of XML reader -> SleParser output cannot be mapped to Nxmpes at the moment
The output of the SleParsers is a flattened list of dictionaries, which each dict containing the data and metadata of one spectrum (including the individual channel scans).

This list is mapped to a dictionary that has a similar structure as the output of the XmlSpecs parser, which can then be used to write the nxmpes structure using config files.
 - Individual channel scans are stored in the data field of the spectrum dictionaries
- Fix some data type errors during reading
- Read out transmission data.

Note: Channel readout and calibration is currently not working ( see method _get_calibrated_data). Therefore, the "calibrated" data is currently just the scan of the first channel.
- Restructure CONVERT_DICT
- Add "NXmpes_xps" to supported NXDLs
- Config files: either the config files in the xps folder are used (based on the file extension of the input) or a config file can be explicitly passed during the reading
- Read both TF data and the file it was stored in.
Since there is no NXDL for the NXmpes_xps  application definition, the pytests are failing. Temporarily remove it until NXDL is available.
Different SLE parsers have different xml schedules. Implement abstractmethod for abstract SleParser base class.
Copy link
Collaborator
@sanbrock sanbrock left a comment

Choose a reason for hiding this comment

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

LGTM

@sanbrock sanbrock merged commit 494109b into master Jun 1, 2023
@sanbrock sanbrock deleted the XPS_SLE_reader branch June 1, 2023 08:46
RubelMozumder pushed a commit that referenced this pull request Jun 28, 2023
* Add reader for .sle XPS files (SPECS Prodigy)

Initial commit for XPS reader for SLE files (native format of SPECS Prodigy)
- Add sle_parsers which read the schedule (as xml) as well as the data from the SLE datafiles (which are SQLlite databases)
 - Implement interface in dataconverter/xps/reader_utils for SLE readers for different versions of .sle files

Currently missing:
 - mapping from output format of parse_file method of the different SleParsers to get_dict method of parse_xml of XML reader -> SleParser output cannot be mapped to Nxmpes at the moment

* Pylinting, minor naming updates

* Map from SleParser to common format

The output of the SleParsers is a flattened list of dictionaries, which each dict containing the data and metadata of one spectrum (including the individual channel scans).

This list is mapped to a dictionary that has a similar structure as the output of the XmlSpecs parser, which can then be used to write the nxmpes structure using config files.

* Small updates to SleParsers

 - Individual channel scans are stored in the data field of the spectrum dictionaries
- Fix some data type errors during reading
- Read out transmission data.

Note: Channel readout and calibration is currently not working ( see method _get_calibrated_data). Therefore, the "calibrated" data is currently just the scan of the first channel.

* Small changes to reader.py, multiple config files

- Restructure CONVERT_DICT
- Add "NXmpes_xps" to supported NXDLs
- Config files: either the config files in the xps folder are used (based on the file extension of the input) or a config file can be explicitly passed during the reading

* Fix error in transmission data parsing

- Read both TF data and the file it was stored in.

* Allow kwargs passing to the SleParsers

* Small update to config file parsing

* Pycodestyle linting

* Temporarily remove NXmpes_xps from supported_nxdls

Since there is no NXDL for the NXmpes_xps  application definition, the pytests are failing. Temporarily remove it until NXDL is available.

* Implement abstractmethod for flattening XML

Different SLE parsers have different xml schedules. Implement abstractmethod for abstract SleParser base class.

* pylinting

* Linting

* some more linting

* Mypy changes
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
0