spacetelescope / pysiaf

Handling of Science Instrument Aperture Files (SIAF) for space telescopes
https://pysiaf.readthedocs.io
BSD 3-Clause "New" or "Revised" License
13 stars 28 forks source link

Formatting Errors in NRS .pcf Files? #284

Open Witchblade101 opened 1 year ago

Witchblade101 commented 1 year ago

In preparing the 0.19 release we ran into a problem reading .pcf files in generate_nirspec.py. @tonysohn discovered it was due to the coefficients being given one per line, instead of the expected 21 (There's a carriage return after each value instead of a space).

We need to correct the formatting of those lines in the pcf files and then verify the resulting generated products match what is included in PRDOPSSOC-059.

Witchblade101 commented 1 year ago

Tracked in JWSTSIAF-259

Witchblade101 commented 1 year ago

Almost, but not quite. I'm sure I did something obviously wrong, but it's been a long day. After reformatting all of the coefficient lines in the pcf files I get the following error:

/Users/dlong/pysiaf/pysiaf/source_data/NIRSpec/delivery/delivery_SCA491toGWA.pcf
2022-06-09T07:22:36

Order 5 21  terms
Traceback (most recent call last):
  File "/Users/dlong/pysiaf/generate/generate_nirspec.py", line 703, in <module>
    pcf_data[field]['A'], pcf_data[field]['B'], pcf_data[field]['C'], pcf_data[field]['D'] = reorder(os.path.join(source_data_dir, pcf_file_mapping[field]), verbose=True)
  File "/Users/dlong/pysiaf/generate/generate_nirspec.py", line 384, in reorder
    xForward.append(float(text))  # f[k]
ValueError: could not convert string to float: '-0.13390975933434573 -1.5709931144966661e-06 -2.6516278899572355e-10 4.644617133484853e-14 -1.0320704138731455e-17 1.7502555480461746e-22 6.3703567076635e-05 7.0925284630839e-10 1.131975121490725e-13 -1.0143459108757772e-17 2.2968461937227943e-21 -5.030514031516839e-10 2.1476893011402986e-14 -1.630218218032348e-18 -1.5399978200293427e-22 3.8791365157221346e-14 -3.268835627552774e-18 1.1461092970650141e-22 1.4155988955092523e-17 1.2008665702134426e-22 -1.3340864454863128e-21\n'
Witchblade101 commented 1 year ago

delivery_xxx.pcf files need one coefficient per line. Fore_xxx.pcf and OTE.pcf need all coefficients on a single line.