-
Notifications
You must be signed in to change notification settings - Fork 4
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: FITS header values must contain standard printable ASCII characters; "scopesim_templates.stellar.stars.star_grid #69
Comments
This is the same error I got when running the script for #70 . Also this can be worked around by disabling
A longer description is in #70. However, I think this used to work. I expect that there is a change in astropy that made this not work anymore. In the past, astropy verified the header only when saving the data. And the workaround we implemented (see #70) first created broken headers, and then patches them up before saving them. But it seems that now astropy checks the header when it is created; which is better, but breaks our workaround. Apparently we don't have a proper test for this, so we should add that when fixing this bug. |
the fits header writer put the /n every 6 entries. Generating the error. |
I suggest to use as default the "False" case micado["source_fits_keywords"].include = False |
The SourceDescriptionFitsKeywords still cause problems, see AstarVienna/ScopeSim_Templates#70 AstarVienna/ScopeSim_Templates#69
Yeah, SourceDescriptionFitsKeywords should be turned off by default until we have proper tests for it so we can verify when it breaks (and we should fix it again). See AstarVienna/irdb#150 |
The procedure saving the header of the fits file produced by scopesim when saving the output fails because of "/n" in the
keyword to be saved, the keyword regards the source. It may be any of the numerical SIM SRC0 xxxx entry.
....
print("Observe")
micado.observe(src_J)
print("Save")
hdus_J_small_test_3DM = micado.readout(filename= "scopesim_debug.fits")
...
In order to reproduce the error use the python script attached.
Traceback (most recent call last):
File "/python/simcado/MORFEO_debug.py", line 100, in
hdus_J_small_test_3DM = micado.readout(filename= "scopesim_debug.fits")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MORFEO_debug.py.txt
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/scopesim/utils.py", line 1053, in wrapper
output = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/scopesim/optics/optical_train.py", line 316, in readout
hdul = effect.apply_to(hdul, optical_train=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/scopesim/effects/fits_headers.py", line 547, in apply_to
hdul = super().apply_to(hdul=hdul, optical_train=opt_train)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/scopesim/effects/fits_headers.py", line 286, in apply_to
hdul[i].header.update(resolved_with_counters)
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/astropy/io/fits/header.py", line 1087, in update
update_from_dict(k, v)
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/astropy/io/fits/header.py", line 1068, in update_from_dict
card = Card(k, v)
^^^^^^^^^^
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/astropy/io/fits/card.py", line 201, in init
self.value = value
^^^^^^^^^^
File "/home/carmelo/.conda/envs/scope_test/lib/python3.11/site-packages/astropy/io/fits/card.py", line 355, in value
raise ValueError(
ValueError: FITS header values must contain standard printable ASCII characters; "scopesim_templates.stellar.stars.star_grid(filter_name=J, amplitudes=[18.00751139 19.71896037 20.42893278 16.74155731 17.82481477 22.25630185\n 17.76112195 18.34062252 20.6108769 21.66227652 22.51209445 28.46949714\n 16.93850228 21.6801593 19.37519597 17.90536887 16.78798561 19.27439344\n
The text was updated successfully, but these errors were encountered: