-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrect-proton.sh
executable file
·112 lines (75 loc) · 4.05 KB
/
correct-proton.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
######################################################################
# do the calculations required for soft-proton contamination
# correction
dir=$1
here=`pwd`
cd $dir
analysis_id=$ANALYSIS_ID
# FIXME: what is passed is potentially a list - should loop through files
M1_EV_PREFIX=$M1_EV_PREFIX_LIST
M2_EV_PREFIX=$M2_EV_PREFIX_LIST
PN_EV_PREFIX=$PN_EV_PREFIX_LIST
######################################################################
# Snowden & Kuntz, 2011:
# proton-scale finds the solid angle for the region to include in the
# spectral fitting. The solid angle which is in units of square arc
# minutes is added as a constant in the spectral model. This scales
# the fitted parameters to per square arc minutes, which is also the
# units for the ROSAT data.
proton_scale caldb=${esas_caldb} mode=1 detector=1 maskfile=mos${M1_EV_PREFIX}-sp-${analysis_id}.fits specfile=mos${M1_EV_PREFIX}-obj-${analysis_id}.pi
proton_scale caldb=${esas_caldb} mode=1 detector=2 maskfile=mos${M2_EV_PREFIX}-sp-${analysis_id}.fits specfile=mos${M2_EV_PREFIX}-obj-${analysis_id}.pi
proton_scale caldb=${esas_caldb} mode=1 detector=3 maskfile=pn${PN_EV_PREFIX}-sp-${analysis_id}.fits specfile=pn${PN_EV_PREFIX}-obj-os-${analysis_id}.pi
######################################################################
# Snowden & Kuntz, 2011:
# proton uses the fitted soft proton parameters to create images of
# the soft proton contamination in detector coordinates.
######################################################################
# m1
ccd1=$M1_CCD1
ccd2=$M1_CCD2
ccd3=$M1_CCD3
ccd4=$M1_CCD4
ccd5=$M1_CCD5
ccd6=$M1_CCD6
ccd7=$M1_CCD7
proton prefix=${M1_EV_PREFIX} caldb=${esas_caldb} ccd1=$ccd1 ccd2=$ccd2 ccd3=$ccd3 ccd4=$ccd4 ccd5=$ccd5 ccd6=$ccd6 ccd7=$ccd7 elow=400 ehigh=1250 spectrumcontrol=1 pindex=0.972080 pnorm=0.131099
proton prefix=${M1_EV_PREFIX} caldb=${esas_caldb} ccd1=$ccd1 ccd2=$ccd2 ccd3=$ccd3 ccd4=$ccd4 ccd5=$ccd5 ccd6=$ccd6 ccd7=$ccd7 elow=2000 ehigh=7200 spectrumcontrol=1 pindex=0.972080 pnorm=0.131099
######################################################################
# m2
ccd1=$M2_CCD1
ccd2=$M2_CCD2
ccd3=$M2_CCD3
ccd4=$M2_CCD4
ccd5=$M2_CCD5
ccd6=$M2_CCD6
ccd7=$M2_CCD7
proton prefix=${M2_EV_PREFIX} caldb=${esas_caldb} ccd1=$ccd1 ccd2=$ccd2 ccd3=$ccd3 ccd4=$ccd4 ccd5=$ccd5 ccd6=$ccd6 ccd7=$ccd7 elow=400 ehigh=1250 spectrumcontrol=1 pindex=0.972080 pnorm=0.128477
proton prefix=${M2_EV_PREFIX} caldb=${esas_caldb} ccd1=$ccd1 ccd2=$ccd2 ccd3=$ccd3 ccd4=$ccd4 ccd5=$ccd5 ccd6=$ccd6 ccd7=$ccd7 elow=2000 ehigh=7200 spectrumcontrol=1 pindex=0.972080 pnorm=0.128477
######################################################################
# pn
quad1=$PN_QUAD1
quad2=$PN_QUAD2
quad3=$PN_QUAD3
quad4=$PN_QUAD4
proton prefix=${PN_EV_PREFIX} caldb=${esas_caldb} ccd1=$quad1 ccd2=$quad2 ccd3=$quad3 ccd4=$quad4 elow=400 ehigh=1250 spectrumcontrol=1 pindex=1.53003 pnorm=0.361532
proton prefix=${PN_EV_PREFIX} caldb=${esas_caldb} ccd1=$quad1 ccd2=$quad2 ccd3=$quad3 ccd4=$quad4 elow=2000 ehigh=7200 spectrumcontrol=1 pindex=1.53003 pnorm=0.361532
######################################################################
# Snowden & Kuntz, 2011:
# rot-im-det-sky uses information in a previously created count image
# in sky coordinates to rotate the detector coordinate background
# images into images in sky coordinates.
elow='400' # detection bands minima [eV]
ehigh='1250' # detection bands maxima [eV]
rot-im-det-sky prefix=${M1_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
rot-im-det-sky prefix=${M2_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
rot-im-det-sky prefix=${PN_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
elow='2000' # detection bands minima [eV]
ehigh='7200' # detection bands maxima [eV]
rot-im-det-sky prefix=${M1_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
rot-im-det-sky prefix=${M2_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
rot-im-det-sky prefix=${PN_EV_PREFIX} mask=0 elow=$elow ehigh=$ehigh mode=2
######################################################################
# exit
cd $here
echo -e "\n$0 in $obsid done!"
exit 0