This commit is contained in:
Roman Krivonos 2024-11-01 14:56:46 +03:00
parent 2dc9aa6a8d
commit 908e25b200
51 changed files with 338 additions and 432 deletions

View File

@ -34,5 +34,5 @@ This directory contains preprocessed ISGRI detector count rate cleaned from the
### cobe_ibis_resp_lon.dat
This file comes from [Krivonos+ 2007](https://ui.adsabs.harvard.edu/abs/2007A%26A...463..957K/abstract) paper
This file comes from [Krivonos+ 2007](https://ui.adsabs.harvard.edu/abs/2007A%26A...463..957K/abstract) paper, and is used in Figure 1 of the current paper.

View File

@ -98,104 +98,104 @@
-2.99981 -1.584635716374209E-004 4.05677620714671
-1.9998 -1.601728698576348E-004 4.14460425365896
-0.999804 -1.618485992135904E-004 4.20283820107557
7.391063585095475E-005 -1.634896152618052E-004 4.24714842919316
1.00007538246518 -1.650948021933402E-004 4.23521323452837
2.00007685869151 -1.666630726222933E-004 4.19981639323352
3.00007833903195 -1.681933673218127E-004 4.14870274802363
4.00007982322146 -1.696846551414032E-004 4.09098444969177
5.00008131101137 -1.711359324710015E-004 3.99885667540513
6.00008280216830 -1.725462231105744E-004 3.89347299791858
7.00008429647310 -1.739145779075349E-004 3.76462574577249
8.00008579371966 -1.752400743718950E-004 3.63635072815927
9.00008729371401 -1.765218162898285E-004 3.50638304157508
10.0000887962735 -1.777589335948580E-004 3.37145501598623
11.0000903012260 -1.789505817842232E-004 3.24177379875826
12.0000918084088 -1.800959417821170E-004 3.11478207103756
13.0000933176683 -1.811942191922550E-004 2.99374761306871
14.0000948288589 -1.822446444250974E-004 2.87861908304001
15.0000963418429 -1.832464721404567E-004 2.77561053788302
16.0000978564895 -1.841989809262620E-004 2.68308013212301
17.0000993726742 -1.851014728922422E-004 2.60453777524445
18.0001008902786 -1.859532733439200E-004 2.53565104306417
19.0001024091895 -1.867537306728816E-004 2.47233716673087
20.0001039292990 -1.875022156165036E-004 2.41091856457831
21.0001054505034 -1.881981214837714E-004 2.35183597832713
22.0001069727033 -1.888408632217865E-004 2.29505497188558
23.0001084958029 -1.894298775692284E-004 2.23966311949082
24.0001100197099 -1.899646225331532E-004 2.18270405221428
25.0001115443348 -1.904445771997502E-004 2.12658153420184
26.0001130695907 -1.908692410715939E-004 2.06970103422394
27.0001145953933 -1.912381344397690E-004 2.01055711062610
28.0001161216601 -1.915507972881687E-004 1.95086601011597
29.0001176483103 -1.918067894801539E-004 1.89349532821088
30.0001191752645 -1.920056903595918E-004 1.83465529800941
31.0001207024444 -1.921470982763575E-004 1.77267803851111
32.0001222297725 -1.922306305796736E-004 1.70824972704387
33.0001237571719 -1.922559227833552E-004 1.64434312285321
34.0001252845660 -1.922226288049937E-004 1.58380085501745
35.0001268118780 -1.921304202843803E-004 1.52350376647231
36.0001283390309 -1.919789863003307E-004 1.46309418488510
37.0001298659472 -1.917680331569949E-004 1.40282681792836
38.0001313925484 -1.914972839266613E-004 1.34490940128067
39.0001329187551 -1.911664780462734E-004 1.28528094690644
40.0001344444861 -1.907753711016494E-004 1.22954122097706
41.0001359696588 -1.903237342239712E-004 1.17455169070665
42.0001374941884 -1.898113540913749E-004 1.12244635417390
43.0001390179878 -1.892380319898919E-004 1.07219353857889
44.0001405409671 -1.886035840694833E-004 1.02430360841000
45.0001420630336 -1.879078402523141E-004 0.979428719444290
46.0001435840910 -1.871506442657522E-004 0.935356858468708
47.0001451040393 -1.863318530396520E-004 0.894827492395949
48.0001466227743 -1.854513363215080E-004 0.855432838859234
49.0001481401873 -1.845089759862736E-004 0.817676828920911
50.0001496561647 -1.835046660514693E-004 0.781697224403438
51.0001511705870 -1.824383114971961E-004 0.746880450942950
52.0001526833291 -1.813098283567813E-004 0.714481382326025
53.0001541942592 -1.801191429264108E-004 0.683907557802099
54.0001557032385 -1.788661911306080E-004 0.655179352879342
55.0001572101204 -1.775509181874801E-004 0.629516307759393
56.0001587147500 -1.761732780107737E-004 0.605500599333575
57.0001602169637 -1.747332325530905E-004 0.583744119521001
58.0001617165877 -1.732307511904491E-004 0.564742241822184
59.0001632134378 -1.716658101147992E-004 0.547030353536971
60.0001647073187 -1.700383920016535E-004 0.531224684628053
61.0001661980224 -1.683484850463790E-004 0.517929610622562
62.0001676853279 -1.665960823503505E-004 0.507160103381866
63.0001691689998 -1.647811816903592E-004 0.498444379609143
64.0001706487874 -1.629037844165511E-004 0.494034330260365
65.0001721244231 -1.609638950946140E-004 0.492719032342890
66.0001735956217 -1.589615210223331E-004 0.493270940429287
67.0001750620784 -1.568966712897368E-004 0.495773721904444
68.0001765234679 -1.547693564880757E-004 0.500681739849555
69.0001779794421 -1.525795881118784E-004 0.506208278777099
70.0001794296292 -1.503273780500624E-004 0.511988313341823
71.0001808736314 -1.480127383410312E-004 0.518444152681345
72.0001823110226 -1.456356805333828E-004 0.524610710513296
73.0001837413472 -1.431962154441874E-004 0.531530819999874
74.0001851641172 -1.406943534929457E-004 0.541253395874888
75.0001865788098 -1.381301039000888E-004 0.547252179962178
76.0001879848655 -1.355034754089646E-004 0.550328944960229
77.0001893816847 -1.328144763017401E-004 0.548374638305539
78.0001907686254 -1.300631150450550E-004 0.543457647253208
79.0001921449999 -1.272494010247291E-004 0.534844103019597
80.0001935100720 -1.243733454872078E-004 0.525534664790709
81.0001948630535 -1.214349630980337E-004 0.513037455404691
82.0001962031013 -1.184342737515831E-004 0.496574141874924
83.0001975293133 -1.153713045970800E-004 0.477024601855444
84.0001988407258 -1.122460930887494E-004 0.457166893096085
85.0002001363093 -1.090586902617891E-004 0.431005130023210
86.0002014149656 -1.058091646539957E-004 0.403735383331875
87.0002026755239 -1.024976071592920E-004 0.374798473396735
88.0002039167387 -9.912413684496408E-005 0.347173148457788
89.0002051372859 -9.568890728414767E-005 0.319852120748145
90.0002063357613 -9.219211437681474E-005 0.292631801156368
91.0002075106785 -8.863400506449633E-005 0.266228044396145
92.0002086604679 -8.501488724089448E-005 0.240945560706418
93.0002097834773 -8.133514139907735E-005 0.218025197616317
94.0002108779727 -7.759523291160514E-005 0.196663382713245
95.0002119421417 -7.379572672469782E-005 0.178672240628803
96.0002129740982 -6.993730257401385E-005 0.163732183028421
97.0002139718896 -6.602077225506821E-005 0.151594421381940
98.0002149335069 -6.204709821040018E-005 0.140721254721218
99.0002158568978 -5.801741279101933E-005 0.133490005530158
100.000216739984 -5.393303921308732E-005 0.128219990691853
7.391063585095475E-005 -1.634896152618052E-004 4.24714842919316
1.00007538246518 -1.650948021933402E-004 4.23521323452837
2.00007685869151 -1.666630726222933E-004 4.19981639323352
3.00007833903195 -1.681933673218127E-004 4.14870274802363
4.00007982322146 -1.696846551414032E-004 4.09098444969177
5.00008131101137 -1.711359324710015E-004 3.99885667540513
6.00008280216830 -1.725462231105744E-004 3.89347299791858
7.00008429647310 -1.739145779075349E-004 3.76462574577249
8.00008579371966 -1.752400743718950E-004 3.63635072815927
9.00008729371401 -1.765218162898285E-004 3.50638304157508
10.0000887962735 -1.777589335948580E-004 3.37145501598623
11.0000903012260 -1.789505817842232E-004 3.24177379875826
12.0000918084088 -1.800959417821170E-004 3.11478207103756
13.0000933176683 -1.811942191922550E-004 2.99374761306871
14.0000948288589 -1.822446444250974E-004 2.87861908304001
15.0000963418429 -1.832464721404567E-004 2.77561053788302
16.0000978564895 -1.841989809262620E-004 2.68308013212301
17.0000993726742 -1.851014728922422E-004 2.60453777524445
18.0001008902786 -1.859532733439200E-004 2.53565104306417
19.0001024091895 -1.867537306728816E-004 2.47233716673087
20.0001039292990 -1.875022156165036E-004 2.41091856457831
21.0001054505034 -1.881981214837714E-004 2.35183597832713
22.0001069727033 -1.888408632217865E-004 2.29505497188558
23.0001084958029 -1.894298775692284E-004 2.23966311949082
24.0001100197099 -1.899646225331532E-004 2.18270405221428
25.0001115443348 -1.904445771997502E-004 2.12658153420184
26.0001130695907 -1.908692410715939E-004 2.06970103422394
27.0001145953933 -1.912381344397690E-004 2.01055711062610
28.0001161216601 -1.915507972881687E-004 1.95086601011597
29.0001176483103 -1.918067894801539E-004 1.89349532821088
30.0001191752645 -1.920056903595918E-004 1.83465529800941
31.0001207024444 -1.921470982763575E-004 1.77267803851111
32.0001222297725 -1.922306305796736E-004 1.70824972704387
33.0001237571719 -1.922559227833552E-004 1.64434312285321
34.0001252845660 -1.922226288049937E-004 1.58380085501745
35.0001268118780 -1.921304202843803E-004 1.52350376647231
36.0001283390309 -1.919789863003307E-004 1.46309418488510
37.0001298659472 -1.917680331569949E-004 1.40282681792836
38.0001313925484 -1.914972839266613E-004 1.34490940128067
39.0001329187551 -1.911664780462734E-004 1.28528094690644
40.0001344444861 -1.907753711016494E-004 1.22954122097706
41.0001359696588 -1.903237342239712E-004 1.17455169070665
42.0001374941884 -1.898113540913749E-004 1.12244635417390
43.0001390179878 -1.892380319898919E-004 1.07219353857889
44.0001405409671 -1.886035840694833E-004 1.02430360841000
45.0001420630336 -1.879078402523141E-004 0.979428719444290
46.0001435840910 -1.871506442657522E-004 0.935356858468708
47.0001451040393 -1.863318530396520E-004 0.894827492395949
48.0001466227743 -1.854513363215080E-004 0.855432838859234
49.0001481401873 -1.845089759862736E-004 0.817676828920911
50.0001496561647 -1.835046660514693E-004 0.781697224403438
51.0001511705870 -1.824383114971961E-004 0.746880450942950
52.0001526833291 -1.813098283567813E-004 0.714481382326025
53.0001541942592 -1.801191429264108E-004 0.683907557802099
54.0001557032385 -1.788661911306080E-004 0.655179352879342
55.0001572101204 -1.775509181874801E-004 0.629516307759393
56.0001587147500 -1.761732780107737E-004 0.605500599333575
57.0001602169637 -1.747332325530905E-004 0.583744119521001
58.0001617165877 -1.732307511904491E-004 0.564742241822184
59.0001632134378 -1.716658101147992E-004 0.547030353536971
60.0001647073187 -1.700383920016535E-004 0.531224684628053
61.0001661980224 -1.683484850463790E-004 0.517929610622562
62.0001676853279 -1.665960823503505E-004 0.507160103381866
63.0001691689998 -1.647811816903592E-004 0.498444379609143
64.0001706487874 -1.629037844165511E-004 0.494034330260365
65.0001721244231 -1.609638950946140E-004 0.492719032342890
66.0001735956217 -1.589615210223331E-004 0.493270940429287
67.0001750620784 -1.568966712897368E-004 0.495773721904444
68.0001765234679 -1.547693564880757E-004 0.500681739849555
69.0001779794421 -1.525795881118784E-004 0.506208278777099
70.0001794296292 -1.503273780500624E-004 0.511988313341823
71.0001808736314 -1.480127383410312E-004 0.518444152681345
72.0001823110226 -1.456356805333828E-004 0.524610710513296
73.0001837413472 -1.431962154441874E-004 0.531530819999874
74.0001851641172 -1.406943534929457E-004 0.541253395874888
75.0001865788098 -1.381301039000888E-004 0.547252179962178
76.0001879848655 -1.355034754089646E-004 0.550328944960229
77.0001893816847 -1.328144763017401E-004 0.548374638305539
78.0001907686254 -1.300631150450550E-004 0.543457647253208
79.0001921449999 -1.272494010247291E-004 0.534844103019597
80.0001935100720 -1.243733454872078E-004 0.525534664790709
81.0001948630535 -1.214349630980337E-004 0.513037455404691
82.0001962031013 -1.184342737515831E-004 0.496574141874924
83.0001975293133 -1.153713045970800E-004 0.477024601855444
84.0001988407258 -1.122460930887494E-004 0.457166893096085
85.0002001363093 -1.090586902617891E-004 0.431005130023210
86.0002014149656 -1.058091646539957E-004 0.403735383331875
87.0002026755239 -1.024976071592920E-004 0.374798473396735
88.0002039167387 -9.912413684496408E-005 0.347173148457788
89.0002051372859 -9.568890728414767E-005 0.319852120748145
90.0002063357613 -9.219211437681474E-005 0.292631801156368
91.0002075106785 -8.863400506449633E-005 0.266228044396145
92.0002086604679 -8.501488724089448E-005 0.240945560706418
93.0002097834773 -8.133514139907735E-005 0.218025197616317
94.0002108779727 -7.759523291160514E-005 0.196663382713245
95.0002119421417 -7.379572672469782E-005 0.178672240628803
96.0002129740982 -6.993730257401385E-005 0.163732183028421
97.0002139718896 -6.602077225506821E-005 0.151594421381940
98.0002149335069 -6.204709821040018E-005 0.140721254721218
99.0002158568978 -5.801741279101933E-005 0.133490005530158
100.000216739984 -5.393303921308732E-005 0.128219990691853

View File

@ -1,12 +0,0 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model atable{../../data/polarmodel.fits} + powerlaw
0.73486 1 0 0 3 3
2.27115e-09 0.01 0 0 1e+20 1e+24
1.23053 0.01 -3 -2 9 10
0.0103601 0.01 0 0 1e+20 1e+24
bayes off

View File

@ -1,12 +0,0 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model atable{../../data/polarmodel.fits} + powerlaw
0.713934 1 0 0 3 3
2.27522e-09 0.01 0 0 1e+20 1e+24
1.80029 0.01 -3 -2 9 10
0.138919 0.01 0 0 1e+20 1e+24
bayes off

View File

@ -1,10 +0,0 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model atable{../../data/polarmodel.fits}
0.724678 1 0 0 3 3
1.03624e-09 0.01 0 0 1e+20 1e+24
bayes off

View File

@ -1,18 +0,0 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model cflux*bremss + cflux*powerlaw
20 -0.1 0 0 1e+06 1e+06
60 -0.1 0 0 1e+06 1e+06
-9.0642 0.01 -100 -100 100 100
20.3536 1 0.0001 0.0001 100 200
1e-05 -1 0 0 1e+20 1e+24
80 -0.1 0 0 1e+06 1e+06
200 -0.1 0 0 1e+06 1e+06
-11.2811 0.01 -100 -100 100 100
-1.5 -1 -3 -2 9 10
1e-05 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,19 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model cflux*cutoffpl + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.01266 0.01 -100 -100 100 100
0 -1 -3 -2 9 10
11.1866 0.01 0.01 1 500 500
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.31022 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,19 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model cflux*cutoffpl + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.36476 0.01 -100 -100 100 100
0 -1 -3 -2 9 10
11.1662 0.01 0.01 1 500 500
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.75981 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,19 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0
model cflux*cutoffpl + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.36741 0.01 -100 -100 100 100
0 -1 -3 -2 9 10
11.2463 0.01 0.01 1 500 500
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.65316 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,9 @@
data GB.spec.pha
setpl en
cpd /xs
setpl reb 2
systematic 0
setpl reb 3 3
@cutoffpl_gb
pl eeuf delchi

View File

@ -0,0 +1,9 @@
data GB.spec.pha
setpl en
cpd /xs
setpl reb 2
systematic 0
setpl reb 3 3
@polar_gb_cflux
pl eeuf delchi

View File

@ -0,0 +1,8 @@
data L+20.spec.pha
setpl en
cpd /xs
@cutoffpl_l+20
setpl reb 3 3
pl eeuf delchi
#steppar 9 -10 -12 100
#new 9 -10.34

View File

@ -0,0 +1,8 @@
data L+20.spec.pha
setpl en
cpd /xs
@polar_l+20_cflux
setpl reb 3 3
pl eeuf delchi
#steppar 9 -10 -12 100
#new 9 -10.34

View File

@ -0,0 +1,8 @@
data L-20.spec.pha
setpl en
cpd /xs
@cutoffpl_l-20
setpl reb 3 3
pl eeuf delchi
#steppar 9 -10 -12 100
#new 9 -10.34

View File

@ -0,0 +1,8 @@
data L-20.spec.pha
setpl en
cpd /xs
@polar_l-20_cflux
setpl reb 2 2
pl eeuf delchi
#steppar 9 -10 -12 100
#new 9 -10.34

View File

@ -0,0 +1,18 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0.05
model cflux*atable{polarmodel.fits} + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.01521 0.01 -100 -100 100 100
0.657219 0.01 0 0 3 3
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.1965 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,18 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0.05
model cflux*atable{polarmodel.fits} + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.28956 0.01 -100 -100 100 100
0.734431 0.01 0 0 3 3
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.95672 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -0,0 +1,18 @@
method leven 10 0.01
abund angr
xsect vern
cosmo 70 0 0.73
xset delta 0.01
systematic 0.05
model cflux*atable{polarmodel.fits} + cflux*powerlaw
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.25148 0.01 -100 -100 100 100
0.79495 0.01 0 0 3 3
1 -1 0 0 1e+20 1e+24
30 -0.1 0 0 1e+06 1e+06
80 -0.1 0 0 1e+06 1e+06
-9.96087 0.01 -100 -100 100 100
1.55 -1 -3 -2 9 10
1 -1 0 0 1e+20 1e+24
bayes off

View File

@ -3,6 +3,7 @@ All scripts must be ru in ridge/scripts directory
"""
# All directory paths below must be ended by /
modelsdir="../models/"
datadir="../data/"
proddir="../products/"
mapsdir="../products/Maps/"
@ -124,18 +125,10 @@ skyreg={
#'Geminga':{'lon':-164.866,'lat':4.265811,'wlon':10.0,'wlat':10.0},
}
""" Bootstrap settings """
# Number of simulations
nsim=100
# Fraction of data, randomly selected during each simulation
simfrac=10
sigma=3
# template for map
modelrxte="grxe_model/modelrxte_ait_3to20keV_flux_2deg.fits"
modelrxte="grxe/modelrxte_ait_3to20keV_flux_2deg.fits"
# Galactic longitude profile
lon_max=173.0

View File

@ -303,8 +303,7 @@ def get_spec(df, grxe_err_cut=None, skey=None, enkey=None, sigma=3, n_bins = 60,
resid = np.array(df['RESID'])
if(plotme):
print("get_spec: Initial size: {}".format(len(grxe)))
#print(grxe)
#print(grxe_err)
perc = np.percentile(grxe_err, grxe_err_cut, axis=0, keepdims=False)
#print("{} {}: {}% cut of GRXE ERR: {:.2f} mCrab".format(skey,enkey,grxe_err_cut,perc))
@ -417,6 +416,7 @@ def get_spec(df, grxe_err_cut=None, skey=None, enkey=None, sigma=3, n_bins = 60,
ydata = n
(mu, sg) = norm.fit(grxe)
if(plotme==True):
print("Initial Gaiss fit: mu={:.2f} sigma={:.2f}".format(mu,sg))
y_peak = norm.pdf(mu, mu, sg)
@ -443,8 +443,8 @@ def get_spec(df, grxe_err_cut=None, skey=None, enkey=None, sigma=3, n_bins = 60,
#pfit, perr = fit_curvefit(params, xdata, ydata, const_gaussian_ff)
pfit, perr = fit_leastsq(params, xdata, ydata, const_gaussian_ff)
print(pfit)
print(perr)
#print(pfit)
#print(perr)
#pfit, perr = fit_leastsq(params, xdata, ydata, double_gaussian2_ff)
#pfit, perr = fit_curvefit(params, xdata, ydata, double_gaussian_ff)

View File

@ -27,7 +27,7 @@ from ridge.utils import *
from ridge.config import *
#enkey = sys.argv[1]
enkey="E01"
enkey="A01"
inkey="ALL"
fn="detcnts.{}.fits".format(enkey)
@ -63,7 +63,7 @@ print("Total {} ScWs, {:.1f} Ms".format(df_tot.shape[0], np.sum(df_tot['TEXP'])/
# read ignored orbits
with open(proddir+'detcnts.B21.ignored_rev.resid.pkl', 'rb') as fp:
with open(ignored_rev_file, 'rb') as fp:
ignored_rev = pickle.load(fp)
print("{} orbits ignored".format(len(ignored_rev)))
ign=ignored_rev.tolist()

View File

@ -39,7 +39,6 @@ inkey="ALL"
sigma=3
plotme=False
ebands0={
@ -51,7 +50,6 @@ ebands0={
if len(sys.argv) > 1:
skeys = [sys.argv[1]]
#simfrac = int(sys.argv[2])
else:
skeys = list(skyreg.keys())
@ -67,24 +65,13 @@ with open(ignored_rev_file, 'rb') as fp:
print("{} orbits ignored".format(len(ignored_rev)))
ign=ignored_rev.tolist()
for skey in skeys:
if not skey in skyreg.keys():
print("{} not found in {}".format(skey,list(skyreg.keys())))
sys.exit()
# generate array for bootstrap
ebands_sim={}
for enkey in ebands0.keys():
ebands_sim[enkey] = []
for enkey in ebands0.keys():
#bkg_fn="detcnts.{}.BKG.resid.fits".format(enkey,inkey)
#syserr, bkg_sem = get_syserror(proddir+bkg_fn)
fn="detcnts.{}.{}.resid.fits".format(enkey,inkey)
print("Reading {}".format(proddir+fn))
dat = Table.read(proddir+fn, unit_parse_strict='silent')
@ -113,13 +100,6 @@ for skey in skeys:
ebands0[enkey]=[sg_mean,sg_sem]
nsel = int(df.shape[0]*simfrac/100)
for n in range(nsim):
df0=df.sample(nsel)
sg_mean,sg_sem,skew_val,skew_err = get_spec(df0, grxe_err_cut=grxe_err_cut, skey=skey, enkey=enkey)
ebands_sim[enkey].append(sg_mean)
###
fspec="{}{}.dat".format(fluxdir,skey)
with open(fspec, 'w') as fp:
for enkey in ebands0.keys():
@ -129,33 +109,6 @@ for skey in skeys:
fp.write("{} {} {} {:.6f} {:.6f}\n".format(skey,enkey,bands[enkey],flux,err))
###
fspec="{}{}.sim{:02d}.dat".format(fluxdir,skey,simfrac)
with open(fspec, 'w') as fp:
for enkey in ebands_sim.keys():
data=ebands_sim[enkey]
(mu, sg) = norm.fit(data)
fp.write("{:02d} {} {} {} {:.6f} {:.6f}\n".format(simfrac,skey,enkey,bands[enkey],mu,sg))
print("[BOOT] {}: {} {:.6f} {:.6f}".format(skey,enkey,mu,sg))
if(plotme):
n, bins, patches = plt.hist(data, 60, density=True, facecolor='green', alpha=0.75)
# add a 'best fit' line
y = norm.pdf(bins, mu, sg)
l = plt.plot(bins, y, 'r--', linewidth=2)
#plot
plt.axvline(mu, color="black")
plt.axvline(ebands0[enkey][0], color="black", linestyle="dashed")
#plt.axvline(mu+sg_sem, color="black", linestyle="dashed")
#plt.axvline(mu-sg_sem, color="black", linestyle="dashed")
plt.axvline(mu+sg, color="blue", linestyle="dashed")
plt.axvline(mu-sg, color="blue", linestyle="dashed")
plt.xlabel('Flux, mCrab')
plt.ylabel('Probability')
plt.title("[BOOT] {}: {:.2f} {:.2f}".format(enkey, mu, sg))
plt.grid(True)
plt.show()

View File

@ -113,14 +113,6 @@ for i in range(lon_nbin):
nsel = int(df0.shape[0]*simfrac/100)
print("lon {:.2f} ".format(glon[i]),"nsel=",nsel,df0.shape[0])
"""
for n in range(nsim):
df1=df0.sample(nsel)
sg_mean1,sg_sem1,skew_val,skew_err = get_spec(df1, grxe_err_cut=grxe_err_cut, enkey=enkey, nscw_min=nscw_min)
mean_sim[dkey].append(sg_mean1)
"""
#print('sg_sem',sg_sem)
mean_map[i] = sg_mean
sem_map[i] = sg_sem
@ -130,7 +122,7 @@ for i in range(lon_nbin):
lon_arr.append(row['LON'])
lat_arr.append(row['LAT'])
#sys.exit()
if not os.path.exists(profdir):

View File

@ -1,4 +1,3 @@
./03_grxe_galprof.py E01 21
./03_grxe_galprof.py E13 21
./03_grxe_galprof.py E14 21
./03_grxe_galprof.py A01 21
./03_grxe_galprof.py A02 21
./03_grxe_galprof.py A03 21

View File

@ -6,7 +6,7 @@ __copyright__ = "Space Research Institute (IKI)"
from astropy.table import Table, Column
from matplotlib import ticker
import matplotlib.pyplot as plt
import sys
import sys, os
from ridge.utils import *
from ridge.config import *
@ -14,15 +14,15 @@ from ridge.config import *
scale = 100.0
fn="detcnts.E01.ALL.resid.galprof.fits"
fn="detcnts.A01.ALL.resid.galprof.fits"
dat = Table.read(profdir+fn, unit_parse_strict='silent')
df1 = dat.to_pandas().sort_values(by=['LON1'])
fn="detcnts.E14.ALL.resid.galprof.fits"
fn="detcnts.A02.ALL.resid.galprof.fits"
dat = Table.read(profdir+fn, unit_parse_strict='silent')
df2 = dat.to_pandas().sort_values(by=['LON1'])
fn="detcnts.E13.ALL.resid.galprof.fits"
fn="detcnts.A03.ALL.resid.galprof.fits"
dat = Table.read(profdir+fn, unit_parse_strict='silent')
df3 = dat.to_pandas().sort_values(by=['LON1'])
@ -96,5 +96,10 @@ ax2.set_ylabel('GRXE flux, x100 mCrab',fontsize=14, fontweight='normal')
#plt.xscale('linear')
#plt.yscale('linear')
plt.savefig(profdir+'galprof.png', bbox_inches='tight')
if not os.path.exists(figdir):
os.makedirs(figdir)
filename=figdir+'galprof.png'
plt.savefig(filename, bbox_inches='tight')
plt.close(fig)
print("Result is saved as {}".format(filename))

View File

@ -64,7 +64,7 @@ with open(ignored_rev_file, 'rb') as fp:
ign=ignored_rev.tolist()
hdulist = fits.open(datadir+modelrxte)
hdulist = fits.open(modelsdir+modelrxte)
w = wcs.WCS(hdulist[0].header)
smap =hdulist[0].data
@ -72,7 +72,7 @@ sx=int(hdulist[0].header['NAXIS1'])
sy=int(hdulist[0].header['NAXIS2'])
# fill AITOF map indexes
# Already done in 02_grxe_resid.py
# -- Already done in 02_grxe_resid.py
"""
ds9x=[]
ds9y=[]
@ -136,23 +136,8 @@ for i in range(sx):
if (df0.shape[0] < nscw_min):
continue
#print("*** *** REV *** ***")
#print(df0["REV"])
# check coordinates
#print("***",i+1,j+1,lon,lat,smap[j][i])
#for i0,row0 in df0.iterrows():
# print(row0['LON'],row0['LAT'],row0['GRXE'])
sg_mean,sg_sem = get_spec(df0, sigma=sigma, grxe_err_cut=grxe_err_cut, enkey=enkey, nscw_min=nscw_min)
nsel = int(df0.shape[0]*simfrac/100)
#print("nsel=",nsel,df0.shape[0])
for n in range(nsim):
df1=df0.sample(nsel)
sg_mean1,sg_sem1 = get_spec(df1, grxe_err_cut=grxe_err_cut, enkey=enkey, nscw_min=nscw_min)
mean_sim[dkey].append(sg_mean1)
sg_mean,sg_sem,skew_val,skew_err = get_spec(df0, sigma=4, grxe_err_cut=grxe_err_cut, enkey=enkey, plotme=False, bootstrap=False, gaussfit=True)
#print('sg_sem',sg_sem)
@ -161,19 +146,9 @@ for i in range(sx):
sign_map[j][i] = sg_mean/sg_sem
cnt_map[j][i] = df0.shape[0]
"""
obsid_map[dkey] = obsid
grxe_map[dkey] = grxe
grxe_err_map[dkey] = grxe_err
"""
""" Filter by error map """
# Calculate the percentiles across the x and y dimension
perc = np.percentile(sem_map, sem_cut, axis=(0, 1), keepdims=False)
print("{} {}: {}% cut of SEM map: {:.2f} mCrab".format(key,enkey,sem_cut,perc))
@ -184,10 +159,6 @@ sem_map[idx]=0.0
cnt_map[idx]=0
sign_map[idx]=0.0
#mean_sim_map[idx]=0.0
#error_sim_map[idx]=0.0
if not os.path.exists(mapsdir):
os.makedirs(mapsdir)
@ -203,76 +174,8 @@ hdulist.writeto(mapsdir+fn.replace(".fits",".cnt.fits"),overwrite=True)
hdulist[0].data=sign_map
hdulist.writeto(mapsdir+fn.replace(".fits",".sign.fits"),overwrite=True)
print("saving simulations")
for i in range(sx):
for j in range(sy):
dkey="{:04d}{:04d}".format(j,i)
data=mean_sim[dkey]
#print("{} size {}".format(dkey,len(data)))
if(len(data)>10):
(mu, sg) = norm.fit(data)
mean_sim_map[j][i] = mu
error_sim_map[j][i] = sg
perc = np.percentile(error_sim_map, sem_cut, axis=(0, 1), keepdims=False)
print("{} {}: {}% cut of SEM map: {:.2f} mCrab".format(key,enkey,sem_cut,perc))
idx=np.where(error_sim_map > perc)
print("index size {}".format(len(idx)))
mean_sim_map[idx]=0.0
error_sim_map[idx]=0.0
hdulist[0].data=mean_sim_map
hdulist.writeto(mapsdir+fn.replace(".fits",".sim.mean.fits"),overwrite=True)
hdulist[0].data=error_sim_map
hdulist.writeto(mapsdir+fn.replace(".fits",".sim.error.fits"),overwrite=True)
sys.exit()
print("Prepare data for fine map")
obsid_list=[]
grxe_list=[]
grxe_err_list=[]
for i in range(sx):
for j in range(sy):
""" Use mask """
if not (cnt_map[j][i]>0):
continue
world = w.wcs_pix2world([(i+1,j+1)], 1)
lon = world[0][0]
lat = world[0][1]
if(np.isnan(lon) or np.isnan(lat)):
continue
ds9i=i+1
ds9j=j+1
df0 = df.query('DS9X == {} & DS9Y == {}'.format(ds9i,ds9j))
if (len(df0) <= nscw_min):
continue
dkey="{:04d}{:04d}".format(j,i)
for scw in obsid_map[dkey]:
obsid_list.append(scw.decode("UTF-8"))
for grxe in grxe_map[dkey]:
grxe_list.append(grxe)
for grxe in grxe_err_map[dkey]:
grxe_err_list.append(grxe)
coldefs = fits.ColDefs([
fits.Column(name='OBSID', format='11A', array=obsid_list),
])
fout = fn.replace(".fits",".grxe.fits")
hdu = fits.BinTableHDU.from_columns(coldefs, name='GRXE')
hdu.header['MISSION'] = ('INTEGRAL', '')
#hdu.header['TELESCOP'] = (outkey, '')
hdu.header['INSTITUT'] = ('IKI', 'Affiliation')
hdu.header['AUTHOR'] = ('Roman Krivonos', 'Responsible person')
hdu.header['EMAIL'] = ('krivonos@cosmos.ru', 'E-mail')
#hdu.add_checksum()
print(hdu.columns)
hdu.writeto(proddir+fout, overwrite=True)
with fits.open(proddir+fout, mode='update') as hdus:
hdus[1].add_checksum()

View File

@ -1,37 +1,10 @@
./03_grxe_map.py E01
#./03_grxe_map.py E02
#./03_grxe_map.py E03
#./03_grxe_map.py E04
#./03_grxe_map.py E05
#./03_grxe_map.py E06
#./03_grxe_map.py E07
#./03_grxe_map.py E08
#./03_grxe_map.py E09
#./03_grxe_map.py E10
./03_grxe_map.py E13
./03_grxe_map.py E14
for band in A01 A02 A03
do
./03_grxe_map.py $band
done
./03_grxe_map.py B01
./03_grxe_map.py B02
./03_grxe_map.py B03
./03_grxe_map.py B04
./03_grxe_map.py B05
./03_grxe_map.py B06
./03_grxe_map.py B07
./03_grxe_map.py B08
./03_grxe_map.py B09
./03_grxe_map.py B10
./03_grxe_map.py B11
./03_grxe_map.py B12
./03_grxe_map.py B13
./03_grxe_map.py B14
./03_grxe_map.py B15
./03_grxe_map.py B16
./03_grxe_map.py B17
./03_grxe_map.py B18
./03_grxe_map.py B19
./03_grxe_map.py B20
./03_grxe_map.py B21
# if somebody needs maps in narrow nands:
#for band in B01 B02 B03 B04 B05 B06 B07 B08 B09 B10 B11 B12 B13 B14 B15 B16 B17 B18 B19 B20 B21
#do
#./03_grxe_map.py $band
#done

View File

@ -38,7 +38,7 @@ from ridge.config import *
inkey="ALL"
sigma=3
plotme=False
"""
@ -117,11 +117,15 @@ else:
if not os.path.exists(specdir):
os.makedirs(specdir)
fitsdir = "{}fits/".format(specdir)
if not os.path.exists(fitsdir):
os.makedirs(fitsdir)
with open(ignored_rev_file, 'rb') as fp:
ignored_rev = pickle.load(fp)
print(ignored_rev)
print("{} orbits ignored".format(len(ignored_rev)))
#sys.exit()
ign=ignored_rev.tolist()
@ -131,14 +135,7 @@ for skey in skeys:
print("{} not found in {}".format(skey,list(skyreg.keys())))
sys.exit()
# generate array for bootstrap
ebands_sim={}
for enkey in ebands0.keys():
ebands_sim[enkey] = []
for enkey in ebands0.keys():
#bkg_fn="detcnts.{}.BKG.resid.fits".format(enkey,inkey)
#syserr, bkg_sem = get_syserror(proddir+bkg_fn)
fn="detcnts.{}.{}.resid.fits".format(enkey,inkey)
#d1 = fits.getdata(proddir+fn)
@ -163,7 +160,7 @@ for skey in skeys:
skyreg[skey]['lat'] - skyreg[skey]['wlat']/2,
skyreg[skey]['lat'] + skyreg[skey]['wlat']/2)
#sys.exit()
df = df.query(query)
print("{}, {}: {} N={}".format(skey, enkey, query, df.shape[0]))
@ -178,22 +175,12 @@ for skey in skeys:
if not (df.shape[0]>0):
continue
#plt.scatter(df['LON'],df['LAT'])
#plt.show()
#print("*** {} {} Data Frame size {} ***".format(skey, enkey, df.size))
sg_mean,sg_sem,skew_val,skew_err = get_spec(df, sigma=3, grxe_err_cut=grxe_err_cut, skey=skey, enkey=enkey, plotme=True, bootstrap=False, gaussfit=True)
sg_mean,sg_sem,skew_val,skew_err = get_spec(df, sigma=3, grxe_err_cut=grxe_err_cut, skey=skey, enkey=enkey, plotme=False, bootstrap=False, gaussfit=True)
ebands0[enkey]=[sg_mean,sg_sem]
skew0[enkey]=[skew_val,skew_err]
nsel = int(df.shape[0]*simfrac/100)
for n in range(nsim):
df0=df.sample(nsel)
#sg_mean,sg_sem = get_spec(df0, grxe_err_cut=grxe_err_cut, skey=skey, enkey=enkey)
#ebands_sim[enkey].append(sg_mean)
#ebands_sim[enkey][1].append(sg_sem)
###
fspec="{}{}.spec".format(specdir,skey)
with open(fspec, 'w') as fp:
for enkey in ebands0.keys():
@ -203,8 +190,6 @@ for skey in skeys:
fp.write("0 {} {:.6f} {:.6f} 0.0\n".format(bands[enkey],flux,err))
subprocess.run(["perl", "do_pha_igr_v3_mCrab.pl", fspec])
###
fspec="{}{}.skew".format(specdir,skey)
with open(fspec, 'w') as fp:
fp.write("read serr 4\n")
@ -213,37 +198,6 @@ for skey in skeys:
fp.write("{} {} {:.6f} {:.6f}\n".format(count,bands[enkey],skew0[enkey][0],skew0[enkey][1]))
count+=1
fspec="{}{}.sim.spec".format(specdir,skey)
with open(fspec, 'w') as fp:
for enkey in ebands_sim.keys():
data=ebands_sim[enkey]
(mu, sg) = norm.fit(data)
fp.write("0 {} {:.6f} {:.6f} 0.0\n".format(bands[enkey],mu,sg))
print("[BOOT] {}: {} {:.6f} {:.6f}".format(skey,enkey,mu,sg))
if(plotme):
n, bins, patches = plt.hist(data, 60, density=True, facecolor='green', alpha=0.75)
# add a 'best fit' line
y = norm.pdf(bins, mu, sg)
l = plt.plot(bins, y, 'r--', linewidth=2)
#plot
plt.axvline(mu, color="black")
plt.axvline(ebands0[enkey][0], color="black", linestyle="dashed")
#plt.axvline(mu+sg_sem, color="black", linestyle="dashed")
#plt.axvline(mu-sg_sem, color="black", linestyle="dashed")
plt.axvline(mu+sg, color="blue", linestyle="dashed")
plt.axvline(mu-sg, color="blue", linestyle="dashed")
plt.xlabel('Flux, mCrab')
plt.ylabel('Probability')
plt.title("[BOOT] {}: {:.2f} {:.2f}".format(enkey, mu, sg))
plt.grid(True)
plt.show()
subprocess.run(["perl", "do_pha_igr_v3_mCrab.pl", fspec])
try:
for remfile in ["cols","cols1","cols2","header",]:
os.remove(remfile)

View File

@ -20,7 +20,7 @@ Plot long-term Crab detector count rate approximated by cubic polynomial functio
### 01_crabmodel_plot_sys.py
Plots the normalized distribution of the residuals between the IBIS/ISGRI Crab count rate and the corresponding polynomial fit (Fig. B8 in paper). The distribution is approximated with a Gaussian function.
Plots the normalized distribution of the residuals between the IBIS/ISGRI Crab count rate and the corresponding polynomial fit (Fig. B8 in the paper). The distribution is approximated with a Gaussian function.
### 02_grxe_resid.py
@ -28,21 +28,46 @@ Calculates difference between detector count rate and that predicted by backgrou
### 02_grxe_resid_plot.py
Plots normalized distribution of the relative residuals of the background model obtained in three energy bands for BKG region (Figs. A5 and A6 in paper).
Plots normalized distribution of the relative residuals of the background model obtained in three energy bands for BKG region (Figs. A5 and A6 in the paper).
### 02_grxe_map.py
Makes the map of the residuals in mCrab units (not covered in the paper).
Makes the map of the residuals in mCrab units (not shown in the paper).
### 03_grxe_flux.py
Estimates flux in regions defined in config.py, and places result in products/Flux, e.g.:
```
cat ../products/Flux/GB.dat
GB A01 25.00 60.00 154.886019 3.087652
GB A02 60.00 80.00 96.472798 9.218161
GB A03 80.00 200.00 102.207302 13.291950
```
wgere GB means Galactic Bulge region (see Table 1 in the paper).
### 03_grxe_galprof.py/03_grxe_galprof.sh and 03_grxe_galprof_plot.py
Makes Galactic longitude profile and plots it.
### 03_grxe_spec.py
Extract spectrum of selected sky region, e.g.:
```./03_grxe_spec.py GC``` or ```./03_grxe_spec.py M81```
```./03_grxe_spec.py GB``` or ```./03_grxe_spec.py L+20```
If you do not specify the sky region, the script makes spectra for all regions.
Sky regions are defined in ```config.py```.
Spectra are stored in `./products/Spec`. After spectra files are ready, go to directory `./products/Spec` and run ```perl ../../scripts/do_pha_igr_v3_mCrab.pl M81.spec```.
Spectra are stored in `../products/Spectra`.
To load the spectrum, e.g. Galactic Bulge, do the following steps:
```
cd ../products/Spectra
cp ../../models/xspec/* .
xspec
@load_gb_cutoffpl.xcm
fit
```