Try   HackMD

NICER 望遠鏡のX線データ解析

最終更新 2022-06-03

NICER を中心に時間変動天体のX線データ解析に興味がある人向けのメモです。有用なリンクや情報へのポインタとしてお使い下さい。M1 レベルを想定しています。

セミナー動画

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
準備 (X線データ解析の一般的な知識)

  1. HEASoftはインストールされているとする。Heasoft installing guideも参照。CALDB は最新のものにする。
  2. X線の解析の基本は、すざくファーストステップガイドなどと共通している。衛星特有でない、FITSファイルの内容、X線衛星でのファイルの種類、xselectやds9の使い方、 時間解析, などを参照するとよい。
  3. X線スペクトル解析の入門は、XspecによるX線スペクトル解析などにまとめた。画面で説明した録画がYouTubeにある。立教大学の山田真也さんの「初めての宇宙X線スペクトル解析ツールxspecの使い方」もわかりやすい。
  4. 突発天体のX線データ解析は、志達めぐみさんの「X線観測とデータ取得の方法 (主に突発天体向け)」(pdf)にいろいろな衛星の実例があって、一読をおすすめする。
  5. 実験データの統計解析 博士過程のときに修士の学生さん向けに作った Xspec でのフィットのためのメモ。
  6. X線天文学でのレスポンス(response)とは何かを知りたい場合。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
NICER X線望遠鏡のデータ解析

公式 標準的な解析の手順

まず公式の情報は NICER Data Analysis のページに載っている。

  1. 他の衛星データの解析と同様に、HEASoft が使える環境を用意し、NICER の calibration file 一式を所定の場所に置く。NICER の解析環境のセットアップは Setting Up a NICER Analysis Environment にある。
  2. NICER が観測した天体は NICER archive にまとめられている。これや、HEASARC Browse で探してくる。慣れてきたら、wget で自動スクリプトを作りたくなる。
  3. NICER のソフトウェア一式 NICERDAS の nicerl2 コマンドに従って生成すれば、cleaned event などの標準的な生成物ができる。nicerl2 は、以下の2つを実施する。
    • Calibration: energy scale, timing offsets
    • Screenings: by pointing, optical light, high background
  4. スペクトル解析に必要なファイルは上記では出力されず、NICER Background Estimation Tools として提供されている、GSFC を中心に開発されている Space Weather background model (nicer_bkg_estimator) か MIT を中心に開発されている 3C50 background model (nibackgen3c50) のいずれかを使い、天体とバックグラウンドのスペクトルファイルを生成する。現状では、3c50 の方が精度がよい。(HEASoft で公式に組み込まれていないのが面倒) 詳しくは論文 R. A. Remillard, "An Empirical Background Model for the NICER X-ray Timing Instrument"を読んでください。
  5. レスポンス一式はNICER Data Analysis Thredsにある。DET_ID 14, 34 はノイズが混入することがあるので、使わない事が多い。3C50 はこの2つを除いて構築されているので、50個のFPMに対応するレスポンスを使う。
    • この 2つのモジュールを除いた標準的なレスポンスを作成したものを、respに置いておいた。比較対象にしてください。

入門コース NICER Analysis Workshop

入門コースは、NICER Analysis Workshopに動画と、発表スライド(pdf)がアップロードされている。

このうち、最初の

  • K. Gendreau (NICER のリーダー)
  • Z. Arzoumanian (サブリーダー、サイエンスリード)
  • C. Markwardt (キャリブレーション、データプロセスのリーダー)
  • T. Strohmayer (時間解析)
  • R. Remillard (バックグラウンドのシミュレーター担当)

の5氏の話を確認するとよい。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
NICER の入門セミナー@2022-06-10

1. 資料をざっと眺める

入門コースは、NICER Analysis Workshopから以下のような資料を見る。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2. コマンド実演

(1) 環境の確認

今回の実演の例は以下の環境。

- PC: MacBook Air (Retina, 13-inch, 2020)
- OS: macOS Catalina, 10.15.7 
- HEASoft 6.30.1:  Source code instllation, Mac Intel - Darwin 19.x (macOS 10.15.x)
- NICERDAS: 2022-01-17_V009
- CAKDB: 20210707

HEADAS version:

$ echo $HEADAS
/Users/enoto/work/soft/heasoft/heasoft-6.30.1/x86_64-apple-darwin19.6.0

NICERDAS version:

%> nicerversion
2022-01-17_V009

CALDB information:

%> quzcif NICER XTI - - ALIGNMENT now now -
/Users/enoto/work/soft/heasoft/caldb/data/nicer/xti/bcf/pntmis/nixtipntmis20170601v001.teldef   0

