Skip to content

ValueError: FITS header values must contain standard printable ASCII characters; "scopesim_templates.stellar.stars.star_grid #69

@carmeloarci

Description

@carmeloarci

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions