SpectraPreparation

From MediaWiki

(Difference between revisions)
Jump to: navigation, search
(Galaxy spectra)
m (Stellar spectra)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
== Stellar spectra ==
== Stellar spectra ==
 +
 +
* templ_elodie_4.prg
 +
! template namea
 +
! made by S. Samurovic 02-NOV-2001
 +
INDISK/FITS namea.fits
 +
CREATE/IMAG elodie_image 1,13501 4100.0,0.2 NODATA
 +
EXTRACT/IMAG elodie_image
 +
CREATE/TABLE elodie_image
 +
@@ alog2_elodie.prg toto0001 elodie_image
 +
EXTRAC/IMA  imagebroja = alogtoto0001 [3700:4600]
 +
EXTRAC/IMA  imagebrojb = alogtoto0001 [4450:5400]
 +
EXTRAC/IMA  imagebrojc = alogtoto0001 [5200:6200]
 +
EXTRAC/IMA  imagebrojd = alogtoto0001 [6000:6900]
 +
OUTDISK/FITS imagebroja spectra/nobrojanameb_cut_broja.fits
 +
OUTDISK/FITS imagebrojb spectra/nobrojbnameb_cut_brojb.fits
 +
OUTDISK/FITS imagebrojc spectra/nobrojcnameb_cut_brojc.fits
 +
OUTDISK/FITS imagebrojd spectra/nobrojdnameb_cut_brojd.fits
 +
 +
* alog2_elodie.prg
 +
with the corresponding MIDAS procedure ''alog2_elodie.prg''
 +
 +
! This is a quick routine for calculating rebbined 1D frame
 +
! One needs to have input file (wavelength calibrated) &
 +
! a reference image (in NORMAL scale!)
 +
! made by S. Samurovic 02-NOV-2001
 +
! modified 04-FEB-2003
 +
! for anti-logarithm - SDSS galaxies!
 +
!Thu May 21 18:59:32 CEST 2009
 +
DEFINE/PARA p1 ? IMA "Enter  frame to be rebinned in ALOG scale, i.e. sdss_396_log10:"
 +
DEFINE/PARA p2 ? IMA "Enter  the reference frame (must be also in LN), i.e. valdes_image:"
 +
DEFINE/LOCA framereb/c/1/128 {p1}
 +
DEFINE/LOCA refframe/c/1/128 {p2}
 +
COPY/it  {framereb}  {framereb} :wave
 +
READ/TABL {framereb}
 +
COMPUT/TABL {framereb} :alogl = :wave
 +
READ/TABL {framereb}
 +
CONVER/TABL  alog{framereb} = {framereb} :alogl #2 {refframe} spline
 +
 +
* This is the script from where the above procedures are called.
 +
if [ -z "$1" ]; then
 +
    echo "Usage :: $0 elodieDB_*.fits"
 +
    echo "Example: $0 elodieDB_G2V_00001.fits"
 +
    exit
 +
fi
 +
name=`echo $1 | cut -d"." -f1`
 +
 +
cp $name.fits myfits.fits
 +
imea="myfits"
 +
echo "imea: $imea    imeb: $name"
 +
num=`ps aux | grep "ana" | grep inmidas | wc -l`
 +
sed -e 's/namea/'$imea'/g' -e 's/nameb/'$name'/g' -e 's/npix/'$pixels'/g' -e 's/broja/'1'/g' -e 's/brojb/'2'/g' -e 's/brojc/'3'/g' -e 's/brojd/'4'/g' templ_elodie_4.prg > templ_elodie_$imea.prg
 +
inmidas -P 0$num < templ_elodie_$imea.prg
 +
rm templ_elodie_$imea.prg
== Galaxy spectra ==
== Galaxy spectra ==
Line 5: Line 58:
All the procedures here are adjusted to SDSS spectra.  
All the procedures here are adjusted to SDSS spectra.  
  !galaxy spSpec-namea
  !galaxy spSpec-namea
 +
! made by S. Samurovic 02-NOV-2001
  INDISK/FITS spSpec-namea.fit
  INDISK/FITS spSpec-namea.fit
  COMPUT/ROW  toto0001.r1 = toto0001.r1 + toto0001.r3 !this is a patch for errors!
  COMPUT/ROW  toto0001.r1 = toto0001.r1 + toto0001.r3 !this is a patch for errors!
