PRO PMTRAS_DBASE_PHOTOMETRY, dbsolution, photometry_mode, AVOFF_SCAT= avoff_scat ; Generates photometry-based display of PMTRAS database. ; ; 1-Aug-03 Initial version (ghurford@ssl.berkeley.edu) just organizes data and plots intensities ; 18-Jun-04 gh Add av_offset calculation ; 24-Jun-04 gh Return value of avoff_scat via keyword. ; ; Create an array of structures to hold photometry data nrp = N_ELEMENTS(dbsolution) ; number of roll points in dbsolution indat = {detections: 0, $ id: 0, $ intensity: 0, $ av_offset: 0., $ sctime: 0L} indat = REPLICATE(indat, nrp*10L) ; oversized array of structures to hold all star data ; ; Populate the indat structure, looping over roll points in dbsolution m = 0L FOR i = 0L, nrp-1 DO BEGIN nstar = dbsolution[i].starcount IF dbsolution[i].roll_quality GE 216 THEN BEGIN FOR n=0L, nstar-1 DO BEGIN indat[m].detections = dbsolution[i].stars[n].detections indat[m].id = dbsolution[i].stars[n].id indat[m].intensity = dbsolution[i].stars[n].intensity indat[m].av_offset = dbsolution[i].stars[n].av_offset indat[m].sctime = dbsolution[i].sctime m = m + 1 ENDFOR ENDIF ENDFOR npt = m indat = indat[0:npt-1] ; discard empty elements in the indat structure ; ; Make an ordered list of unique starIDs. ids = indat.id sorted_ids = ids(SORT(ids)) hrnlist = sorted_ids(UNIQ (sorted_ids)) ; array of unique HRN values for this interval nstars = N_ELEMENTS(hrnlist) ; number of unique stars for this interval PLOT, indat.id, indat.intensity, PSYM=1, SYMSIZE=0.5, YRANGE=[10,1000], YLOG=1, XTITLE='HR#', YTITLE='' PLOT, indat.id, indat.av_offset*!RADEG, PSYM=1, SYMSIZE=0.3, XTITLE='HR#', YTITLE=' (deg)' ; ; Average star-associated offsets. avoff = FLTARR(nstars) FOR n=0, nstars-1 DO BEGIN j = WHERE(ids EQ hrnlist[n], nj) IF nj GT 0 THEN avoff[n] = MEAN(INDAT[j].av_offset)*!RADEG ENDFOR OPLOT, hrnlist, avoff, PSYM=7, SYMSIZE=1.5 avoff_scat = STDDEV(avoff) ; PRINT, 'stddev=', avoff_scat RETURN END