mzechmeister / serval

calculate radial velocities from stellar spectra
MIT License
36 stars 9 forks source link

output ProgID and PI #28

Closed mzechmeister closed 5 years ago

mzechmeister commented 5 years ago

The output could contain ProgID and PI. This could be in *.drs.dat or preferentially in *.info.csv since this is generic and not DRS information and since PI name might contain blanks. It requires a file format change and therefore file reading adaption e.g. in srv.py.

mzechmeister commented 5 years ago

A quick hack for HARPS is:

args += (HIERINST+'OBS PI-COI NAME', HIERINST+'OBS PROG ID')

to be added after https://github.com/mzechmeister/serval/blob/2042a70378c15215be4faab6ac3c48f757f4185b/src/inst_HARPS.py#L56

To append it as columns to *.drs.dat, append the snippet

 , sp.hdr['HIERARCH ESO OBS PROG ID'], sp.hdr['HIERARCH ESO OBS PI-COI NAME']

to the line https://github.com/mzechmeister/serval/blob/2042a70378c15215be4faab6ac3c48f757f4185b/src/serval.py#L1037 or to the line https://github.com/mzechmeister/serval/blob/2042a70378c15215be4faab6ac3c48f757f4185b/src/serval.py#L1009 to output it to *.info.csv.

Tested only in untarred mode.

3fon3fonov commented 5 years ago

Ok but after:

args += (k_bjd, k_berv, k_sn55, HIERINST+'OBS PI-COI NAME', HIERINST+'OBS PROG ID')

and:

infowriter.writerow([sp.timeid, sp.bjd, sp.berv, sp.sn55, sp.obj, sp.exptime, sp.ccf.mask, sp.flag, sp.airmass, sp.ra, sp.de, sp.hdr['HIERARCH ESO OBS PROG ID'], sp.hdr['HIERARCH ESO OBS PI-COI NAME']])

I am getting:

infowriter.writerow([sp.timeid, sp.bjd, sp.berv, sp.sn55, sp.obj, sp.exptime, sp.ccf.mask, sp.flag, sp.airmass, sp.ra, sp.de, sp.hdr['HIERARCH ESO OBS PROG ID'], sp.hdr['HIERARCH ESO OBS PI-COI NAME']])

AttributeError: Spectrum instance has no attribute 'hdr'

mzechmeister commented 5 years ago

Ok, I have in my current version : https://github.com/mzechmeister/serval/blob/f48e7cb6fc8af3a1fd789cd54ad7d5cc77cbe86c/src/inst_HARPS.py#L129

Please, adapt this to your version: https://github.com/mzechmeister/serval/blob/a5ec780ea0cadc8cfa137dfb94ff45715785ed7a/src/read_spec.py#L472

(A reminder for me, if the line https://github.com/mzechmeister/serval/blob/a5ec780ea0cadc8cfa137dfb94ff45715785ed7a/src/serval.py#L948 has any memory effect, it is cancelled by the line above.)

3fon3fonov commented 5 years ago

Ok, it seems to work! Thanks!