California-Planet-Search / grandsol

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

grand crashes w/ low SNR observations #54

Closed bjfultn closed 7 years ago

bjfultn commented 7 years ago

The mysterious grand crashes are caused by very low SNR observations. It is getting stuck in this part of the code within the find_rati_bar subroutine:

  2557      1    continue
  2558           ptot = 0.
  2559           mtot = 0.
  2560  c
  2561  c 2013-Jan-10, Valenti, The pixel intervals for each segment are
  2562  c centered at [1], 21, 41, ..., 3961, 3981, [4001] and span pixel
  2563  c interval 1-41, 21-61, ..., 3941-3981, 3961-4001. Note the overlap
  2564  c and the failure to reach pixel 4020, which is the value of _RATZ_.
  2565  c
  2566           do i = max(0001,ip-20), min(4001,ip+20)
  2567              if (reji(i).eq.0.and.meti(i).le.1) then
  2568                 ptot = ptot + pixi(i)
  2569                 mtot = mtot + modi(i)
  2570                 endif 
  2571              enddo
  2572  
  2573           rat = ptot/mtot
  2574           ntot = 0
  2575           rtot = 0.
  2576           rmax = 0.
  2577           imax = 0.
  2578           do i = max(0001,ip-20), min(4001,ip+20)
  2579              if (reji(i).eq.0.and.meti(i).le.1) then
  2580                 r = abs(pixi(i)-rat*modi(i))/bari(i)
  2581                 ntot = ntot + 1
  2582                 rtot = rtot + r
  2583                 if (r.gt.rmax) then
  2584                    rmax = r
  2585                    imax = i
  2586                    endif
  2587                 endif 
  2588              enddo
  2589           sig = rtot/ntot
  2590           if ((NIT.le.1.and.rmax.gt.6.0*sig).or.
  2591       .       (NIT.eq.2.and.rmax.gt.5.0*sig).or.
  2592       .       (NIT.ge.3.and.rmax.gt.4.0*sig)) then
  2593              reji(imax) = 1
  2594              goto 1

hitting this goto 1 statement every time, creating an infinite loop.

The values of rmax, and sig at this point are 0.0, and -19.4968 respectively. Perhaps we should limit sig to be >= 0?

bjfultn commented 7 years ago

Provide a few spectra so Jay can debug further.

bjfultn commented 7 years ago

@JeffValenti will write a Python-based rdsk reader in order to detect low SNR spectra before putting them into an obslist.

bjfultn commented 7 years ago

Added SNR checker into iGrand low SNR observations are now being excluded.