diff --git a/utils/lcogt_dr4.pro b/utils/lcogt_dr4.pro deleted file mode 100644 index e14e31e6..00000000 --- a/utils/lcogt_dr4.pro +++ /dev/null @@ -1,30 +0,0 @@ -;;This is a wrapper that calls lcogt_phot.pro 20 times, once for each -;;DR4 target - -;;The directory names are the MAST names. The second argument needs to -;;be a name recognizable by SIMBAD. - -pro lcogt_dr4 - - lcogt_phot,'/astro/ullyses/lcogt_data/2MASSJ11432669-7804454/','2MASS J11432669-7804454' - lcogt_phot,'/astro/ullyses/lcogt_data/CHX18N/','CHX 18N' - lcogt_phot,'/astro/ullyses/lcogt_data/ECHA-J0844.2-7833/','ECHA J0844.2-7833' - lcogt_phot,'/astro/ullyses/lcogt_data/HN5/','Hn 5' - lcogt_phot,'/astro/ullyses/lcogt_data/SSTC2DJ160000.6-422158/','SSTc2d J160000.6-422158' - lcogt_phot,'/astro/ullyses/lcogt_data/SSTC2DJ161344.1-373646/','SSTc2d J161344.1-373646' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ10/','Sz 10' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ111/','Sz 111' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ130/','Sz 130' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ45/','Sz 45' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ66/','Sz 66' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ69/','Sz 69' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ71/','Sz 71' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ72/','Sz 72' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ75/','Sz 75' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ76/','Sz 76' - lcogt_phot,'/astro/ullyses/lcogt_data/SZ77/','Sz 77' - lcogt_phot,'/astro/ullyses/lcogt_data/V-IN-CHA/','V* IN Cha' - lcogt_phot,'/astro/ullyses/lcogt_data/V-TW-HYA/','V* TW Hya' - lcogt_phot,'/astro/ullyses/lcogt_data/V-XX-CHA/','V* XX Cha' - -end diff --git a/utils/lcogt_dr5.pro b/utils/lcogt_dr5.pro deleted file mode 100644 index b27e2898..00000000 --- a/utils/lcogt_dr5.pro +++ /dev/null @@ -1,18 +0,0 @@ -;;This is a wrapper that calls lcogt_phot.pro 8 times, once for each -;;DR5 target - -;;The directory names are the MAST names. The second argument needs to -;;be a name recognizable by SIMBAD. - -pro lcogt_dr5 - - lcogt_phot,'/astro/ullyses/lcogt_data/V-RU-LUP/','V* RU Lup' - lcogt_phot,'/astro/ullyses/lcogt_data/V-BP-TAU/','V* BP Tau' - lcogt_phot,'/astro/ullyses/lcogt_data/V-GM-AUR/','V* GM Aur' - lcogt_phot,'/astro/ullyses/lcogt_data/RXJ0438.6+1546/','RX J0438.6+1546' - lcogt_phot,'/astro/ullyses/lcogt_data/V505-ORI/','V505 Ori' - lcogt_phot,'/astro/ullyses/lcogt_data/RECX-5/','RECX 5' - lcogt_phot,'/astro/ullyses/lcogt_data/RECX-6/','RECX 6' - lcogt_phot,'/astro/ullyses/lcogt_data/RECX-9/','RECX 9' - -end diff --git a/utils/lcogt_orion.pro b/utils/lcogt_orion.pro deleted file mode 100644 index 2b07d7a4..00000000 --- a/utils/lcogt_orion.pro +++ /dev/null @@ -1,20 +0,0 @@ -;;This is a wrapper that calls lcogt_phot.pro 13 times, once for each -;;Orion target - -pro lcogt_orion - - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-17/','CVSO 17' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-36/','CVSO 36' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-58/','CVSO 58' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-90/','CVSO 90' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-104/','CVSO 104' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-107/','CVSO 107' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-109/','CVSO 109' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-146/','CVSO 146' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-165/','CVSO 165' - lcogt_phot,'/astro/ullyses/lcogt_data/CVSO-176/','CVSO 176' - lcogt_phot,'/astro/ullyses/lcogt_data/V505-ORI/','V505 Ori' - lcogt_phot,'/astro/ullyses/lcogt_data/V510-ORI/','V510 Ori' - lcogt_phot,'/astro/ullyses/lcogt_data/V-TX-ORI/','V* TX Ori' - -end diff --git a/utils/lcogt_uphot.pro b/utils/lcogt_uphot.pro index 42b64f8f..837f7ee8 100644 --- a/utils/lcogt_uphot.pro +++ b/utils/lcogt_uphot.pro @@ -67,7 +67,6 @@ function get_counts,star,calimage,catfile,exptime_cal,airmass_cal if sxpar(hdr,'WCSERR') ne 0 then begin ;;borrow an image with good WCS - datadir='/astro/ullyses/lcogt_data/' case star of 'V* BP Tau': good=datadir+'V-BP-TAU-CAL/ogg0m406-kb27-20210909-0216-e91.fits.fz' 'V* GM Aur': good=datadir+'V-GM-AUR-CAL/ogg0m404-kb82-20211010-0250-e91.fits.fz' @@ -285,7 +284,7 @@ function photometry,target,image,calimage,catfile,filter,targ_ra,targ_dec,f0,PLO end -pro lcogt_uphot,imagedir,target,PLOT=plot +pro lcogt_uphot,imagedir,target,PLOT=plot,datadir ;;uncomment when debugging to close any output files close,/all diff --git a/utils/make_alias_file.py b/utils/make_alias_file.py index e5254549..ea089c2e 100644 --- a/utils/make_alias_file.py +++ b/utils/make_alias_file.py @@ -183,83 +183,6 @@ def fix_pipes(all_aliases): return all_aliases -# NOT IN USE -def create_fuse_alias2(): -# NOT IN USE - fuse_targs0 = glob.glob("/astro/ullyses/ullyses_target/data/SMC/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/LMC/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/SMC_FUSE/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/LMC_FUSE/FUSE/*") - fuse_targs = [os.path.basename(x) for x in fuse_targs0] - fuse_targs_upper = [x.upper() for x in fuse_targs] - - fuse_dicts = [] - for i in range(len(fuse_targs0)): - fuse_d = {} - fuse_d["dirname"] = fuse_targs_upper[i] - - partial_d = fuse_targs0[i] - partial_d = partial_d.replace("[", "LEFTBRACKET") - partial_d = partial_d.replace("]", "RIGHTBRACKET") - partial_d = partial_d.replace("LEFTBRACKET", "[[]") - partial_d = partial_d.replace("RIGHTBRACKET", "[]]") - files = glob.glob(os.path.join(partial_d, "*", "*.fit*")) - targnames0 = [fits.getval(x, "targname") for x in files] - targnames = list(set(targnames0)) - for j in range(len(targnames)): - fuse_d[f"targname{j}"] = targnames[j] - fuse_dicts.append(fuse_d) - - df = pd.DataFrame(fuse_dicts) - df = clean_df(df) - df.to_json("data/target_metadata/fuse_target_aliases.json", orient="split") - print("Wrote data/target_metadata/fuse_target_aliases.json") - - -# manual_insert.json includes manually matched FUSE names to ULLYSES names. -# This only needs to be run once and never again. -def create_fuse_alias(infile="data/target_metadata/manual_insert.json"): - fuse_targs0 = glob.glob("/astro/ullyses/ullyses_target/data/SMC/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/LMC/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/SMC_FUSE/FUSE/*") + \ - glob.glob("/astro/ullyses/ullyses_target/data/LMC_FUSE/FUSE/*") - fuse_targs = [os.path.basename(x) for x in fuse_targs0] - fuse_targs_upper = [x.upper() for x in fuse_targs] - - df = pd.read_json(infile, orient="split") - for i in range(len(df)): - fuse_targ = df.loc[i, "alias0"] - fuse_targ = fuse_targ.upper() - - inds = [j for j in range(len(fuse_targs_upper)) if fuse_targs_upper[j] == fuse_targ] - toadd = [] - for ind in inds: - d = fuse_targs0[ind] - d = d.replace("[", "LEFTBRACKET") - d = d.replace("]", "RIGHTBRACKET") - d = d.replace("LEFTBRACKET", "[[]") - d = d.replace("RIGHTBRACKET", "[]]") - files = glob.glob(os.path.join(d, "*", "*.fit*")) - toadd0 = [fits.getval(x, "targname") for x in files] - toadd += list(set(toadd0)) - - toadd = list(set(toadd)) - - emptycols = df.columns[df.iloc[i].isna()].tolist() - if len(toadd) > len(emptycols): - for comparisoncol in range(len(toadd)-len(emptycols)): - aliasno = len(df.columns)-1 - df[f"alias{aliasno}"] = np.nan - emptycols = df.columns[df.iloc[i].isna()].tolist() - for j in range(len(toadd)): - df.loc[i,emptycols[j]] = toadd[j] - - - - df = clean_df(df) - df.to_json(FUSEFILE1, orient="split") - print(f"Wrote {FUSEFILE1}") - def remove_withdrawn(df): # Sometimes rows with target=WITHDRAWN get in the aliases DF. Remove them. diff --git a/utils/vignette_correct.pro b/utils/vignette_correct.pro deleted file mode 100644 index 93fd7265..00000000 --- a/utils/vignette_correct.pro +++ /dev/null @@ -1,125 +0,0 @@ -pro vignette_correct - -;hi! we're comparing these two datasets to adjust the continuum for a spectrum that exhibits vignetting. - -datadir = '/astro/ullyses/custom_cal/v-tw-hya/dr3/g230l/exp/' -outdir = '/astro/ullyses/twhydra_cal/' -;normdata = 'le9d1cdgq_x1d' ;normal dataset -;vigndata = 'le9d1cdeq_x1d' ;vignetted dataset - - -;readcol,'/Users/tfischer/functional/ullyses/tw_hydra/filenames_crop.txt',bad,good,format = 'A,A',/SILENT ; this reads in the bad/good filenames -readcol,'/astro/ullyses/tfischer/raw_twhydra/filenames.txt',bad,good,format = 'A,A',/SILENT ; this reads in the bad/good filenames - -s = size(bad) - -for i = 0,s(3)-1 do begin - ;print,i - gooddat = mrdfits(datadir+good(i)+'_x1d.fits',1,h1,/SILENT) - baddat = mrdfits(datadir+bad(i)+'_x1d.fits',1,h2,/SILENT) - ;baddat = mrdfits(datadir+bad(i)+'_x1d.fits',1,h2) - -;let's take everything out and look at it - - flux1 = [gooddat[0].flux,gooddat[1].flux,gooddat[2].flux] ; get Strip A/B/C fluxes from normal dataset - wave1 = [gooddat[0].wavelength,gooddat[1].wavelength,gooddat[2].wavelength] ; " " wavelengths " " - - flux2 = [baddat[0].flux,baddat[1].flux,baddat[2].flux] ; get Strip A/B/C fluxes from vignetted dataset - wave2 = [baddat[0].wavelength,baddat[1].wavelength,baddat[2].wavelength] ; " " wavelengths " " - -; here we select some continuum wavebands in wavelength space to fit a slope to - -;; normal dataset - - cont1a = where(2760 lt wave1 and wave1 lt 2780, count) - cont1b = where(2820 lt wave1 and wave1 lt 2890, count) - - fluxcont1 = [flux1(cont1a),flux1(cont1b)] ; continuum flux - wavecont1 = [wave1(cont1a),wave1(cont1b)] ; continuum wavelength - - -;; vignetted dataset - - cont2a = where(2760 lt wave2 and wave2 lt 2780, count) - cont2b = where(2820 lt wave2 and wave2 lt 2890, count) - - fluxcont2 = [flux2(cont2a),flux2(cont2b)] ; continuum flux - wavecont2 = [wave2(cont2a),wave2(cont2b)] ; continuum wavelength - - sizew1 = size(wavecont1) - sizew2 = size(wavecont2) - - if (sizew1(1) gt sizew2(1)) then begin - fluxcont1 = fluxcont1[0:sizew2(1)-1] - wavecont1 = wavecont1[0:sizew2(1)-1] - endif else begin - fluxcont2 = fluxcont2[0:sizew1(1)-1] - wavecont2 = wavecont2[0:sizew1(1)-1] - endelse - -;we want to fit lines to the continuum fluxes, 'coeff' gives yfits to plot the lines - - coeff1 = poly_fit(wavecont1,fluxcont1,1,yfit = fit1) - coeff2 = poly_fit(wavecont2,fluxcont2,1,yfit = fit2) - -;here's a window that shows the normal & vignetted data (blue / red) and the selected continuum in the vignetted data - ;window,i - -; cgplot,wave1,flux1,color = 'blue',xrange = [2750,2900];, yrange = [0,8e-13] -; cgplot,wave2,flux2/0.92,color = 'red',/overplot -; cgplot,wavecont2,fluxcont2,thick=2,/overplot - -;here's a window that shows the slopes of the continuua in from each dataset, the vignetted data is fainter at short wavelengths -; window,(i*3)+1 - -; cgplot,wavecont2,fit2,thick = 2,color = 'red',xrange = [2750,2900], title = bad(i)+' Uncorrected';, yrange = [1e-14,5e-14]; vignetted data -; cgplot,wavecont1,fit1,thick = 2,/overplot,color = 'blue' ; normal data - -; cgplot,wave1,flux1,color = 'blue',/overplot ;continuum fit to normal data -; cgplot,baddat[1].wavelength,baddat[1].flux,color = 'red',/overplot ;continuum fit to *Strip B* of the vignetted data - -; let's fit a line to the ratio between the continuum fluxes from both datasets - - result = linfit(wavecont2,fit2/fit1) ; this gives the slope - - compy = result(1)*baddat[1].wavelength + result(0) ; this gives us the y-value of the line across the *Strip B* wavelengths - - ok = where(compy gt 1.,count) ; the ratio goes *over* 1.0 at longer wavelengths, let's find those array values - - compy(ok) = 1. ; aaaaand make them equal to 1.0, now only the vignetted portion of the spectrum will be scaled - -; here's a similar distribution to Window 1, except the vignetted flux is corrected on the short wavelength side -; window,(i*3)+2 - - ;cgplot,wave1,flux1,color = 'blue',xrange = [2750,2900], title = bad(i)+' Corrected';, yrange = [1e-14,5e-14] - ;cgplot,baddat[1].wavelength,baddat[1].flux/compy,color = 'red',/overplot - -; This distribution looks good, let's define it as the new flux for Strip B of this vignetted dataset - - newflux = baddat[1].flux/compy - baddat[1].flux = newflux - - mwrfits,baddat,outdir+bad(i)+'_x1d_newflux.fits',h2,/create ; and then save the updated vignetted dataset as a new file - - scalefile=outdir+bad(i)+'_scale.txt' - OPENW,1,scalefile - printf,1, compy, format='(1F)' - CLOSE,1 - -; ALSO! We need to correct the split-tag fluxes in the timeseries data. Let's use this scaling array to do that too. - - splitdir = '/astro/ullyses/timeseries/nuv/x1dfiles/' - - for j = 1,2 do begin - splitdata = mrdfits(splitdir+'split_'+bad(i)+'_'+STRTRIM(j,1)+'_x1d.fits',1,h3,/SILENT) - newflux = splitdata[1].flux/compy - splitdata[1].flux = newflux - mwrfits,splitdata,outdir+'split_'+bad(i)+'_'+STRTRIM(j,1)+'_x1d_newflux.fits',h3,/create - endfor - - print,'Finished with '+bad(i) - -endfor - - -end \ No newline at end of file