Michael and Chris' Walkthrough of Fisheye
Fisheye:
#!/bin/bash # Script to convert a fisheye camera image to FITS and provide some info # Syntax: ucam_fish.sh obsname [options] # E.g. ucam_fish.sh 56754.3993171 [options] # # It converts a CR2 image to monochrome FITS, computes a bunch of # statistics including solving for the stars # MWC 5/21/14: We pass FITS files (of various colors) already created # # This creates a variety of files. # # 56754.3993171.fits.fz = monochrome FITS image # 56754.3993171.fish = star list with fisheye information # 56754.3993171.mch = star list with photometry information # 56754.3993171_bw.jpg = sky image cropped and stretched to show stars # 56754.3993171_zp.png = sky image showing a ZP point for each star # 56754.3993171_sky.png = sky image showing a sky point for each star # # Note that PRODIR must point to ql_fish.pro and fishsky.pl # set -e set -x # sky brightness towards the end of twilight DAYBRGT=100 # Observatory longitude and latitude (REQUIRED) LNG=-155.5763 # MLO LAT=19.5362 # MLO # MWC 5/21/14: We edit to use Pachon coords LAT=-29.7621 LNG=-69.2618 # Bootstrap file of x,y,RA,Dec (REQUIRED if pointing not provided) # MWC: Use iObserve to determine that ut050614.0200.long.fits, which is at 2014-05-07T00:22:28, # MWC: has sidereal time of 10:39 >>> 10 + 39.0/60 = 10.65 decimal hours # MWC: Multiply this value by 360 / 24 to convert from time into angle: >>> 10.65 * 15 = 159.75 # Now get pixel conversion: >> atan(6.5e-6/15e-3) / (4.86*1e-6) = 89.1632 arcsecs (WRONG!!!!) (perhaps focal length wrong) # Fits files we make in our images are north up, and east to the left (by comparing two subsequent images) # Local sidereal time of local objects passing # Plot ra and decs from stars files and compare to image, write down x'a and y's from fits file and ra's and dec's # from catalog file, make file with these points combined # 5.41 degrees is 115 pixels -> 169 arcsec / pixel # converting to degrees: 5.41/115 = 0.0470 # Bootstrap stars: # 1373 1000 161.5721 -26.72607 # 1359 976 162.2402 -27.91779 # 1312 991 157.9528 -28.2371 # 1458 901.5 156.7879 -31.06778 # 1264 974 167.1833 -28.080607 # Convert RAs to HAs: HA=LST-RA # 1373 1000 -1.8221 -26.72607 # 1359 976 -2.4902 -27.91779 # 1312 991 1.7972 -28.2371 # 1458 901.5 2.9621 -31.06778 # 1264 974 -7.4333 -28.080607 # Now running fisheye... # [coughlin@lsst-dev bin]$ fisheye bootstrap-HA.txt # RA=0.731 DEC=-27.825 AZ=93.550 SCALE=0.04594 PARITY=-1 MED=4.552 # Now running fishiter.sh # [coughlin@lsst-dev bin]$ ./fishiter.sh ../data/ut050614/M/ut050614.0200.long.M # HA= 0.83 Dec= -27.87 Az= 94.32 Scale= 0.04621 quad= 0.00974 cube= -0.04610 cx= 1436.7 cy= 971.9 <dth>= 0.068 0.062 N= 33 lam= 8 niter= 28 # HA= 0.68 Dec= -27.99 Az= 94.25 Scale= 0.04615 quad= 0.00870 cube= -0.04598 cx= 1434.1 cy= 969.9 <dth>= 0.067 0.056 N= 32 lam= 3 niter= 25 # Use SkyView: wants coordinates and BOOT=bootstrap.txt # Initial pointing parameters (REQUIRED if bootstrap file not provided) # ## Note that these have to be quite accurate, the initial match of ## MCHTOL1, default 30 pix, will fail unless HA, DEC, and AZ are ## accurate to dANG < 1/2 MCHTOL1*SCALE (i.e. 1 deg or so) and SCALE is ## accurate to dSCALE/SCALE < 1/3 MCHTOL1/1000pix (i.e. 1% or better) # # These are appropriate for post 140326: HA=0.04 DEC=17.16 AZ=177.79 SCALE=0.0718 #HA=0 # Observation hour angle [required] DEC=-29.7621 # Observation declination [required] # AZ is calculated from N towards E (N to the left -> AZ = 0). Because we are north up, east left AZ=0 # Observation azimuth [required] #SCALE=0.07536 # Observation scale [required] SCALE=0.047 # Where can hip.dat.dat be found: $CATDIR/hip.dat (REQUIRED) CATDIR=/lsst/home/coughlin/allsky/bin PRODIR=/lsst/home/coughlin/allsky/bin # Other default parameters VERB=0 # Minimum number of tphot detections to proceed MINSTAR=100 # Match tolerance [pix] MCHTOL1=30 # First match tolerance [pix] at m<3 and N<100 MCHTOL=5 # Subsequence match tolerances [pix] RSIG=3 # Final pruning sigma # Clean up afterwards? CLEAN=1 if [[ $# -lt 1 ]] then echo "Usage: ucam3_imstats.sh obsname [options]" >&2 exit 1 fi obs=$1 ; shift 1 if [[ $obs =~ cr2$ ]]; then obs=`basename $obs .cr2` fi eval $@ hipcat=$CATDIR/hip.dat # A few sanity checks if [[ ! -e ${obs}.cr2 ]] ; then echo Observation ${obs}.cr2 does not exist fi if [[ ! -e $hipcat ]] ; then echo Hipparcos catalog $hipcat does not exist exit 1 fi if [[ ! -e $PRODIR/ql_fish.pro ]] ; then echo '$PRODIR/ql_fish.pro' does not exist. Is PRODIR set? exit 1 fi # Create the FITS file #raw2fits -bw $obs.cr2 if [[ ! -e $obs.obs ]] ; then printf "FILENAME= '%s' / Observation ID\n" $obs > $obs.obs fi etime=`fitshdr $obs.fits | grep EXPTIME | awk '{printf "%.6f", $3}'` # f-ratio, used to correct for vignetting frat=`fitshdr $obs.fits | grep APERTURE | awk '{printf "%.6f", $2}'` # Calculate some statistics for the image #stats=(`monsta $PRODIR/ql_fish.pro $obs`) # Report all the image stats from ql_ucam.pro #printf "QL_NSAT = %20d / Number of saturated pixels\n" ${stats[3]} >> $obs.obs #printf "QL_SKY = %20.1f / [ADU] median sky\n" ${stats[0]} >> $obs.obs #printf "QL_RMS = %20.1f / [ADU] mRMS sky\n" ${stats[1]} >> $obs.obs #printf "QL_BRGT = %20.3e / [ADU/sec] sky brightness at f/4\n" ${stats[2]} >> $obs.obs # If the background is too bright it's daytime and don't look for stars night=`echo ${stats[2]} | awk -v f=$DAYBRGT '{nite=$1>f?0:1; print nite}'` if [[ $night -eq 1 ]] ; then # tphot the image, lots o' hardwired parameters... TRAD=4 TSIG=2 TMIN=50 TBIAS=2048 TAPRAD=4 tphot $obs.fits -bias $TBIAS -rad $TRAD -sig $TSIG -min $TMIN -aprad $TAPRAD -okfit 0 -chin 100000 -out $obs.tph ntph=`wc $obs.tph | awk '{print $1}'` # How many stars did we find? printf "QL_NTPH = %20d / Number of stars in tphot\n" $ntph >> ${obs}.obs if [[ $ntph -ge $MINSTAR ]] ; then echo Observation $obs tphot found $ntph stars # Do the fisheye astrometry fit # First iteration: MLIM=3, NSTAR=100, matched fit then pruned fit: if [[ $VERB -gt 0 ]] ; then echo First iteration: MLIM=3, NSTAR=100 ; fi fishiter.sh $obs CATDIR=$CATDIR MLIM=3 NSTAR=100 MCHTOL=$MCHTOL1 HA=$HA DEC=$DEC AZ=$AZ SCALE=$SCALE LNG=$LNG LAT=$LAT FRAT=$frat CLEAN=$CLEAN VERB=$VERB # Second iteration: MLIM=5, NSTAR=1000, matched fit then pruned fit: if [[ $VERB -gt 0 ]] ; then echo Second iteration: MLIM=5, NSTAR=1000 ; fi if [[ -e $obs.fish ]] ; then parm=(`grep "HA=" $obs.fish`) HA=${parm[2]} DEC=${parm[4]} AZ=${parm[6]} SCALE=${parm[8]} QUAD=${parm[10]} CUBE=${parm[12]} CX=${parm[14]} CY=${parm[16]} fishiter.sh $obs CATDIR=$CATDIR MLIM=5 NSTAR=1000 MCHTOL=$MCHTOL HA=$HA DEC=$DEC AZ=$AZ SCALE=$SCALE CX=$CX CY=$CY QUAD=$QUAD CUBE=$CUBE LNG=$LNG LAT=$LAT FRAT=$frat CLEAN=$CLEAN VERB=$VERB # Third iteration: MLIM=6, NSTAR=2000, matched fit then pruned fit: if [[ $VERB -gt 0 ]] ; then echo Third iteration: MLIM=6, NSTAR=2000 ; fi parm=(`grep "HA=" $obs.fish`) HA=${parm[2]} DEC=${parm[4]} AZ=${parm[6]} SCALE=${parm[8]} QUAD=${parm[10]} CUBE=${parm[12]} CX=${parm[14]} CY=${parm[16]} fishiter.sh $obs CATDIR=$CATDIR MLIM=6 NSTAR=2000 MCHTOL=5 HA=$HA DEC=$DEC AZ=$AZ SCALE=$SCALE CX=$CX CY=$CY QUAD=$QUAD CUBE=$CUBE RSIG=$RSIG LNG=$LNG LAT=$LAT FRAT=$frat CLEAN=$CLEAN VERB=$VERB # Insert a few extras that may be useful parm=(`grep "HA=" $obs.fish`) HA=${parm[2]} DEC=${parm[4]} AZ=${parm[6]} SCALE=${parm[8]} QUAD=${parm[10]} CUBE=${parm[12]} CX=${parm[14]} CY=${parm[16]} printf "HA-OBS = %20.3f / [deg] hour angle\n" $HA >> $obs.obs printf "DEC-OBS = %20.3f / [deg] declination\n" $DEC >> $obs.obs printf "AZ-OBS = %20.3f / [deg] azimuth\n" $AZ >> $obs.obs printf "SCALE = %20.5f / [deg/pix] plate scale\n" $SCALE >> $obs.obs nstar=`wc $obs.fish | awk '{print $1-1}'` zp=(`awk -v dt=$etime 'NR>1{print $11-$18-2.5/log(10)*log(dt)}' $obs.mch | median verb`) mu=(`awk 'NR>1{print $11-$18+$20}' $obs.mch | median verb`) printf "NSTAR = %20d / Number of stars in fisheye\n" $nstar >> ${obs}.obs printf "ZP-OBS = %20.2f / [mag] zeropoint 1ADU/sec\n" ${zp[0]} >> $obs.obs printf "DZP-OBS = %20.2f / [mag] zeropoint scatter\n" ${zp[1]} >> $obs.obs printf "MU-OBS = %20.2f / [mag/sec^2] sky brightness\n" ${mu[0]} >> $obs.obs # Make the zeropoint and sky pngs # if [[ $nstar -gt $MINSTAR ]] ; then # cat > $obs.pl <<EOF #input $PRODIR/fishsky.mongo #jpg $obs.zp.fig #zpmap $obs #hardcopy wait #jpg $obs.sky.fig #skymap $obs #hardcopy wait #end #EOF # mongo $obs.pl # fig2dev -L png -g black $obs.zp.fig ${obs}_zp.png # fig2dev -L png -g black $obs.sky.fig ${obs}_sky.png # rm $obs.pl $obs.zp.fig $obs.sky.fig # fi fi else # Too few tphot stars to attempt a fisheye fit printf "NSTAR = %20d / Number of stars in fisheye\n" 0 >> ${obs}.obs fi else # Not night time printf "QL_NTPH = %20d / Number of stars in tphot\n" 0 >> ${obs}.obs # Make a smaller picture if daytime # convert -crop 3100x2560+375+0 -scale 25% $obs.jpg ${obs}_clr.jpg fi echo $obs # Make a smaller picture increasing constrast for night time #mdcraw -e -c $obs.cr2 | convert - -crop 4656x3840+540+0 -scale 20\% -contrast-stretch 2\%x0.1\% -gravity south -fill white -undercolor '#00000080' -annotate +0+5 "$obs" $(basename $obs .cr2)_clr.jpg # Insert the .obs info into FITS file #fitshdr $obs.fits $obs.obs # fpack the FITS file and delete original #fpack -D -Y $obs.fits # Copy the file to our weather page. #if [[ "$SUMMIT_CRON" ]]; then # cd /home/atlas/fisheye # convert latest.jpg -resize 400 latest400.jpg # convert latest.jpg -resize 1000 latest1000.jpg # scp latest400.jpg latest1000.jpg atlas@atlas.ifa-instruments.org:/var/www/weather/mlo/ #fi #exit 0
Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use