California-Planet-Search / grandsol

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

Try to run APF B stars through `grand` and `iGrand` #34

Closed bjfultn closed 7 years ago

bjfultn commented 8 years ago

Fix template at all ones

bjfultn commented 8 years ago

This requires some low-level testing of the rdsk reader within grand first. Assigning to @JeffValenti until that is complete.

bjfultn commented 8 years ago

I was able to run grand on some APF B star observations with an input template file with all 1.0's for the flux values. It cranked away for awhile but eventually failed. Here are the last few lines of the output log.

---> z0(N):  0.000000000

 call find_initmod...

INITMOD:  n= 30 m= 8 g=43 d=  94 s=  12

                        1      2      3      4      5      6      7      8      9        1     2     3     4     5     6     7     8     9
NIT00:030.08_01  1     6.807  6.856  8.350  0.507  0.107 -0.259  0.108  0.197  0.081    0.222 0.222 0.192 0.191 0.191 0.191 0.191 0.191 0.191
NIT00:030.08_02  2    ****** 20.210 10.209  0.766  0.108 -0.260  0.083  0.198 -0.073    0.239 0.239 0.179 0.178 0.178 0.178 0.178 0.178 0.178
NIT00:030.08_03  2    -1.915 13.466 13.202  1.055  0.192 -0.302  0.116  0.245 -0.188    0.257 0.257 0.167 0.166 0.166 0.166 0.166 0.166 0.166
NIT00:030.08_04  1     2.639 12.422 20.545  1.674  0.293 -0.348  0.095  0.242 -0.291    0.276 0.276 0.164 0.155 0.155 0.155 0.155 0.154 0.155
NIT00:030.08_05  1     4.164 14.949 30.221  2.430  0.389 -0.400  0.025  0.204 -0.405    0.296 0.296 0.156 0.145 0.145 0.145 0.145 0.144 0.145
NIT00:030.08_06  0     5.809 19.356 44.896  3.594  0.512 -0.506 -0.014  0.197 -0.546    0.317 0.318 0.153 0.136 0.136 0.141 0.136 0.138 0.136
NIT00:030.08_07  0     8.882 21.394 55.298  4.429  0.530 -0.545 -0.056  0.179 -0.707    0.296 0.340 0.147 0.133 0.128 0.143 0.131 0.140 0.128
NIT00:030.08_08  0    11.577 19.173 55.881  4.505  0.536 -0.483 -0.084  0.162 -0.944    0.276 0.364 0.138 0.135 0.123 0.144 0.130 0.141 0.122
NIT00:030.08_09  0    12.822 15.581 49.646  4.129  0.541 -0.436 -0.115  0.160 -1.510    0.257 0.389 0.130 0.135 0.124 0.144 0.130 0.142 0.116
NIT00:030.08_10  0    12.503 12.371 40.922  3.663  0.429 -0.384 -0.177  0.177 -2.447    0.239 0.415 0.124 0.135 0.123 0.145 0.130 0.141 0.117
NIT00:030.08_20  0     3.269  4.950 12.556  1.351  0.412 -0.147 -0.429  0.175 -3.748    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_30  1     4.179  5.045 12.634  1.036  0.408 -0.037 -0.310 -0.016 -0.329    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_40  1     5.130  3.842 12.106  1.046  0.939  0.019 -0.409  0.002 -0.053    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_50  0     3.901  4.886 12.595  0.957  0.906 -0.007 -0.185  0.014  0.020    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_60  0     4.116  4.830 13.279  0.812  0.891 -0.011 -0.102  0.016 -0.009    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_70  0     4.198  4.166 12.306  1.031  0.697 -0.024 -0.113  0.018 -0.022    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_80  0     3.790  4.416 12.331  0.647  0.580 -0.019 -0.111  0.011 -0.020    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123
NIT00:030.08_90  0     3.868  4.478 12.268  1.063  0.119 -0.014 -0.109 -0.003 -0.021    0.145 0.610 0.108 0.133 0.121 0.146 0.130 0.141 0.123

