Repository navigation
Conversation
…ed (#263) - Read each loaded column from its own position; ignored columns are skipped and their values aren't parsed - Add AsciiReaderParams.column_positions_included - guess_params_from_filename keeps columns with no known unit as <ignore> instead of dropping them (e.g. dPhi in 4-column I vs Phi files) - Add tests Fixes #263
…ain exporter to eliminate unwanted unit conversion
…rt for all exporters
…ed on export in order to retain the originally loaded units
…as resolutions and not as uncertainties
…gainst legacy loaders as well as the new importers
ps1401
left a comment
There was a problem hiding this comment.
I have some comments here. The PR looks good in general but given its size and the fact we're at the end of a long contributor camp I'd like to give it a second pass before approving.
| one_dim.name: 2, | ||
| two_dim.name: 3, | ||
| three_dim.name: 5, | ||
| } |
There was a problem hiding this comment.
Could you check these please. Ignoring columns starting with "d" in COLUMN_ORDERS above I count 2 for one_dim, 5 for two_dim, and 5 for three_dim.
Specifically, two_dim looks like a copy of three_dim, including Qz in the required list . . .
| given, from the extension of ``path``. | ||
| """ | ||
| exporters = cls.exporters() | ||
| if isinstance(name, type): |
| raise ExportError(f'Unknown exporter "{exporter}". Known exporters are: {known}.') | ||
| return selected | ||
| if type(self) is not Exporter: | ||
| return type(self) |
There was a problem hiding this comment.
I'm not sure what case is covered here - can you explain it for me please?
| Find the columns to write. Returns the column headings (name and units) and the values of each column, in the | ||
| units given in the headings. | ||
| """ | ||
| contents = {name: quantity for name, quantity in datum._data_contents.items()} |
There was a problem hiding this comment.
Use of _data_contents here means that this expoter is currently only set up for SasMeasurement objects, and will not work for general SasData or SasDerivedMeasurement objects. We need to urgently clarify how all of these data objects will be used in the next hackathon and therefore how much support these exporters will need to provide.
|
|
||
| class AsciiExporter(DelimitedTextExporter): | ||
| """ | ||
| Exporter for whitespace separated multi-column ASCII files. Supports 1D and 2D data, one dataset per file. |
| if np.allclose(fast_grid, fast_grid[0], equal_nan=True) and \ | ||
| np.allclose(slow_grid, slow_grid[:, :1], equal_nan=True): | ||
| return shape | ||
| return None |
There was a problem hiding this comment.
This looks good, it may be worth considering if the Abscissae type as defined in the Abscissa class may help with determining whether the points lie on an appropriate grid.
There was a problem hiding this comment.
No quality gates enabled for this code.
See analysis details in CodeScene
Quality Gate Profile: Custom Configuration
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
This adds data exporters for ASCII, CSV, canSAS XML, and NXcanSAS formats. Similarly to the new importers, a master exporter class registers all child classes within itself, attempts to find an appropriate exporter based on the data type and file extension defined by the user and atomically written to the final file to prevent corrupt files in the case of errors.
To enable better unit tests when exporting and then reimporting a few choices were made:
224_hdf5_errorsbranch to ensure the appropriate importer objects existI am not adding this PR to the existing stack to allow the importers to work to be merged without this work.