Tip:
Highlight text to annotate it
X
Hello everyone! In this tutorial we are going to remove the cosmic rays from our 2D spectra
using the neat task LACOSMIC made by Pieter Van Dokkum at Yale
In the description of this video you will the link to the installation of this task,
which makes use of the STSDAS and TABLES packages from the Space Telescope Science Institute
So in this tutorial we shall focus on how it works
As you know cosmic rays are high energy particles, mostly protons, which travel all around the galaxy
just to end up in your astronomical recordings.
If you are analyzing objects which need great exposition times, these can be a real problem...
Let me show you one of my spectra...
Here you have it...
This is the emission of a HII galaxy seriously contaminated by cosmic rays.
This can be solved by combining consecutive recordings of the same object
but this is a luxury we don't always have...
So we need to make use of image processing algorithms....
For example, the LACOSMIC task
We go to our IRAF terminal and we use this command
The LACOSMIC task makes use of a Laplacian edge detection algorithm to define regions of great contrast.
These regions correspond to the pixels affected by cosmic rays
which have a greater pixel intensity than the average object you will be analyzing
By adjusting these parameters, the gain, the readnoise and the sigma for the detection limit we define the strength of the algorithm.
By adjusting these parameters, the gain, the readnoise and the sigma for the detection limit we define the strength of the algorithm.
By adjusting these parameters, the gain, the readnoise and the sigma for the detection limit we define the strength of the algorithm.
Myself I just leave the former, the gain and the read noise constant, and I play around with the sigma
Smaller values mean a more strict threshold: more and weaker cosmic rays will be removed
Bigger values, for sigma, mean a more loose removal: only the most intense cosmic rays will be cleaned.
Ideally, you want to remove all the cosmic rays and so, set a low value for sigma...
However, doing this there is the risk the task will modify the sky pixels and scientific data...
Such as the continuum in your spectra
As you will see, we must check the resulting image after each application until you find the right configuration for your data
Finally, you need to set the input frame name, the output frame name...
And a name for the pixel mask, which the code will automatically generate
Ok let's run it
Now this task may take some time. It will run the algorithm 4 times.
At the end of each loop it will tell you how many cosmic rays it has removed....
Here you have it... 5621 cosmic rays
By the way, in my experience, in the right configuration for this task, each loop will have less and less cosmic rays removed
even none at the last one...
If it removes the same amount after each loop, it means it has found something else to removed...
That's not a good sign...
It has removed 1078.... and the 3rd iteration starts...
Now just 93...
... and the fourth loop and final starts...
There you have it... just 13 cosmic rays in the final iteration... very good!
Let's take a look at these images: The one before, after and the cosmic ray mask
Ok, a trick to look at these images:
We go to "Frame ->Lock->Frame->Image"
And now we go to "Frame->Blink"
And now we can move freely along these 3 images simultaneously
Ok at this point we must go to one of the edges of the image
and make sure that our scientific data has not been affected by the algorithm
Here you can see that this cosmic ray is very close to our emision line...
We must make sure the LACOSMIC task has only removed the cosmic ray...
To do that you must confirmed the intensity values after and before. The are displayed by DS9
We can see that in the original image the pixel intensity value was around 5000...
Which is considerably above any hidrogen line in my spectra
While the intensity value after the application of the LACOSMIC task is around 500
So we can assume it is fine...
We continue checking...
Ok... it seems perfect...
Now you must evaluate you next step...
If you think you affected your scientific data you need to increase the sigma and run the task again
If on the contrary, you still have some hot pixels, you can reduce the sigma
Myself, I would be happy with this result
This is all I wanted to show you today
Remember to reference the work of Pieter van Dokkum if you use this task.
As for my part, thank you very much for watching and see you soon!