gaia-dpci / GaiaXPy

Gaia BP/RP spectra package
BSD 3-Clause "New" or "Revised" License
37 stars 9 forks source link

Error loading additional systems in nested directories affecting GaiaXPy 2.1.1 #100

Closed druzm closed 6 months ago

druzm commented 6 months ago

In previous versions of the package, the function load_additional_systems would receive the path to a directory and correctly load all the system files present in that directory and in all of its subdirectories.

https://github.com/gaia-dpci/GaiaXPy/blob/3426ebea6698f2a8872348eff553f98bccc6d0a2/src/gaiaxpy/generator/photometric_system.py#L96

For example, for the following directory structure:

├── ABC
│   ├── ABC_ABC.gaiaXPy_dr3_v1.xml
│   ├── ABC_ABC1.gaiaXPy_dr3_v1.xml
│   └── ABC_DEF.gaiaXPy_dr3_v1.xml
└── XYZ_XYZ.gaiaXPy_dr3_v1.xml

GaiaXPy would load the XYZ system in the root directory and also all the three system files in the ABC subdirectory.

However, in GaiaXPy version 2.1.1, the function will raise an error if system files are found in subdirectories, and in that case, it will fail to load all of the filters.

If the function receives a path to a directory and there are no system files in any of its subdirectories, then the systems will be correctly loaded, and no error will be raised. A system file is a file whose name matches the pattern expected by GaiaXPy (r'[a-zA-Z0-9-_]+\.gaiaxpy_dr3_[a-zA-Z0-9-]+\.xml', case insensitive) .

The steps to follow should be:

druzm commented 6 months ago

Fixed by commit 1cd70aec14a90073346a20142ddfc15577fb2adb

Patch will be held until other issues have been solved.