Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: File cannot be found: V for cluster #30

Open
hugobuddel opened this issue Apr 18, 2022 · 2 comments
Open

ValueError: File cannot be found: V for cluster #30

hugobuddel opened this issue Apr 18, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hugobuddel
Copy link
Collaborator

These lines in clusters.py cause quite some warnings that the file V cannot be found:

# 4. scale all spectra to V=0
spectra = [tcu.scale_spectrum(spec, "V", 0*u.mag) for spec in spectra]

In particular, it raises an error when !SIM.file.error_on_missing_file is true:

Traceback (most recent call last):
  File "/builds/micado/micadowise/notebooks/FullStandardImaging.py", line 255, in <module>
    science3.make_simulation()
  File "/builds/micado/micadowise/src/micado/main/RawExtra.py", line 106, in make_simulation
    src = src_function()
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim_templates/calibration/micado/cluster.py", line 7, in cluster
    return scopesim_templates.stellar.clusters.cluster(mass=10000, distance=2000, core_radius=.1)
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/astropy/utils/decorators.py", line 546, in wrapper
    return function(*args, **kwargs)
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim_templates/stellar/clusters.py", line 82, in cluster
    spectra = [tcu.scale_spectrum(spec, "V", 0*u.mag) for spec in spectra]
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim_templates/stellar/clusters.py", line 82, in <listcomp>
    spectra = [tcu.scale_spectrum(spec, "V", 0*u.mag) for spec in spectra]
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim/effects/ter_curves_utils.py", line 302, in scale_spectrum
    filt = get_filter(filter_name)
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim/effects/ter_curves_utils.py", line 168, in get_filter
    path = find_file(filter_name, silent=True)
  File "/home/micado/.conda/envs/micadowise/lib/python3.10/site-packages/scopesim/utils.py", line 573, in find_file
    raise ValueError(msg)
ValueError: File cannot be found: V

There is a V.dat in LFOA/filters, but the error remains when adding that directory to scopesim.rc.__search_path__ because the .dat is not appended.

Is it possible to prevent this warning / error?

@miguelverdugo
Copy link
Collaborator

Hi Hugo,

In the new master branch (soon in pypi too) the problem should be solved. Any filter in the SVO database should be available as well as in the speXtra database where I also placed MICADO, METIS and other ESO filters.

@teutoburg
Copy link
Contributor

I revisited the current status of this:

# 4. scale all spectra to V=0
# spectra = [tcu.scale_spectrum(spec, "V", 0*u.mag) for spec in spectra]
spectra = [Spextrum(modelclass=spec).scale_to_magnitude(filter_curve="V",
amplitude=0*u.mag)
for spec in spectra]

Running this will produce a all-None list for spectra. This is also in the final returned Source object's .spectra attribute. Meaning this cluster() function is currently still broken.

To check that this is not just somehow my configuration of things, I ran https://github.com/AstarVienna/ScopeSim_Templates/blob/1152838b076ca04f15001cacf2c55587c830816d/docs/notebooks/stellar.ipynb on a different machine, and in code cell 3, src.spextra indeed outputs a list of just Nones.

As I started looking into spextra anyway recently, I'll try to figure out what's happening here...

@teutoburg teutoburg self-assigned this Oct 30, 2023
@teutoburg teutoburg added the bug Something isn't working label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🏗 In progress
Development

No branches or pull requests

3 participants