SpectraPreparation

From MediaWiki

(Difference between revisions)
Jump to: navigation, search
(Stellar spectra)
(Galaxy spectra)
Line 2: Line 2:
== Galaxy spectra ==
== Galaxy spectra ==
 +
 +
All the procedures here are adjusted to SDSS spectra.
 +
!galaxy spSpec-namea
 +
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 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.

Revision as of 17:14, 21 December 2009

Stellar spectra

Galaxy spectra

All the procedures here are adjusted to SDSS spectra.

!galaxy spSpec-namea
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 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