lynx-x-ray-observatory / soxs

SOXS: Simulated Observations of X-ray Sources
Other
16 stars 3 forks source link

Unable to get files from soxs cache directory #38

Closed xshaokun closed 5 months ago

xshaokun commented 6 months ago

Since version 4.7.1, the files located in the soxs cache directory cannot be retrieved during instrument simulation and are instead downloaded directly from the database, unless the response files are located in the current directory. This seems different from the previous behavior. I dove into the code and found that the method get_data_file(fn) only checks the current directory.

https://github.com/lynx-x-ray-observatory/soxs/blob/57c3a23c932296cdfadf06a571dd06fde4cfc030/soxs/utils.py#L308C1-L317C1

xshaokun commented 6 months ago

More Details

I create a new instrument specification as follows

chandra_circinus = soxs.get_instrument_from_registry("chandra_aciss_cy0")
chandra_circinus["name"] = "chandra_aciss_circinus"
chandra_circinus["arf"] = "Circinus_W_lobe_comb_src.arf"
chandra_circinus["rmf"] = "Circinus_W_lobe_comb_src.rmf"
name = soxs.add_instrument_to_registry(chandra_circinus)

If the file Circinus_W_lobe_comb_src.arf is located in the soxs cache directory instead of the current directory, the instrument simulation raises a ValueError

ValueError: File 'Circinus_W_lobe_comb_src.arf' is not in the registry.
jzuhone commented 5 months ago

This should be fixed in 4696f9b7c5b4f652544a0598632e2d0e702df8dd, please let me know if it's not.

xshaokun commented 5 months ago

It works. Thanks! @jzuhone