PRO normalise_msst, scope ;; normalise_msst ;; ;; Purpose: ;; ;; Normalise MSST 4m time-series spectroscopy ;; ;; Use: ;; ;; normalise_msst, ;; ;; Example: ;; ;; normalise_msst, 'apo_red' ;; normalise_msst, 'twin_blue' ;; normalise_msst, 'twin_red' ;; ;; ;; Standard FAST common blocks COMMON fileblock, nfiles, folder, flabel, nruns, nbomit, nwomit COMMON fitsblock, time, wave, spec, nwave, nspec COMMON procblock, specf, specr, specm COMMON pspecblock, freq, twod_dft COMMON xcorblock, ccfx, ccfy, ccf2y, ccf2n, nccf, afits, template ;; identify the dataset with an index IF scope EQ 'apo_red' THEN isc = 0 IF scope EQ 'twin_blue' THEN isc = 1 IF scope EQ 'twin_red' THEN isc = 2 ;; define continum regions for normalising the data creg = fltarr(3,12) creg(0,0:3) = [3.806,3.810, 3.820,3.825 ] creg(1,*) = [3.587,3.588, 3.593,3.596, 3.603,3.608, 3.615,3.630, 3.637,3.682, 3.688, 3.695] creg(2,0:3) = [3.806,3.810, 3.820,3.826 ] ;; read in a previous dataset stored using "save_msst" restore, filename=scope wave = w time = t spec = s IF ( isc EQ 2 OR isc EQ 0 ) THEN BEGIN mask = WHERE ( w GE alog10(6400) AND w LE alog10 (6700) ) wave = w(mask) spec = s(mask,*) ENDIF nwave=n_elements(wave) nspec=n_elements(time) nwomit = 0 ;; display raw data IF (strupcase(!d.name) EQ 'X') THEN BEGIN window,1 shade_surf,spec,wave,time ENDIF ;; compute and analyse the light variations lightcurve, wave, time, spec, lc, dm IF (strupcase(!d.name) EQ 'X') THEN BEGIN window,0 plot,time,dm,xtitle='day',ytitle='dmag' ENDIF ;; normalise the data normalise, creg(isc,*) IF (strupcase(!d.name) EQ 'X') THEN BEGIN window,0 plot,wave,specm window,1 shade_surf,spec,wave,time ENDIF save, filename=scope+'_norm', /All RETURN ;; clean the data cleandata specf = spec IF (strupcase(!d.name) EQ 'X') THEN BEGIN window,0 plot,wave,specm,xtitle='Angstrom',ytitle='F/Fc' window,1 shade_surf,specr,wave,time ENDIF END