---> z0(N):  0.000000000

 There were serious problems with the following
 observations.  Perhaps they are templates?

   1    1
   2    2
   3    3
   4    4
   5    5
   6    6
   7    7
   8    8
   9    9
  10   10
  11   11
  12   12
  13   13
  14   14
  15   15
  16   16
  17   17
  18   18
  19   19
  20   20
  21   21
  22   22
  23   23
  24   24
  25   25
  26   26
  27   27
  28   28
  29   29
  30   30

 001  raco.166 0 0.00000 0.00000                                                 
 002  racz.184 0 0.00000 0.00000                                                 
 003  radc.162 0 0.00000 0.00000                                                 
 004  raee.214 0 0.00000 0.00000                                                 
 005  raeg.234 0 0.00000 0.00000                                                 
 006  raem.203 0 0.00000 0.00000                                                 
 007  raep.212 0 0.00000 0.00000                                                 
 008  raez.203 0 0.00000 0.00000                                                 
 009  rafc.195 0 0.00000 0.00000                                                 
 010  rafc.196 0 0.00000 0.00000                                                 
 011  rafc.197 0 0.00000 0.00000                                                 
 012  rafp.201 0 0.00000 0.00000                                                 
 013  rage.188 0 0.00000 0.00000                                                 
 014  rage.189 0 0.00000 0.00000                                                 
 015  ragl.194 0 0.00000 0.00000                                                 
 016  ragl.195 0 0.00000 0.00000                                                 
 017  ragl.201 0 0.00000 0.00000                                                 
 018  ragl.202 0 0.00000 0.00000                                                 
 019  ragl.203 0 0.00000 0.00000                                                 
 020  ragt.177 0 0.00000 0.00000                                                 
 021  ragu.200 0 0.00000 0.00000                                                 
 022  ragu.201 0 0.00000 0.00000                                                 
 023  ragu.202 0 0.00000 0.00000                                                 
 024  ragu.208 0 0.00000 0.00000                                                 
 025  ragu.209 0 0.00000 0.00000                                                 
 026  ragu.210 0 0.00000 0.00000                                                 
 027  rahg.261 0 0.00000 0.00000                                                 
 028  rahp.208 0 0.00000 0.00000                                                 
 029  rahp.209 0 0.00000 0.00000                                                 
 030  rahp.210 0 0.00000 0.00000                                                 

Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_OVERFLOW_FLAG IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP Cannot continue; bad observation
bjfultn commented 8 years ago

I commented out the following section of grand.F and a simple grand call on the APF B stars appears to run to completion now. I'm trying iGrand now...

c$$$         if (BADs.ne.0) then
c$$$             write(6,*) ' '
c$$$             write(6,*) 'There were serious problems with the following'
c$$$             write(6,*) 'observations.  Perhaps they are templates?'
c$$$             write(6,*) ' '
c$$$             do BAD = 1, BADs
c$$$                write(6,'(i4,1x,i4)') BAD, bad_list(BAD)
c$$$                enddo
c$$$             write(6,*) ' '
c$$$             open(91,file=RJSOURCE,status='unknown')
c$$$    3        read(91,'(80a)',end=4) STRING
c$$$             if (STRING(1:1).ge.'0'.and.STRING(1:1).le.'9') then
c$$$                read(STRING,*) N,FILENAME
c$$$                do BAD = 1, BADs
c$$$                   if (n.eq.bad_list(BAD)) write(*,*) STRING
c$$$                   enddo
c$$$                endif
c$$$             goto 3
c$$$    4        close(91)
c$$$             write(6,*) ' '
c$$$             stop 'Cannot continue; bad observation'
c$$$             endif
bjfultn commented 8 years ago

I was able to get things to run through an iGrand iteration. iGrand is still failing because it doesn't like the look of the output template or velocities in this "B star only case" but those are small bugs that I can fix.

However, the residuals are not looking good. Here is an example:

igrand_apf_bstars_08_residuals

bjfultn commented 8 years ago

Things to try:

bjfultn commented 8 years ago

So there was an air vs. vacuum wavelengths issue but fixing that didn't seem to solve the problem. Here is a plot of a B star spectrum as saved in the .mod file (black line) and the APF iodine atlas that I've adjusted to be on air wavelengths. It looks like the alignment is close enough that it should work. What do you think?

apf_bstar_wavecheck

bjfultn commented 8 years ago

I changed the way find_initmod loops over possible values for g. It had been set to loop over [03, 43, 05], and I changed it to [03, 05, 43]. I'm not sure why it would try the super-wide Gaussian first, over the 05 width Gaussian. This appears to allow it to run without deeming all observations as bad.

This change, combined with fixing the vacuum vs. air wavelength issue by shifting the wavelength solution onto the vacuum scale seems to work. I can fit APF B stars pretty well now if I fix the wavelength solution.

igrand_apf_bstars_08_residuals

bjfultn commented 8 years ago

grand still runs through to completion if I allow the wavelength solution to vary, but the results are not so hot. Its really strange that the wavelength solution is starting out pretty close, but the solver is pushing it away from the right answer.

igrand_apf_bstars_08_residuals

bjfultn commented 7 years ago

This is done and the APF fudge factor has been derived.