Convert geometry objects to & from JSON compatible dicts #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first part of something @JunCEEE asked for: a way to roundtrip any geometry object to & from a text based format.
We can go to CrystFEL
.geom
format for a lot of detectors, but reading an arbitrary geometry file back gets complicated, because of some differences in how the information is represented. So my thinking was to add an option to make dicts suitable for saving as JSON, closely based on the internal model of EXtra-geom.This will need some care, because the information is likely to be saved and then reloaded with future versions of EXtra-geom, so we can't casually change things it relies upon (such as
detector_type_name
).For starters, I have only implemented this for the specific detector types. There are some questions we'll need to answer to make it more generic:
GenericGeometry
class which limits modules to a single strip of tiles arranged along either the slow-scan or fast-scan axis - but this cannot represent LPD modules, with tiles in a 2 × 8 grid. In some ways the representation is easier if we allow totally arbitrary tile arrangements, but then we kind of need to make a more generic class to handle it..geom
files), but more complicated if we stick to partially generic options.(I deliberately didn't add tests or docs yet, because I want to figure out what we're doing before that)