IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41386


Ignore:
Timestamp:
Jul 3, 2020, 2:11:46 PM (6 years ago)
Author:
eugene
Message:

tgroups test working OK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20200519/test/relphot.tgroups.dvo

    r41370 r41386  
    4747  tapPLAN {((mjd_uc[]*4 + mjd_nc[]*4) + (mjd_uc[] + mjd_nc[]) + (mjd_uc[] + mjd_nc[])) / 3}
    4848
     49  # XXX first, run the analysis with only ubercal data (photometric data)
     50  # we should be able to recover the nightly zero points fitting only tgroups
     51
    4952  # generate the basic images and check they were correctly ingested by dvo
    5053  for i 0 mjd_uc[]
    51     mkexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i $fileroot $RA_CENTER $DEC_CENTER
    52     ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i raw
     54    sprintf filerootout "%s.%02d" $fileroot $i
     55    mkexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] secz_uc[$i] $FILTER $filerootout $RA_CENTER $DEC_CENTER
     56    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] secz_uc[$i] $FILTER raw
     57  end
     58
     59  break
     60 
     61  # run relphot on the db and check that the images now match the expected values
     62  tapEXEC relphot -tgroup-fit-airmass -tgroups tgroups.dat -images g -v -region $RA_MIN $RA_MAX $DEC_MIN $DEC_MAX -D CATDIR $catdir -D STAR_TOOFEW 1 -statmode WT_MEAN -cloud-limit 0.5 -update -nloop 12
     63
     64  break
     65
     66  # reset the per-filter ZPT_OFF:$filter values
     67  $ZPT_OFF:$FILTER = NAN
     68
     69  for i 0 mjd_uc[]
     70    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $FILTER relphot_uc
    5371  end
    5472  for i 0 mjd_nc[]
    55     mkexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i $fileroot $RA_CENTER $DEC_CENTER
    56     ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
    57   end
    58 
    59   # run relphot on the db and check that the images now match the expected values
    60   tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -statmode WT_MEAN -cloud-limit 0.5 -update -nloop 12
    61 
    62   # reset the per-filter ZPT_OFF:$filter values
    63   for i 0 $filt_uc:n
    64     $filter = $filt_uc:$i
    65     $ZPT_OFF:$filter = NAN
    66   end
    67   for i 0 $filt_nc:n
    68     $filter = $filt_nc:$i
    69     $ZPT_OFF:$filter = NAN
    70   end
    71 
    72   for i 0 mjd_uc[]
    73     ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
    74   end
    75   for i 0 mjd_nc[]
    76     ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     73    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $FILTER relphot_nc
    7774  end
    7875  tapDONE
     
    8885  $DEC_CENTER = 20.0
    8986  $PLATE_SCALE = 0.25
    90   $NSEASON = 3
    91   $NFILTER = 3
    92   $NCHIP_X = 2
    93   $NCHIP_Y = 2
    94   $NCELL_X = 2
    95   $NCELL_Y = 2
     87  $NCHIP_X = 1
     88  $NCHIP_Y = 1
    9689  $CHIP_DX = 1000
    9790  $CHIP_DY = 1000
    98   $DEFECT_FRAC = 0.05
    99   $OFFSET_FRAC_UC = 0.0
    100   $OFFSET_FRAC_NC = 0.5
     91  $DEFECT_FRAC = 0.00
    10192
    10293  # we have two sets of images: ubercal (photometric) and not-ubercaled
     
    10495  # ********* UBERCAL IMAGES ***********
    10596
    106   # the number of exposures is defined by filt_uc:n
    107   list filt_uc -split g g g g r r r r
    108 
    109   # tmpseq is used to generate vectors in this function
    110   create tmpseq 0 $filt_uc:n
    111 
    112   # exptime and airmasses for uc images
    113   set exptime_uc = 10.0 + zero(tmpseq)
    114 
    115 # XXX range of airmass
    116   set airmass_uc =  1.3 + zero(tmpseq)
    117   set klam_uc = zero(tmpseq)
    118   set zpt_uc = zero(tmpseq)
    119 
    120   # ubercal zero points are defined as ZP_nominal + 2.5log(exptime) + K*(airmass - 1.0)
    121   # note that K is defined as a negative value (is this sensible?)
    122 
    123   # zero points and airmass slopes for these sequences
    124   for i 0 $filt_uc:n
    125     klam_uc[$i] = $klam_nominal:$filt_uc:$i
    126     zpt_uc[$i]  = $zpt_nominal:$filt_uc:$i + 2.5*log(exptime_uc[$i]) + klam_uc[$i]*(airmass_uc[$i] - 1.0) + $UC_CLOUDS*(rnd(klam_uc[$i]) - 0.5)
    127     $ZPT_OFF:$filt_uc:$i = NAN
     97  # ubercal nights each have a distinct zero point and slope:
     98  vlist night_uc 55000.0 55010.0 55030.0 55060.0
     99  vlist dz_nt_uc +0.0000 +0.0300 -0.0200 -0.0400
     100# vlist dk_nt_uc +0.0000 +0.0005 -0.0005 -0.0002
     101  vlist dk_nt_uc +0.0000 +0.0200 -0.0200 +0.0300
     102
     103  write tgroups.dat night_uc 
     104
     105  $EXPTIME = 10.0
     106  $FILTER = g
     107  $ZPT_OFF:$FILTER = NAN
     108
     109  delete -q mjd_uc seq_uc zpt_uc klam_uc secz_uc exptime_uc
     110
     111  # generate 5 exposures for each night
     112  for i 0 5
     113    set secz_tmp = rnd(night_uc) + 1.0; # airmass in range 1.0 - 2.0
     114    set klam_tmp = $klam_nominal:$FILTER + dk_nt_uc
     115    set exp_tmp  = zero(night_uc) + $EXPTIME
     116    set zpt_tmp  = $zpt_nominal:$FILTER  + dz_nt_uc + 2.5*log(exp_tmp) + klam_tmp*(secz_tmp - 1.0)
     117
     118    set seq_tmp  = ramp(night_uc)
     119    set mjd_tmp  = night_uc + 0.33 + 0.01*$i; # exposures are 14 minutes apart starting at 10pm HST
     120
     121    concat klam_tmp klam_uc
     122    concat secz_tmp secz_uc
     123    concat  zpt_tmp  zpt_uc
     124    concat  seq_tmp  seq_uc
     125    concat  mjd_tmp  mjd_uc
     126
     127    concat  exp_tmp  exptime_uc
    128128  end   
    129   set mjd_uc = 55000.00 + 0.01*(tmpseq % 3) + 10.0*int(tmpseq / 3)
    130129
    131130  # ********* NON-UBERCAL IMAGES ***********
    132131
    133   # mjd and zpt values for not-ubercal'ed images
    134   list filt_nc -split g g g g r r r r
    135 
    136   # tmpseq is used to generate vectors in this function
    137   create tmpseq 0 $filt_nc:n
    138 
    139   # place this within a valid season (55000.0 - 55010.0 - 55020.0 - 55030.0)
    140   set exptime_nc = 10.0 + zero(tmpseq)
    141   set airmass_nc =  1.6 + zero(tmpseq)
    142   set klam_nc = zero(tmpseq)
    143   set zpt_nc = zero(tmpseq)
    144 
    145   # airmass slopes for these sequnece
    146   for i 0 $filt_nc:n
    147     klam_nc[$i] = $klam_nominal:$filt_nc:$i
    148     zpt_nc[$i]  = $zpt_nominal:$filt_nc:$i + 2.5*log(exptime_nc[$i]) + klam_nc[$i]*(airmass_nc[$i] - 1.0) + $NC_CLOUDS*(rnd(klam_nc[$i]) - 0.5)
    149     $ZPT_OFF:$filt_uc:$i = NAN
     132  # non-ubercal nights each have a random zero points and fixed slope (klam_nominal)
     133  # non-ubercal nights must not be the same set as the ubercal nights above
     134  vlist night_nc 55005.0 55015.0 55035.0 55065.0
     135
     136  delete -q mjd_nc seq_nc zpt_nc klam_nc secz_nc
     137
     138  # generate 5 exposures for each night
     139  for i 0 5
     140    set secz_tmp = rnd(night_nc)  + 1.0; # airmass in range 1.0 - 2.0
     141    set klam_tmp = zero(night_nc) + $klam_nominal:$FILTER
     142    set exp_tmp  = zero(night_nc) + $EXPTIME
     143    set zpt_tmp  = $zpt_nominal:$FILTER + 2.5*log(exp_tmp) + klam_tmp*(secz_tmp - 1.0) - $NC_CLOUDS*(0.1 + rnd(secz_tmp))
     144    # observed zero points for nc nights are 0.1 - 1.1 lower than the ubercal nights
     145
     146    set seq_tmp  = ramp(night_nc)
     147    set mjd_tmp  = night_nc + 0.33 + 0.01*$i; # exposures are 14 minutes apart starting at 10pm HST
     148
     149    concat klam_tmp klam_nc
     150    concat secz_tmp secz_nc
     151    concat  zpt_tmp  zpt_nc
     152    concat  seq_tmp  seq_nc
     153    concat  mjd_tmp  mjd_nc
     154
     155    concat  exp_tmp  exptime_nc
    150156  end   
    151   set mjd_nc = 55000.10 + 0.01*(tmpseq % 3) + 10.0*int(tmpseq / 3)
    152 
    153   delete tmpseq
    154157end
    155158
     
    169172
    170173  # reset the per-filter ZPT_OFF:$filter values
    171   for i 0 $filt_uc:n
    172     $filter = $filt_uc:$i
    173     $ZPT_OFF:$filter = NAN
    174   end
    175   for i 0 $filt_nc:n
    176     $filter = $filt_nc:$i
    177     $ZPT_OFF:$filter = NAN
    178   end
     174  $ZPT_OFF:$FILTER = NAN
    179175
    180176  for i 0 mjd_uc[]
    181     # ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
    182       ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
    183   end
    184   for i 0 mjd_nc[]
    185     # ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
    186       ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     177    # ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $FILTER relphot_uc
     178      ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $FILTER relphot_uc
    187179  end
    188180end
     
    222214  end
    223215
    224   skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
     216  # RA_MIN, etc are defined by mkstars
     217  skyregion $RA_MIN $RA_MAX $DEC_MIN $DEC_MAX
    225218
    226219  ## calculate the average zero point offset
     
    331324    $dec = $DECo - $dy / 3600.0
    332325    # echo $ra $dec $dx $dy
    333     mkinput test.in.txt $ra $dec $ZPT
     326    mkinput $ROOT.$ix.$iy.in.txt $ra $dec $ZPT
    334327   
    335328    # ra,dec is the center of this chip
     
    353346    $options = $options -exptime $EXPTIME
    354347
    355     tapEXEC mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
     348    tapEXEC mkcmf  $ROOT.$ix.$iy.in.txt $ROOT.$ix.$iy.cmf $options
    356349
    357350    # the fake images have inconsistent ra,dec and airmass,sidtime values
     
    437430  # the images are oriented along N-S, E-W lines
    438431
    439   # size of region of interest in linear arcseconds
    440   $RA_RANGE  = 1.25 * $CHIP_DX * $NCHIP_X * $PLATE_SCALE
    441   $DEC_RANGE = 1.25 * $CHIP_DY * $NCHIP_Y * $PLATE_SCALE
     432  # size of region of interest in linear degrees
     433  $RA_RANGE  = 1.25 * $CHIP_DX * $NCHIP_X * $PLATE_SCALE / 3600
     434  $DEC_RANGE = 1.25 * $CHIP_DY * $NCHIP_Y * $PLATE_SCALE / 3600
     435
     436  $RA_MIN  =  $RA_CENTER - 0.5*$RA_RANGE/dcos($DEC_CENTER)
     437  $RA_MAX  =  $RA_CENTER + 0.5*$RA_RANGE/dcos($DEC_CENTER)
     438  $DEC_MIN = $DEC_CENTER - 0.5*$DEC_RANGE
     439  $DEC_MAX = $DEC_CENTER + 0.5*$DEC_RANGE
    442440
    443441  create tmp 0 $1
    444   set stars_ra  = $RA_CENTER  + $RA_RANGE  * (rnd(tmp) - 0.5) / 3600 / dcos ($DEC_CENTER)
    445   set stars_dec = $DEC_CENTER + $DEC_RANGE * (rnd(tmp) - 0.5) / 3600
     442  set stars_ra  = $RA_CENTER  + $RA_RANGE  * (rnd(tmp) - 0.5) / dcos ($DEC_CENTER)
     443  set stars_dec = $DEC_CENTER + $DEC_RANGE * (rnd(tmp) - 0.5)
    446444  set stars_mag = 10.0 + 10.0 * rnd(tmp)
    447445  set stars_dmag = 0.02 + 0.1 * rnd(tmp)
Note: See TracChangeset for help on using the changeset viewer.