SourceDescriptionFitsKeywords tries to add newlines to headers
Opened this issue · 0 comments
hugobuddel commented
from spextra.database import SpecLibrary
from scopesim_templates.stellar import stars
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
import scopesim as sim
lib = SpecLibrary("pickles")
spectypes = lib.template_names
nstars = 10
# len(spectypes)
x = np.random.randn(nstars) * 10
y = np.random.randn(nstars) * 10
mags = np.linspace(8, 15, nstars)
random_index = (np.random.randint(nstars, size=nstars))
spectypes1 = [spectypes[i] for i in random_index]
src = stars(filter_name="J", amplitudes=mags, x=x, y=y,
spec_types=spectypes1, library="pickles")
opt = sim.load_example_optical_train()
opt.cmds["!OBS.dit"] = 60 # [s]
opt.cmds["!OBS.ndit"] = 10
opt.observe(src)
hdulist = opt.readout()[0]
raises
ValueError: FITS header values must contain standard printable ASCII characters; "scopesim_te
mplates.stellar.stars.stars(filter_name='J', amplitudes=array([ 8. , 8.77777778, 9.5
5555556, 10.33333333, 11.11111111,\n 11.88888889, 12.66666667, 13.44444444, 14.22222222
, 15. ]), spec_types=['b1v', 'b2ii', 'b0v', 'b1v', 'o9v', 'b0v', 'b0i', 'b0v', 'b1i', 'b1i'], x=array([ -2.72137729, -2.51943817, -11.27082039, -12.67525112,\n -12.17788194
, -5.31550123, -3.5210915 , -5.21259932,\n 8.18383467, 6.54573396]), y=array([ -
4.99893325, 5.27533912, 2.76609476, 13.34033133,\n -4.10566317, -10.23630649, -5.93282896, 1.84114374,\n -13.22891924, 6.76691664]), library='pickles', ra=0, dec=0
)" contains characters not representable in ASCII or non-printable characters.
This would also be too long, see #136 , but the line breaks will also be a problem if the header is short or if CONTINUE is used, so they are different problems.