California-Planet-Search / grandsol

Grand Solution - Doppler forward modeling
MIT License
0 stars 0 forks source link

Reformat APF Iodine spectra into Grand-compatible format #39

Closed bjfultn closed 7 years ago

bjfultn commented 8 years ago

Progress from Jeff's email:

I added logic to read APF spectra. For reference, here is the subset of the APF spectra I chose to retain in grand.F:

         else if (INSTRUMENT.eq.'APF') then
           ibeg = 250 ! 250:4270, (249:4269 in IDL)
           mbeg = 33  !  33:48  , ( 32:47   in IDL)

Ech IDL f77   w[250]  w[4270]
 92  32  33  5031.29  5101.96
 91  33  34  5086.54  5157.95
 90  34  35  5143.03  5215.18
 89  35  36  5200.75  5273.68
 88  36  37  5259.78  5333.59
 87  37  38  5320.18  5394.82
 86  38  39  5382.00  5457.46
 85  39  40  5445.27  5521.60
 84  40  41  5510.05  5587.26
 83  41  42  5576.33  5654.52
 82  42  43  5644.24  5723.41
 81  43  44  5713.84  5793.99
 80  44  45  5785.29  5866.32
 79  45  46  5858.47  5940.51
 78  46  47  5933.49  6016.61
 77  47  48  6010.53  6094.67

I added blaze function removal for APF. I'll show the blaze function fits tomorrow. They are not worth distracting you now.

I have not added logic to use a different iodine cell spectrum for APF.

It would be nice to know if the attached grand.F still works for an existing HIRES test case (simulated or actual observations). In other words, did I break HIRES. BJ could help with that.

I know the attached grand.F doesn't work for APF yet. NaNs take over almost immediately when grand computes the initial model. Jay could help with debugging. I will not work on the fortran code between now and the WebEx tomorrow.

I constructed the attached obslist. It has the new INSTRUMENT = "APF" specification. The B star iodine spectra referenced in obslist are available on Box: https://stsci.box.com/s/uvidxf0mrts4ixyyawkmtvtjxjspss1f. I suppressed fudge and specified an external wavelength file for APF (apf3348.wls):

apf$ grand obslist junk 8 fudge- file_wls=apf3348.wls
 ---> sense_raw...
 ---> Ns:            1
 ALLOCATE MAIN VARIABLES...

GO THROUGH THE COMMAND-LINE ARGUMENTS...

ARG# 04 fudge-                                                                          

ARG# 05 file_wls=apf3348.wls                                                            

   FILE_WLS: apf3348.wls                                                                     
   FIND_WLS: F
#  
# grand.F 
#  
#   ARG00: /Users/valenti/git/grandsol/bin/grand                                           
#   ARG01: obslist                                                                         
#   ARG02: junk                                                                            
#   ARG03: 8                                                                               
#   ARG04: fudge-                                                                          
#   ARG05: file_wls=apf3348.wls                                                            
#                
#   COMPULSORY PARAMETERS ----
#      OBSLIST:  obslist                                                                         
#        LABEL:  junk.08
#      ORDER M:   8
#                
#   OPTIONAL PARAMETERS ----
#      LOGFILE: <STDOUT>                                                                        
#         NITo: [00] 00
#         NITf: [10] 10
#      DOFUDGE:  [T] F
#      DOVORB:  [F] F
#      OUTPUT_   
#          VEL:  [2] 2
#          TEM:  [1] 1
#          MOD:  [0] 0
#          LSF:  [1] 1
#          NRM:  [0] 0
#          LIN:  [0] 0
#  
#  

initial setup... 
        NDIM =   999
          Ns =     1
        MDIM =    16
        IDIM =  4021

 n =            1

  NIT  :            0
  LABEL: junk.08

 call read_raw...
READ_RAW: obslist                                                                         
---> SYSTEMIC VELOCITY:       0.00 m/s
 STRING: INSTRUMENT = "APF"                                                                                                                                                                                      
INSTRUMENT=APF, ibeg=0250, mbeg=33
 STRING: RJDIR = "/Users/valenti/rv/grand/bj/apf/"                                                                                                                                                               