(2) ダウンロード

クェーサー 3C273 (ObsID 2010100101)で実演する。HEASARC Broseで検索、ダウンロードする。

$ cd example/
$ tar zxvf ../orgdata/ni2010100101.tar

で解凍した後、

$ tree 2010100101 

などとすると、どんなファイルがあるかわかる。ここで、

$ fstruct 2010100101/xti/event_uf/ni2010100101_0mpu0_uf.evt.gz
$ fstruct 2010100101/xti/event_cl/ni2010100101_0mpu7_ufa.evt.gz

などとして、ファイルの中身のコラムを見てみる。

(3) 最初のおすすめ設定

  • nicerl2 の標準的なキャリブレーション、スクリーニングでプロセスする。
  • ただし、ノイズに配慮が必要なモジュール番号 14, 34 を除いておく。これで、7x6-4-2=50 個のモジュールを使っていることになる。
  • ライトカーブは上記で生成したデータで描く。14, 34 を除いているので、スペクトルと同じ組み合わせ。
  • スペクトルは、nibackgen3c50 で(デフォルト設定での)14,34を除いたライブラリから生成する。レスポンスは nicerarf, nicerrmf で生成する。

(4) nicerl2 を走らせる

nicerl2 indir=2010100101 clobber=YES

もし詳しく知りたければ、

fhelp nicerl2

などとすると解説が出てくる。ウェブでも nicerl2 の解説は見れる。fstruct や fv をして、何が追加されたか?を見るとよい。

3C50 のバックグラウンドに対応するには、

nicerl2 indir=2010100101 \
clobber=YES \
niprefilter2_coltypes=base,3c50 \
detlist="launch,-14,-34"

とする。

なお、detlist では、nifpmselで、どのFPMモジュールが選ばれたかの情報が入っている。単独でやるときは、

nifpmsel 2010100101/xti/event_cl/ni2010100101_0mpu7_cl.evt \
2010100101/xti/event_cl/ni2010100101_0mpu7_cl_wo14_34.evt \
"launch,-14,-34"

(5) Light curve

xselect
read event xti/event_cl/ni2010100101_0mpu7_cl.evt .
filter pha_cutoff
100
1000
set binsize 16
ext curve
plot curve
/xw
hard ni2010100101_0mpu7_cl_pi100_1000_16bin.ps/cps
exit
exit
no

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(6) NICER のバックグランドモデルを用意する

NICER Background Estimator Toolsの3C50をダウンロードする。README.txtに記載されている通りに、インストールする。

以下のバックグラウンドのファイル一式は、HEASoft とは別のフォルダに保存するのが良いかも。

/Users/enoto/work/soft/nibackgen3c50/v7/bg_models_3C50 

たとえば、ObsID 全体でのスペクトルを作るには、

nibackgen3C50 rootdir='./' \
obsid=2010100101 \
bkgidxdir='/Users/enoto/work/soft/nibackgen3c50/v7/bg_models_3C50' \
bkglibdir='/Users/enoto/work/soft/nibackgen3c50/v7/bg_models_3C50' \
gainepoch=2020 \
totspec='ni2010100101_tot' \
bkgspec='ni2010100101_bgd'

以下の2つで、Exposure が一致することを確認する。

gtisum ni2010100101_tot.pi   
ftlist ni2010100101_tot.pi K  | grep EXPOSURE

(まだnibackgen3C50がmatureでないので、直下にファイルが作られるので)適宜、ファイルを置き直す。

mkdir 2010100101/spec;
mv *.pi 2010100101/spec

(7) レスポンスを作る

Arf は以下のようにnicerarfで生成する。天体の座標をいれる必要があるので、HEASARC のCoordinate Converter (Coco)で調べて

3C273: RA=187.277916, DEC=2.052388 (J2000)

を使う。

nicerarf \
infile=2010100101/spec/ni2010100101_tot.pi \
ra=187.277916 dec=2.052388 \
attfile=2010100101/auxil/ni2010100101.att.gz \
selfile=2010100101/xti/event_cl/ni2010100101_0mpu7_cl.evt \
outfile=ni2010100101_0mpu7_cl_wo14_37.arf \
detlist=launch,-14,34 \
outwtfile=ni2010100101_0mpu7_cl_wo14_37.arfwt

nicerrmfで、rmf ファイルを作成する。たとえば、以下。いくつか流儀があると思う。

nicerrmf \
infile=2010100101/spec/ni2010100101_tot.pi \
mkfile=2010100101/auxil/ni2010100101.mkf.gz \
outfile=ni2010100101_0mpu7_cl_wo14_37.rmf \
detlist=launch,-14,-34