Line 31: Line 85:
where ''num'' is an integer that enables MIDAS to work in parallel mode (if not necessary a part ''-P 0$num'' should be ignored).  
where ''num'' is an integer that enables MIDAS to work in parallel mode (if not necessary a part ''-P 0$num'' should be ignored).  
-
Another procedure called ''alog2_elodie.prg'' that is called from the previous is given below:
+
Another procedure called ''alog2_elodie.prg'' that is called from the previous procedure is given below:
  ! made by S. Samurovic 02-NOV-2001
  ! made by S. Samurovic 02-NOV-2001
  ! modified 04-FEB-2003
  ! modified 04-FEB-2003

Latest revision as of 10:10, 27 December 2009

Stellar spectra

  • templ_elodie_4.prg
! template namea
! made by S. Samurovic 02-NOV-2001
INDISK/FITS namea.fits
CREATE/IMAG elodie_image 1,13501 4100.0,0.2 NODATA
EXTRACT/IMAG elodie_image
CREATE/TABLE elodie_image
@@ alog2_elodie.prg toto0001 elodie_image
EXTRAC/IMA  imagebroja = alogtoto0001 [3700:4600] 
EXTRAC/IMA  imagebrojb = alogtoto0001 [4450:5400] 
EXTRAC/IMA  imagebrojc = alogtoto0001 [5200:6200] 
EXTRAC/IMA  imagebrojd = alogtoto0001 [6000:6900] 
OUTDISK/FITS imagebroja spectra/nobrojanameb_cut_broja.fits
OUTDISK/FITS imagebrojb spectra/nobrojbnameb_cut_brojb.fits
OUTDISK/FITS imagebrojc spectra/nobrojcnameb_cut_brojc.fits
OUTDISK/FITS imagebrojd spectra/nobrojdnameb_cut_brojd.fits
  • alog2_elodie.prg

with the corresponding MIDAS procedure alog2_elodie.prg

! This is a quick routine for calculating rebbined 1D frame
! One needs to have input file (wavelength calibrated) &
! a reference image (in NORMAL scale!)
! made by S. Samurovic 02-NOV-2001
! modified 04-FEB-2003
! for anti-logarithm - SDSS galaxies!
!Thu May 21 18:59:32 CEST 2009
DEFINE/PARA p1 ? IMA "Enter  frame to be rebinned in ALOG scale, i.e. sdss_396_log10:"
DEFINE/PARA p2 ? IMA "Enter  the reference frame (must be also in LN), i.e. valdes_image:"
DEFINE/LOCA framereb/c/1/128 {p1}
DEFINE/LOCA refframe/c/1/128 {p2}
COPY/it  {framereb}  {framereb} :wave
READ/TABL {framereb}
COMPUT/TABL {framereb} :alogl = :wave
READ/TABL {framereb}
CONVER/TABL  alog{framereb} = {framereb} :alogl #2 {refframe} spline
  • This is the script from where the above procedures are called.

if [ -z "$1" ]; then

   echo "Usage :: $0 elodieDB_*.fits"
   echo "Example: $0 elodieDB_G2V_00001.fits"
   exit

fi name=`echo $1 | cut -d"." -f1`

cp $name.fits myfits.fits imea="myfits" echo "imea: $imea imeb: $name" num=`ps aux | grep "ana" | grep inmidas | wc -l` sed -e 's/namea/'$imea'/g' -e 's/nameb/'$name'/g' -e 's/npix/'$pixels'/g' -e 's/broja/'1'/g' -e 's/brojb/'2'/g' -e 's/brojc/'3'/g' -e 's/brojd/'4'/g' templ_elodie_4.prg > templ_elodie_$imea.prg inmidas -P 0$num < templ_elodie_$imea.prg rm templ_elodie_$imea.prg

Galaxy spectra

All the procedures here are adjusted to SDSS spectra.