--->             RJDIR: /Users/valenti/rv/grand/bj/apf/
--->            NRJDIR: 31
raqv.226    R*4[4608,79] 1456156 T 2016-07-07T05:15:31    23148.2
raqv.240    R*4[4608,79] 1456156 T 2016-07-07T05:21:53    29476.7
raqx.221    R*4[4608,79] 1456156 T 2016-07-10T06:08:59    23206.9
raqx.243    R*4[4608,79] 1456156 T 2016-07-10T06:18:54    21787.5
raqy.238    R*4[4608,79] 1456156 T 2016-07-12T06:25:28    31601.5
raqz.120    R*4[4608,79] 1456156 T 2016-07-14T12:50:08    25047.5
rarb.239    R*4[4608,79] 1456156 T 2016-07-17T09:16:28    27280.8
rarp.223    R*4[4608,79] 1456156 T 2016-08-10T09:20:57    30555.3
rarp.234    R*4[4608,79] 1456156 T 2016-08-10T09:27:11    27953.8
rarp.235    R*4[4608,79] 1456156 T 2016-08-10T09:27:45    29996.8
rarp.236    R*4[4608,79] 1456156 T 2016-08-10T09:28:19    27703.2

 Initialize WLS from file: apf3348.wls                             

        got WLS from FILE_WLS = apf3348.wls                             

 call find_initmod...
      REFDIR: /Users/valenti/git/grandsol/fref                                                                                                                                                                                                                               
        TRIM: /Users/valenti/git/grandsol/fref
 FILENAME255: /Users/valenti/git/grandsol/fref/kecknso52p5.sam                                                                                                                                                                                                               

INITMOD:  n=  1 m= 8 g=** d=   0 s=   0

                        1      2      3      4      5      6      7      8      9        1     2     3     4     5     6     7     8     9
NIT00:001.08_01  0     0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000      NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
NIT00:001.08_02  0     0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000      NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
NIT00:001.08_03  0     0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000      NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
NIT00:001.08_04  0     0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000      NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
NIT00:001.08_05  0     0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000      NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN

---> z0(N):  0.000000000

wav_imn(21,09,001):   5504.67427000
make_init_tem:   1000   5030.05998    0.000000     0.000    0  1.000000
make_init_tem:   2000   5060.33105    0.000000     0.000    0  1.000000
make_init_tem:   3000   5090.78429    0.000000     0.000    0  1.000000
make_init_tem:   4000   5121.42080    0.000000     0.000    0  1.000000
make_init_tem:   5000   5152.24168    0.000000     0.000    0  1.000000
make_init_tem:   6000   5183.24804    0.000000     0.000    0  1.000000
make_init_tem:   7000   5214.44100    0.000000     0.000    0  1.000000
make_init_tem:   8000   5245.82168    0.000000     0.000    0  1.000000
make_init_tem:   9000   5277.39120    0.000000     0.000    0  1.000000
make_init_tem:  10000   5309.15072    0.000000     0.000    0  1.000000
make_init_tem:  11000   5341.10136    0.000000     0.000    0  1.000000
make_init_tem:  12000   5373.24429    0.000000     0.000    0  1.000000
make_init_tem:  13000   5405.58065    0.000000     0.000    0  1.000000
make_init_tem:  14000   5438.11161    0.000000     0.000    0  1.000000
make_init_tem:  15000   5470.83835         NaN     1.000    1       NaN
make_init_tem:  16000   5503.76203         NaN     1.000    1       NaN
make_init_tem:  17000   5536.88385    0.000000     0.000    0  1.000000
make_init_tem:  18000   5570.20500    0.000000     0.000    0  1.000000
make_init_tem:  19000   5603.72668    0.000000     0.000    0  1.000000
make_init_tem:  20000   5637.45009    0.000000     0.000    0  1.000000
make_init_tem:  21000   5671.37646    0.000000     0.000    0  1.000000
make_init_tem:  22000   5705.50699    0.000000     0.000    0  1.000000
make_init_tem:  23000   5739.84292    0.000000     0.000    0  1.000000
make_init_tem:  24000   5774.38548    0.000000     0.000    0  1.000000
make_init_tem:  25000   5809.13592    0.000000     0.000    0  1.000000
make_init_tem:  26000   5844.09549    0.000000     0.000    0  1.000000
make_init_tem:  27000   5879.26545    0.000000     0.000    0  1.000000
make_init_tem:  28000   5914.64707    0.000000     0.000    0  1.000000
make_init_tem:  29000   5950.24161    0.000000     0.000    0  1.000000
make_init_tem:  30000   5986.05036    0.000000     0.000    0  1.000000
 enter cnorm_tem_bar...
 SET UP TELLURIC-DEPTH ARRAY...
SAVE_WLS: junk.08.00.wls                                                                  
 save_wls...           1           8           8   5548.0940300000002     
SAVE_VEL: junk.08.00.vel ZBAR: 0.0000000000
JeffValenti commented 8 years ago

Name the APF iodine file apfiodine.sam to be compatible with changes I just made to grand.F. The file must have 1400001 lines, exactly like kecknso52p5.sam. We might as well use the same wavelength grid from 4950 to 6350 in steps of 0.001 Angstrom.

bjfultn commented 8 years ago

grand is crashing when I try to run it on the simulated dataset without adding any INSTRUMENT flag into the obslist giving me the

STOP Last pixel index (_IDIM_+ibeg-1) > Data size (idim)

error.

Seems to work with the INSTRUMENT = "HIRES" line in the obslist, but this crashes iGrand

bjfultn commented 8 years ago

Added instrument capability into iGrand, see commit bcca6e4

bjfultn commented 8 years ago

This was tested to work with the simulated data and produce the same results in the case that nothing is fixed.