IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33138


Ignore:
Timestamp:
Jan 23, 2012, 9:40:03 PM (14 years ago)
Author:
eugene
Message:

add options to mkcmf; improvements to relphot.flatcorr test script

Location:
branches/eam_branches/ipp-20111122/Ohana/src/addstar
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/addstar/src/mkcmf.c

    r33135 r33138  
    7474  }
    7575
     76  double CRPIX1 = 0.0;
     77  double CRPIX2 = 0.0;
     78  if ((N = get_argument (argc, argv, "-crpix"))) {
     79    remove_argument (N, &argc, argv);
     80    CRPIX1 = atof (argv[N]);
     81    remove_argument (N, &argc, argv);
     82    CRPIX2 = atof (argv[N]);
     83    remove_argument (N, &argc, argv);
     84  }
     85
     86  int NX = 0;
     87  int NY = 0;
     88  if ((N = get_argument (argc, argv, "-size"))) {
     89    remove_argument (N, &argc, argv);
     90    NX = atof (argv[N]);
     91    remove_argument (N, &argc, argv);
     92    NY = atof (argv[N]);
     93    remove_argument (N, &argc, argv);
     94  }
     95
    7696  // add support for all cmf types
    7797  static char *type = "PS1_V2";
     
    105125  coords.crval1 = RA;
    106126  coords.crval2 = DEC;
    107   coords.crpix1 = 0.0;
    108   coords.crpix2 = 0.0;
     127  coords.crpix1 = CRPIX1;
     128  coords.crpix2 = CRPIX2;
    109129 
    110130  coords.cdelt1 = 0.25/3600.0;
     
    157177    Nstars ++;
    158178  }
     179  if (NX && NY) {
     180      Xmax = NX;
     181      Ymax = NY;
     182  }
    159183
    160184  // create primary header
     
    166190
    167191  // XXX add minimum needed header fields
    168   gfits_print (&header, "IMNAXIS1", "%d", 1, (int)(Xmax + 50));
    169   gfits_print (&header, "IMNAXIS2", "%d", 1, (int)(Ymax + 50));
     192  gfits_print (&header, "IMNAXIS1", "%d", 1, (int)(Xmax));
     193  gfits_print (&header, "IMNAXIS2", "%d", 1, (int)(Ymax));
    170194
    171195  gfits_modify (&header, "NSTARS",   "%d", 1, Nstars);
  • branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.flatcorr.dvo

    r33136 r33138  
    6969
    7070macro go
     71  if ($0 != 3)
     72    echo "go (fileroot) (catdir)"
     73    break
     74  end
     75
     76  exec rm -rf $2
     77
    7178  init
    7279  mkzptfile
     
    7481
    7582  mkdir testdata
    76   mksequence testdata/t1
     83  mksequence $1 $2
     84end
     85
     86macro ckexposure
     87
     88  # assume we still have stars_ra, stars_dec, stars_mag in hand
     89  catdir catdir.test
     90  region $RA_CENTER $DEC_CENTER 0.2
     91  images
     92  pmeasure -all -m 15 20
     93  mextract -region ra dec mag
     94 
     95  match2d -closest ra dec stars_ra stars_dec 0.001 -index1 index1 -index2 index2
     96
     97  reindex stars_ra_m = stars_ra using index1
     98  reindex stars_dec_m = stars_dec using index1
     99  reindex stars_mag_m = stars_mag using index1
     100  set dr = 3600*(ra - stars_ra_m)
     101  set dd = 3600*(dec - stars_dec_m)
     102  set dm = mag - stars_mag_m
     103  lim mag dm; clear; box; plot mag dm
    77104end
    78105
    79106macro mksequence
    80   if ($0 != 2)
    81     echo "mksequence (fileroot)"
     107  if ($0 != 3)
     108    echo "mksequence (fileroot) (catdir)"
    82109    break
    83110  end
     
    86113
    87114  # we have defined a set of images by mjd and zero point
    88   for i 0 mjd[]
    89     mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt[$i] mjd[$i] g
     115  # for i 0 mjd[]
     116  for i 0 1
     117    mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt[$i] mjd[$i] g $2
    90118  end
    91119end
    92120
    93121macro mkexposure
    94  if ($0 != 7)
    95    echo "mkexposure (fileroot) (ra) (dec) (zpt) (mjd) (filter)"
     122 if ($0 != 8)
     123   echo "mkexposure (fileroot) (ra) (dec) (zpt) (mjd) (filter) (catdir)"
    96124   break
    97125 end
     
    119147    $ra  = $RAo  - $dx / 3600.0 / dcos($DECo)
    120148    $dec = $DECo - $dy / 3600.0
     149    echo $ra $dec $dx $dy
    121150    mkinput test.in.txt $ra $dec $ZPT
    122 
    123     # make a GPC1-style chip
    124     # XX exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -date $date -time $time -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy
    125     # XX echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -date $date -time $time -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy
    126 
    127     exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise
    128     echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise
    129151   
    130     exec addstar $ROOT.$ix.$iy.cmf -D CATDIR catdir.test -D CAMERA gpc1
     152    # ra,dec is the center of this chip
     153    exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise -size $CHIP_DX $CHIP_DY -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
     154    echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise -size $CHIP_DX $CHIP_DY -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
     155   
     156    exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $7 -D CAMERA gpc1
    131157  end
    132158 end
     
    141167
    142168  # chip coordinate of the stars
    143   set stars_X = (stars_ra  - $2) * 3600.0 * dcos($3) / $PLATE_SCALE
    144   set stars_Y = (stars_dec - $3) * 3600.0 / $PLATE_SCALE
     169  # ra,dec is at the chip center, which corresponds to pixel (CHIP_DX,CHIP_DY)/2
     170  set stars_X = (stars_ra  - $2) * 3600.0 * dcos($3) / $PLATE_SCALE + $CHIP_DX*0.5
     171  set stars_Y = (stars_dec - $3) * 3600.0            / $PLATE_SCALE + $CHIP_DY*0.5
    145172  set stars_M = (stars_mag - $4)
    146173
     
    213240  # create 9 exposures, 3 per season
    214241  create imageID 0 9
    215   set zpt = imageID*0.0050 - 0.0025
     242  set zpt = 25.0 + imageID*0.0050 - 0.0025
    216243  set mjd = zero(zpt)
    217244  mjd[0] = 55000.01
Note: See TracChangeset for help on using the changeset viewer.