Open tpchuckles opened 9 months ago
attached is a zip file with an example swift ndata (larger default) and h5 (smaller default) file. these both work with the twp branch which adds a couple elifs to collect_swift_file() and adds functions printNestedDict() and maph5meta().
printNestedDict isn't necessary for this change, but it's useful for making sense of the nested json dicts imo.
if you never converted your files in swift, you get a bunch of ndata files. it would be nice to be able to handle these. I think the changes are pretty straight forward:
io.py > collect_swift_file() needs to look for ndata filenames (not just ndata1)
there is no metadata "properties" key, so replace all "self.meta['properties']" with "self.meta.get('properties',{})" which will smoothly allow the next "or" to be evaluated. in general ".get" is safer for everything (although this does mean it "fails silently" if a given piece of data is somewhere other than where you expected it).
binning (at least the file i'm looking at) is under a different path, here's the new self.binning line: self.binning = self.meta.get('properties',{}).get('binning') or self.meta['metadata']['hardware_source']['camera_processing_parameters']['binning']
axis scaling is also a different path: axes = [ax.copy() for ax in self.meta.get('spatial_calibrations') or self.meta.get('dimensional_calibrations') ]