tomoscan issueshttps://gitlab.esrf.fr/tomotools/tomoscan/-/issues2021-09-29T09:11:38+02:00https://gitlab.esrf.fr/tomotools/tomoscan/-/issues/36Nexus version2021-09-29T09:11:38+02:00Pierre PaleoNexus versionWhen opening a file which does not have a "NX version" attribute, the default behavior is to take the latest (1.1) version.
This seems counter-intuitive, as files having this "NX version" attribute will usually be written with recent so...When opening a file which does not have a "NX version" attribute, the default behavior is to take the latest (1.1) version.
This seems counter-intuitive, as files having this "NX version" attribute will usually be written with recent software (`>= 0.6`), and files not having the attribute are likely to be written with older versions.
So unless I'm missing something, a more logical behavior would be to take 1.0 by default.
In any case, we should be able to choose the the NX version in `HDF5TomoScan`. Currently we have
```python
class HDF5Tomoscan(...):
# ...
@property
def nexus_version(self):
return self._get_generic_key(
"_nexus_version", self._NEXUS_VERSION_PATH, is_attribute=True
)
@nexus_version.setter
def nexus_version(self, version):
if not isinstance(version, float):
raise TypeError("version expect to be a float")
self._nexus_version = version
@property
def nexus_path(self) -> _NEXUS_PATHS:
if self._nexus_paths is None:
self._nexus_paths = get_nexus_paths(self.nexus_version)
return self._nexus_paths
@property
def source_name(self):
return self._get_generic_key("_source_name", self.nexus_path.SOURCE_NAME)
```
which means that the `_nexus_version` (and consequently `_nexus_paths`) cannot be chosen, as the `nexus_paths` is set at initialization.
```python
scan = HDF5TomoScan(...)
print(scan.nexus_path) # _NEXUS_PATHS_V_1_1
scan.nx_version = 1.0 # too late, _nexus_paths is already set at this point!
print(scan.nexus_path) # Still returns _NEXUS_PATHS_V_1_1
```