!galaxy spSpec-namea
! made by S. Samurovic 02-NOV-2001
INDISK/FITS spSpec-namea.fit
COMPUT/ROW  toto0001.r1 = toto0001.r1 + toto0001.r3 !this is a patch for errors!
$mv toto0001.bdf spSpec_nameb_log10.bdf
@@ alog2_galaxy_sdss.prg spSpec_nameb_log10 ref_imagealog
COMPUT/IMAG alogspSpec_nameb_log10 = alogspSpec_nameb_log10/ave
!WAIT/SECS 6
! to deredshift the galaxy to z=0 (z=0crvpomak)
REBIN/ii   alogspSpec_nameb_log10_reb  alogspSpec_nameb_log10 ref_imagealog LIN 0.,1crvpomak
EXTRAC/IMAG alogspSpec1_nameb_log10_reb_cut = alogspSpec_nameb_log10_reb [4110:4568]
EXTRAC/IMAG alogspSpec2_nameb_log10_reb_cut = alogspSpec_nameb_log10_reb [4568:5336]
EXTRAC/IMAG alogspSpec3_nameb_log10_reb_cut = alogspSpec_nameb_log10_reb [5336:6104]
EXTRAC/IMAG alogspSpec4_nameb_log10_reb_cut = alogspSpec_nameb_log10_reb [6104:6799]
OUTDIS/FITS alogspSpec1_nameb_log10_reb_cut alogspSpec_1_nameb_log10_reb_cut.fits
OUTDIS/FITS alogspSpec2_nameb_log10_reb_cut alogspSpec_2_nameb_log10_reb_cut.fits
OUTDIS/FITS alogspSpec3_nameb_log10_reb_cut alogspSpec_3_nameb_log10_reb_cut.fits
OUTDIS/FITS alogspSpec4_nameb_log10_reb_cut alogspSpec_4_nameb_log10_reb_cut.fits

This procedure should be called from the script, fed with:

sed -e 's/namea/'$imea'/g' -e 's/nameb/'$imeb'/g' -e 's/redshift/'$redshift'/g' -e 's/ave/'$ave'/g' ThisProcedure.prg > galaxy_$imeb.prg 

where imea is the name of the galaxy fit file and imeb desired short name. Redshift should be read from the header of the fit file, for example using IDL:

galaxy = mrdfits('galaxy.fit',0,hdr, /silent)
redshift = sxpar(hdr,'Z')

Now, the procedure should be called from the script with:

inmidas -P 0$num < galaxy_$imeb.prg

where num is an integer that enables MIDAS to work in parallel mode (if not necessary a part -P 0$num should be ignored).

Another procedure called alog2_elodie.prg that is called from the previous procedure is given below:

! made by S. Samurovic 02-NOV-2001
! modified 04-FEB-2003
!
! for anti-logaritham - SDSS galaxies!
!Thu May 21 18:59:32 CEST 2009
CREATE/IMAG ref_imagealog 1,3860 3792.2765,1.00023 NODATA 
! 3860 number of pixels (NAXIS1), 3792.2765 starting wavelength (CRVAL) and 1.00023 the step (CDELT1)
DEFINE/PARA p1 ? IMA "Enter  frame to be rebinned in ALOG scale, i.e. sdss_396_log10:"
DEFINE/PARA p2 ? IMA "Enter  the reference frame (must be also in LN), i.e. ref_imagealog:"
DEFINE/LOCA framereb/c/1/128 {p1}
DEFINE/LOCA refframe/c/1/128 {p2}
COPY/it  {framereb}  {framereb} :wave
!READ/TABL {framereb}
COMPUT/TABL {framereb} :alogl = 10.**(:wave)
CONVER/TABL  alog{framereb} = {framereb} :alogl #2 {refframe} spline

and should be used only when dealing with spectra that are in logarithm scale (like SDSS spectra). This procedure only makes anti-logarithmic wavelength scale.

Also, the 'middle' galaxy flux read and exported to some file.

flux = gal[*,0]
sr = (max(flux)+min(flux))/100

Here, 'sr' is that middle value. Dividing with 100 normalizes spectra to be flux<100. Otherwise, further measurements will be dependent on different values of galaxy spectra. This is ave value in the first procedure.

Personal tools