Cosmic Rays and apall extraction of low S/N spectra
lchomiuk wrote on Feb 24, 2010
I'm extracting some rather low signal-to-noise spectra with apall, and I've noticed that cosmic rays (either on the source spectrum or in the background region) have a very strong and distorting effect on the extracted spectrum. I get large narrow spikes, as I would expect from cosmic rays, but these spikes seem to "ring" for several hundred pixels on either side of the cosmic ray spike, changing the shape of the extracted spectrum and increasing the noise.
If I set the 'clean' parameter in apall, this seems to help quite a lot, and it catches most of the distorting cosmic rays---but not all. I've found that LAcosmic works best. Once the cosmic rays have been cleaned out of the images, apall works as I would expect it to.
So, I've found a work-around, but my question is, why is this happening? I've noticed it now in two independent data sets from two different telescopes, but other people I've asked have not noticed this effect.
Here is a spectrum extracted with cosmic rays in it:
[img:35d1f022d1]http://www.astro.wisc.edu/~chomiuk/spec_with_cr.jpg[/img:35d1f022d1]
And here is the exact same spectrum, just extracted with clean=yes in apall:
[img:35d1f022d1]http://www.astro.wisc.edu/~chomiuk/spec_wo_cr.jpg[/img:35d1f022d1]
Notice that it has an entirely different continuum shape!
My apall parameters are below:
PACKAGE = apextract
TASK = apall
input = c214 List of input images
(output = sp214) List of output spectra
(apertur= ) Apertures
(format = onedspec) Extracted spectra format
(referen= ) List of aperture reference images
(profile= ) List of aperture profile images
(interac= yes) Run task interactively?
(find = no) Find apertures?
(recente= yes) Recenter apertures?
(resize = no) Resize apertures?
(edit = yes) Edit apertures?
(trace = yes) Trace apertures?
(fittrac= yes) Fit the traced points interactively?
(extract= yes) Extract spectra?
(extras = yes) Extract sky, sigma, etc.?
(review = yes) Review extractions?
(line = 1150) Dispersion line
(nsum = -900) Number of dispersion lines to sum or median
# DEFAULT APERTURE PARAMETERS
(lower = -4.5) Lower aperture limit relative to center
(upper = 4.5) Upper aperture limit relative to center
(apidtab= ) Aperture ID table (optional)
# DEFAULT BACKGROUND PARAMETERS
(b_funct= chebyshev) Background function
(b_order= 3) Background function order
(b_sampl= -20:-7,7:20) Background sample regions
(b_naver= 1) Background average or median
(b_niter= 3) Background rejection iterations
(b_low_r= 4.) Background lower rejection sigma
(b_high_= 4.) Background upper rejection sigma
(b_grow = 2.) Background rejection growing radius
# APERTURE CENTERING PARAMETERS
(width = 10.) Profile centering width
(radius = 10.) Profile centering radius
(thresho= 0.) Detection threshold for profile centering
# AUTOMATIC FINDING AND ORDERING PARAMETERS
nfind = 1 Number of apertures to be found automatically
(minsep = 5.) Minimum separation between spectra
(maxsep = 100.) Maximum separation between spectra
(order = increasing) Order of apertures
# RECENTERING PARAMETERS
(aprecen= ) Apertures for recentering calculation
(npeaks = INDEF) Select brightest peaks
(shift = yes) Use average shift instead of recentering?
# RESIZING PARAMETERS
(llimit = INDEF) Lower aperture limit relative to center
(ulimit = INDEF) Upper aperture limit relative to center
(ylevel = 0.1) Fraction of peak or intensity for automatic width
(peak = yes) Is ylevel a fraction of the peak?
(bkg = yes) Subtract background in automatic width?
(r_grow = 0.) Grow limits by this factor
(avglimi= no) Average limits over all apertures?
# TRACING PARAMETERS
(t_nsum = 50) Number of dispersion lines to sum
(t_step = 50) Tracing step
(t_nlost= 10) Number of consecutive times profile is lost before quitting
(t_funct= legendre) Trace fitting function
(t_order= 3) Trace fitting function order
(t_sampl= *) Trace sample regions
(t_naver= 1) Trace average or median
(t_niter= 0) Trace rejection iterations
(t_low_r= 3.) Trace lower rejection sigma
(t_high_= 3.) Trace upper rejection sigma
(t_grow = 0.) Trace rejection growing radius
# EXTRACTION PARAMETERS
(backgro= fit) Background to subtract
(skybox = 1) Box car smoothing length for sky
(weights= variance) Extraction weights (none|variance)
(pfit = fit2d) Profile fitting type (fit1d|fit2d)
(clean = no) Detect and replace bad pixels?
(saturat= 65000.) Saturation level
(readnoi= 2.75) Read out noise sigma (photons)
(gain = 1.1) Photon gain (photons/data number)
(lsigma = 3.) Lower rejection threshold
(usigma = 3.) Upper rejection threshold
(nsubaps= 1) Number of subapertures per aperture
(mode = ql)
Thanks very much!
Laura
If I set the 'clean' parameter in apall, this seems to help quite a lot, and it catches most of the distorting cosmic rays---but not all. I've found that LAcosmic works best. Once the cosmic rays have been cleaned out of the images, apall works as I would expect it to.
So, I've found a work-around, but my question is, why is this happening? I've noticed it now in two independent data sets from two different telescopes, but other people I've asked have not noticed this effect.
Here is a spectrum extracted with cosmic rays in it:
[img:35d1f022d1]http://www.astro.wisc.edu/~chomiuk/spec_with_cr.jpg[/img:35d1f022d1]
And here is the exact same spectrum, just extracted with clean=yes in apall:
[img:35d1f022d1]http://www.astro.wisc.edu/~chomiuk/spec_wo_cr.jpg[/img:35d1f022d1]
Notice that it has an entirely different continuum shape!
My apall parameters are below:
PACKAGE = apextract
TASK = apall
input = c214 List of input images
(output = sp214) List of output spectra
(apertur= ) Apertures
(format = onedspec) Extracted spectra format
(referen= ) List of aperture reference images
(profile= ) List of aperture profile images
(interac= yes) Run task interactively?
(find = no) Find apertures?
(recente= yes) Recenter apertures?
(resize = no) Resize apertures?
(edit = yes) Edit apertures?
(trace = yes) Trace apertures?
(fittrac= yes) Fit the traced points interactively?
(extract= yes) Extract spectra?
(extras = yes) Extract sky, sigma, etc.?
(review = yes) Review extractions?
(line = 1150) Dispersion line
(nsum = -900) Number of dispersion lines to sum or median
# DEFAULT APERTURE PARAMETERS
(lower = -4.5) Lower aperture limit relative to center
(upper = 4.5) Upper aperture limit relative to center
(apidtab= ) Aperture ID table (optional)
# DEFAULT BACKGROUND PARAMETERS
(b_funct= chebyshev) Background function
(b_order= 3) Background function order
(b_sampl= -20:-7,7:20) Background sample regions
(b_naver= 1) Background average or median
(b_niter= 3) Background rejection iterations
(b_low_r= 4.) Background lower rejection sigma
(b_high_= 4.) Background upper rejection sigma
(b_grow = 2.) Background rejection growing radius
# APERTURE CENTERING PARAMETERS
(width = 10.) Profile centering width
(radius = 10.) Profile centering radius
(thresho= 0.) Detection threshold for profile centering
# AUTOMATIC FINDING AND ORDERING PARAMETERS
nfind = 1 Number of apertures to be found automatically
(minsep = 5.) Minimum separation between spectra
(maxsep = 100.) Maximum separation between spectra
(order = increasing) Order of apertures
# RECENTERING PARAMETERS
(aprecen= ) Apertures for recentering calculation
(npeaks = INDEF) Select brightest peaks
(shift = yes) Use average shift instead of recentering?
# RESIZING PARAMETERS
(llimit = INDEF) Lower aperture limit relative to center
(ulimit = INDEF) Upper aperture limit relative to center
(ylevel = 0.1) Fraction of peak or intensity for automatic width
(peak = yes) Is ylevel a fraction of the peak?
(bkg = yes) Subtract background in automatic width?
(r_grow = 0.) Grow limits by this factor
(avglimi= no) Average limits over all apertures?
# TRACING PARAMETERS
(t_nsum = 50) Number of dispersion lines to sum
(t_step = 50) Tracing step
(t_nlost= 10) Number of consecutive times profile is lost before quitting
(t_funct= legendre) Trace fitting function
(t_order= 3) Trace fitting function order
(t_sampl= *) Trace sample regions
(t_naver= 1) Trace average or median
(t_niter= 0) Trace rejection iterations
(t_low_r= 3.) Trace lower rejection sigma
(t_high_= 3.) Trace upper rejection sigma
(t_grow = 0.) Trace rejection growing radius
# EXTRACTION PARAMETERS
(backgro= fit) Background to subtract
(skybox = 1) Box car smoothing length for sky
(weights= variance) Extraction weights (none|variance)
(pfit = fit2d) Profile fitting type (fit1d|fit2d)
(clean = no) Detect and replace bad pixels?
(saturat= 65000.) Saturation level
(readnoi= 2.75) Read out noise sigma (photons)
(gain = 1.1) Photon gain (photons/data number)
(lsigma = 3.) Lower rejection threshold
(usigma = 3.) Upper rejection threshold
(nsubaps= 1) Number of subapertures per aperture
(mode = ql)
Thanks very much!
Laura
Francisco Valdes wrote on Feb 24, 2010
Hi,
Strong cosmic rays are often worse because the first pass at detecting them is to compare the pixels against a profile. But the profile normalization (total flux) can be so skewed by a CR that it finds the wrong solution to ignoring the CR.
Anyway, my usual recommendation for dealing with strong CRs is to set the saturation parameter to something just above the maximum expected real data value. In other words, all the hope you can give the task to say just ignore any data which is too bright will help significantly.
Frank Valdes
Strong cosmic rays are often worse because the first pass at detecting them is to compare the pixels against a profile. But the profile normalization (total flux) can be so skewed by a CR that it finds the wrong solution to ignoring the CR.
Anyway, my usual recommendation for dealing with strong CRs is to set the saturation parameter to something just above the maximum expected real data value. In other words, all the hope you can give the task to say just ignore any data which is too bright will help significantly.
Frank Valdes
Last post on Feb 24, 2010