When passing a directory to load_additional_systems, the systems in the directory will fail to load if one (or more) of the system names in the directory is a substring of another system name.
System name ABC is a substring of ABC1. The files in this directory will be rejected.
To reproduce simply run:
from gaiaxpy import load_additional_systems, PhotometricSystem
PhotometricSystem = load_additional_systems('path/to/dir/') # where dir contains files like the ones described
GaiaXPy should be able to correctly load the systems in these files.
Trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/photometric_system.py", line 107, in load_additional_systems
updated_enum = __load_additional_systems(_systems_path, _CFG_FILE_PATH)
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/photometric_system.py", line 133, in __load_additional_systems
return AutoName('PhotometricSystem', _get_system_tuples())
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/photometric_system.py", line 81, in _get_system_tuples
return [(s, create_system(s, None)) if _is_built_in_system(s) else (s, create_system(s, _CFG_FILE_PATH)) for s in
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/photometric_system.py", line 81, in <listcomp>
return [(s, create_system(s, None)) if _is_built_in_system(s) else (s, create_system(s, _CFG_FILE_PATH)) for s in
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/photometric_system.py", line 62, in create_system
else RegularPhotometricSystem(name, systems_path)
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/regular_photometric_system.py", line 19, in __init__
super().__init__(name, config_file)
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/internal_photometric_system.py", line 31, in __init__
self._set_file(bp_model=bp_model, rp_model=rp_model)
File "/userhome/gaiaxpy/lib/python3.10/site-packages/gaiaxpy/generator/internal_photometric_system.py", line 148, in _set_file
raise ValueError(f'More than one system named {self.label.replace(f"{ADDITIONAL_SYSTEM_PREFIX}_", "")}'
ValueError: More than one system named ABC were found. System names in the given directory should be unique. Operation aborted.
When passing a directory to
load_additional_systems
, the systems in the directory will fail to load if one (or more) of the system names in the directory is a substring of another system name.For example in the following structure:
System name
ABC
is a substring ofABC1
. The files in this directory will be rejected.To reproduce simply run:
GaiaXPy should be able to correctly load the systems in these files.
Trace: