Anomalous CCD Check




Last Updated:2023/05/17


Source: MCXC J0106.8+0103
Observation ID: 0762870601
SAS Version: 19.0.0
Python version: 3
csh is used

In this chapter, I am going to show you how to determine whether a ccd chip is anomalous. Everything you need is the file from the previous chapter,
filter_sp.zip
.

Remember right after running mos-filter, you get a file called command.csh, which contains anomalous ccd chip information. I renamed it to esas_products/mosproblemccd.txt. Open it and you see the following:

cat mosproblemccd.txt


# Limit=1.0 CCD=2 Hardness=4.472 Uncertainty=0.825
# Limit=1.0 CCD=3 Hardness=0.000 Uncertainty=0.000 ****
# Limit=3.4 CCD=4 Hardness=2.625 Uncertainty=0.630 ####
# Limit=3 CCD=5 Hardness=4.957 Uncertainty=0.801
# Limit=1.0 CCD=6 Hardness=0.000 Uncertainty=0.000 ****
# Limit=1.0 CCD=7 Hardness=6.846 Uncertainty=1.437
# Limit=1.0 CCD=2 Hardness=3.295 Uncertainty=0.482
# Limit=1.0 CCD=3 Hardness=4.182 Uncertainty=0.810
# Limit=1.0 CCD=4 Hardness=4.795 Uncertainty=0.844
# Limit=3.5 CCD=5 Hardness=0.784 Uncertainty=0.073 ####
# Limit=1.0 CCD=6 Hardness=5.708 Uncertainty=1.263
# Limit=1.0 CCD=7 Hardness=4.267 Uncertainty=0.707


This is the hardness ratio ([2.5-5.0]/[0.5-0.8]) of the lightcuves of mos1 and mos2. If the ratio is too low that means ccd chip anomalies are detected and that ccd chip has to be excluded in subsequent analysis. In this example, mos1 ccd4 and mos2 ccd5 are anomalous. mos1 ccd3 and ccd6 are missing. We will check further to confirm ccd anomalies.

To reproduce the above file, in src/filter_sp_script.py:

a.problemccdcheck() #parameters omitted


Choose the ccd you want(mos1S001 or mos2S002), and you see the following on the screen, a file called mos2S002_problemccd.txt is also written:

mos2S002
ccd  || total            || total           || hardness
chip || events(LE) || events(HE) || ratio
=============================================
2 61 201 3.3
3 33 138 4.18
4 39 187 4.79
5 264 207 0.784
6 24 137 5.71
7 45 192 4.27


The input file for this is mos1S001-corn.fits, the event list which contains corner events only, extracted from mos1S001-clean.fits. The corner events do not have anything from the FOV and reflect intrinsic anormalies of the ccd chips. If a ccd chip(1st column) is normal, the [counts in the high energy range (2nd column)]/([counts in the low energy range (3rd column)] should have a certain ratio (4th column). If it is too low, that means the ccd chip exhibits higher-than-usual counts in the low energy range and has to be discarded for further analysis. We will see this issue again in
FOV spectrum and image
.

The program extracts two event lists for ccd chip 2-7, one in [0.5 – 0.8] keV and the other [2.5 – 5.0] keV. The hardness ratio is the ratio of the number of events in the lists. The product names produced by the script are mos2S002_Xccd_0.5_0.8.fits and mos2S002_Xccd_0.5_0.8.fits, X stands for the ccd chip number.

Now let's extract ccd chip 7 of mos2S002 manually. For the following, just change CCDNR, PI, and filteredset for a different ccd, energy range and filtered event list name, respectively.

evselect table=mos2S002-corn.fits withfilteredset=yes expression=' (PATTERN<=12)&&((FLAG & 0x766a0763) == 0)&& (CCDNR==7) && (PI in [2500:5000]) ' filtertype=expression filteredset=mos2S002_7ccd_2.5_5.0.fits


evselect table=mos2S002-corn.fits withfilteredset=yes expression=' (PATTERN<=12)&&((FLAG & 0x766a0763) == 0)&& (CCDNR==7) && (PI in [500:800]) ' filtertype=expression filteredset=mos2S002_7ccd_0.5_0.8.fits

Now open the two newly produced files and check for the number of events (i.e. number of rows) for the extension EVENTS:

fv mos2S002_7ccd_0.5_0.8.fits &
fv mos2S002_7ccd_2.5_5.0.fits &


For the low energy file, it has 45 rows while the high energy one has 192 rows, so the hardness ratio is 192/45 = 4.27 for mos2 ccd7. If you check esas_products/mosproblemccd.txt, you find the same value. A ccd chip with a low hardness ratio means it has higher-than-usual counts in the low energy range. You can see this both in the spectrum and also image. Now let's take a look at the image:

In src/sp_filter_script.py, you do the following to extract the corner images in both energy ranges:

a.CornImage() #parameters omitted


The files produced are mos2S002-corn-image-0.5-0.8.fits and mos2S002-corn-image-2.5-5.0.fits. Here are how they look:





Fig.1 Top panel: mos2S002-corn-image-0.5-0.8.fits. Bottom panel: mos2S002-corn-image-2.5-5.0.fits. Top left is chip 5.


You see for mos2S002-corn-image-0.5-0.8.fits,chip 5 (top left) obviously have higher counts than other ccd chips but not mos2S002-corn-image-2.5-5.0.fits.

mos1 corner images:





Fig.2 Top panel: mos1S001-corn-image-0.5-0.8.fits. Bottom panel: mos1S001-corn-image-2.5-5.0.fits. Top right is chip 4.


Here for mos1S001-corn-image-0.5-0.8.fits, chip 4 (top right) does not show higher counts than other ccd chips. I will keep it.

Finally, we need to extract the result and write it to InputFiles/goodccdlist_mos1(mos2).txt, which will be used in
FOV spectrum and image
.

Now in src/sp_filter_script.py, you do:

a.write_ccd_anol("mosproblemccd.txt")


This rewrites the result from mosproblemccd.txt to InputFiles/goodccdlist_mos1(mos2).txt. The text files are shown in the terminal if they are produced successfully. For good ccd chips, I set the value = 1, otherwise 0. I manually set mos1 ccd4 as 1. These two text files would be used for mos-spectra (the command for spectrum production). Note that mosproblemccd.txt may be different for different SAS versions, and you may need to modify the code.