(8) スペクトルフィット

grppha でビンまとめする。もしくは、fgrppha.pyで、
xspecの表示と同じなビンまとめにすることもできる。

xspec
data 1:1 ni2010100101_tot_grpmin100.pi
response  1:1 ni2010100101_0mpu7_cl_wo14_37.rmf
arf 1:1 ni2010100101_0mpu7_cl_wo14_37.arf
backgrnd 1 ni2010100101_bgd.pi
setplot energy 
ignore **-0.6,12.0-**

フィット結果は以下のようになる。

========================================================================
Model pegpwrlw<1> Source No.: 1   Active/On
Model Model Component  Parameter  Unit     Value
 par  comp
   1    1   pegpwrlw   PhoIndex            1.73876      +/-  7.40141E-03  
   2    1   pegpwrlw   eMin       keV      2.00000      frozen
   3    1   pegpwrlw   eMax       keV      10.0000      frozen
   4    1   pegpwrlw   norm                52.5836      +/-  0.550679     
________________________________________________________________________


Fit statistic  : Chi-Squared                  283.93     using 257 bins.

Test statistic : Chi-Squared                  283.93     using 257 bins.
 Null hypothesis probability of 1.03e-01 with 255 degrees of freedom
XSPEC12>err 1 4
 Parameter   Confidence Range (2.706)
     1      1.72643      1.75115    (-0.0123335,0.0123905)
     4      51.6699      53.5053    (-0.913673,0.921765)

このスペクトルフィットでは、光子指数が1.7程度、0.5-10 keV のフラックスが

8.3×1011 erg/s/cm2 ほどになるはずである。ちなみに、Swift のほぼ同時観測があったはずなので、興味ある人は調べ得てみるとよい。(XMMもあったかも)

(8) 特定の時間のスペクトルを作る

(5) To implement the task for a particular pair of "ufa" and "cl" event files

nibackgen3C50.pl rootdir='NONE' obsid='NONE'
 bkgidxdir='mybackdir/bg_models_3C50' \
 bkglibdir='mybackdir/bg_models_3C50' gainepoch='2019' \
 calevtdir='NONE' ufafile='ufa_merged.evt' clfile='total_merged.evt

を参考にやってみてください。レスポンスの作り方も同様。

(8) 時間変動解析

時間変動解析の入門を参照のこと。

3. 困ったら?

  • まずは、エラーメッセージを見よう。Common NICER Error Messages and How to Fix Themなど、便利なサイトもある。
  • HEASoft の fhelp [tool name] で、マニュアルを読み込む。このマニュアルが一番正確な資料である。
  • Google で調べる。誰か、だいたい似たようなことにハマっている。検索キーワードが鍵である。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
参考資料やTIPS

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
NICER関係のTips

  • HEASARC Timeline 衛星がいつどの天体を見ていたのかを知りたい場合に便利
  • NICER Recent and Planned Schedule NICER の最新の観測スケジュール
  • NICER QuickLook Stream 現在どの天体を見ているかをリアルタイムに表示する。
  • NICER Policy for Target of Opportunity Requests ToO をかけたい場合にまず読む。
  • NICER ToO Request ここから ToO をかけられます。
  • NICER Enhanced Visibility Calculator NICER の visibility の詳細は、ここから調べられます。
    • up-to-date ISS ephemeris, attitude information, blockages by ISS structures, sun and moon restrictions (set at 45 and 15 degrees, respectively)
    • 14 days into the future and are not released daily
  • Definition of TIME in NICER Data Files NICER で時刻解析をするなら、読んでおくと良い。
  • デッドタイム補正 MIT の Ron Remillard さん他がよく調べている。SWG_deadtime_2020_May.pdf (2020-06-16) などを参照のこと(あとでまとめます)。
  • NICER Field of view (FOV) 以下の vignetting curve を見てください。
    NICER vignetting curve

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
便利な早見表ほか

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
NICER 関係の発表資料ほか

:Beer: HOPPY

榎戸の自分で使っている解析用スクリプト群 HOPPY: High-energy Observatory Pipelines via PYthon。そんなによくできているわけではないが、参考になるなら勝手にハックしてもらってかまわない。突発天体の時間変動を長期モニターする際に、なるべく自動化したいという意図で作った。

コードの改訂したい箇所

  • パイプライン処理でライトカーブ作成時に毎回表示されるのを隠す。邪魔。
  • spectal figure が blank-sky 仕様で見にくい。デフォルトの xcm を用意。
  • パイプラインで作成した場合の pdf を merge すること。
tags: tutorial NICER