--- breaks: true --- # NICER 望遠鏡のX線データ解析 最終更新 2022-06-03 NICER を中心に時間変動天体のX線データ解析に興味がある人向けのメモです。有用なリンクや情報へのポインタとしてお使い下さい。M1 レベルを想定しています。 [セミナー動画](https://youtu.be/aMJfxHKMuq0) ## :egg: 準備 (X線データ解析の一般的な知識) 1. [HEASoft](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/)はインストールされているとする。[Heasoft installing guide](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/install.html)も参照。[CALDB](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/caldb_intro.html) は最新のものにする。 2. X線の解析の基本は、[すざくファーストステップガイド](https://www.dropbox.com/s/a4fqz90cbb14axm/suzaku_first_step_guide_v4.0.2.pdf?dl=0)などと共通している。衛星特有でない、FITSファイルの内容、X線衛星でのファイルの種類、xselectやds9の使い方、 時間解析, などを参照するとよい。 3. X線スペクトル解析の入門は、[XspecによるX線スペクトル解析](https://hackmd.io/8rQuga9TRmKza44QM64WQA?both)などにまとめた。画面で説明した録画が[YouTube](https://youtu.be/aPe2kL-tN50)にある。立教大学の山田真也さんの[「初めての宇宙X線スペクトル解析ツールxspecの使い方」](https://qiita.com/yamadasuzaku/items/b978a5cac6197b6f1090)もわかりやすい。 4. 突発天体のX線データ解析は、志達めぐみさんの[「X線観測とデータ取得の方法 (主に突発天体向け)」](https://www.kwasan.kyoto-u.ac.jp/~yamanaka/mw/shidatsu_Xray_201124.pdf)([pdf](https://www.dropbox.com/s/vgkql594suh7ugw/shidatsu_Xray_201124.pdf?dl=0))にいろいろな衛星の実例があって、一読をおすすめする。 5. [実験データの統計解析](https://researchmap.jp/multidatabases/multidatabase_contents/download/229799/1b324bdaf49ce3ef633b8a4644ea6761/777?col_no=5&frame_id=589167) --博士過程のときに修士の学生さん向けに作った Xspec でのフィットのためのメモ。 6. X線天文学でのレスポンス(response)とは何かを知りたい場合。 - [The XSPEC implementation](https://heasarc.gsfc.nasa.gov/xanadu/xspec/manual/node11.html) - [An X-Ray Spectral Fitting Package Users’ Guide for version 12.12.1](https://heasarc.gsfc.nasa.gov/xanadu/xspec/XspecManual.pdf) - [Creating FITS format files for XSPEC](https://heasarc.gsfc.nasa.gov/xanadu/xspec/xspec11/fits/fitsfiles.html) ## :satellite: NICER X線望遠鏡のデータ解析 ### 公式 -- 標準的な解析の手順 まず公式の情報は [NICER Data Analysis](https://heasarc.gsfc.nasa.gov/docs/nicer/nicer_analysis.html) のページに載っている。 1. 他の衛星データの解析と同様に、HEASoft が使える環境を用意し、NICER の calibration file 一式を所定の場所に置く。NICER の解析環境のセットアップは [Setting Up a NICER Analysis Environment](https://heasarc.gsfc.nasa.gov/docs/nicer/analysis_threads/nicer-setup/) にある。 2. NICER が観測した天体は [NICER archive](https://heasarc.gsfc.nasa.gov/docs/nicer/nicer_archive.html) にまとめられている。これや、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](https://heasarc.gsfc.nasa.gov/docs/nicer/tools/nicer_bkg_est_tools.html) として提供されている、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"](https://arxiv.org/abs/2105.09901)を読んでください。 5. レスポンス一式は[NICER Data Analysis Threds](https://heasarc.gsfc.nasa.gov/docs/nicer/analysis_threads/arf-rmf/)にある。DET_ID 14, 34 はノイズが混入することがあるので、使わない事が多い。3C50 はこの2つを除いて構築されているので、50個のFPMに対応するレスポンスを使う。 - この 2つのモジュールを除いた標準的なレスポンスを作成したものを、[resp](https://github.com/tenoto/hoppy/tree/master/data/nicer/resp)に置いておいた。比較対象にしてください。 ### 入門コース -- NICER Analysis Workshop 入門コースは、[NICER Analysis Workshop](https://heasarc.gsfc.nasa.gov/docs/nicer/data_analysis/workshops/index.html#spring21)に動画と、発表スライド(pdf)がアップロードされている。 このうち、最初の - K. Gendreau (NICER のリーダー) - Z. Arzoumanian (サブリーダー、サイエンスリード) - C. Markwardt (キャリブレーション、データプロセスのリーダー) - T. Strohmayer (時間解析) - R. Remillard (バックグラウンドのシミュレーター担当) の5氏の話を確認するとよい。 ## :satellite: NICER の入門セミナー@2022-06-10 ### 1. 資料をざっと眺める 入門コースは、[NICER Analysis Workshop](https://heasarc.gsfc.nasa.gov/docs/nicer/data_analysis/workshops/index.html#spring21)から以下のような資料を見る。 - NICER とはなにか?(K.Gendreau,["Welcome and Introduction to the NICER Mission"](https://heasarc.gsfc.nasa.gov/docs/nicer/data_analysis/workshops/NICER2021workshopwelcome.pdf)) - NICER 解析のフロー (C. Markwardt ["How to Analyze NICER Data"](https://heasarc.gsfc.nasa.gov/docs/nicer/data_analysis/workshops/NICER-Workshop-Analysis-Markwardt-2021.pdf)) - NICER のイベントフィルター (C. Markwardt ["Screening NICER Data to Increase Available Data"](https://heasarc.gsfc.nasa.gov/docs/nicer/data_analysis/workshops/NICER-Workshop-Filtering-Markwardt-2021.pdf)) ![](https://i.imgur.com/hNCTAx0.jpg) ### 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](https://heasarc.gsfc.nasa.gov/db-perl/W3Browse/w3browse.pl)で検索、ダウンロードする。 ``` $ 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) 最初のおすすめ設定 :::warning - nicerl2 の標準的なキャリブレーション、スクリーニングでプロセスする。 - ただし、ノイズに配慮が必要なモジュール番号 14, 34 を除いておく。これで、7x6-4-2=50 個のモジュールを使っていることになる。 - ライトカーブは上記で生成したデータで描く。14, 34 を除いているので、スペクトルと同じ組み合わせ。 - スペクトルは、nibackgen3c50 で(デフォルト設定での)14,34を除いたライブラリから生成する。レスポンスは nicerarf, nicerrmf で生成する。 ::: #### (4) nicerl2 を走らせる ``` nicerl2 indir=2010100101 clobber=YES ``` もし詳しく知りたければ、 ``` fhelp nicerl2 ``` などとすると解説が出てくる。ウェブでも [nicerl2](https://heasarc.gsfc.nasa.gov/lheasoft/ftools/headas/nicerl2.html) の解説は見れる。fstruct や fv をして、何が追加されたか?を見るとよい。 3C50 のバックグラウンドに対応するには、 ``` nicerl2 indir=2010100101 \ clobber=YES \ niprefilter2_coltypes=base,3c50 \ detlist="launch,-14,-34" ``` とする。 なお、detlist では、[nifpmsel](https://heasarc.gsfc.nasa.gov/lheasoft/help/nifpmsel.html)で、どの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 ``` ![](https://i.imgur.com/gxIiAX1.jpg) #### (6) NICER のバックグランドモデルを用意する [NICER Background Estimator Tools](https://heasarc.gsfc.nasa.gov/docs/nicer/tools/nicer_bkg_est_tools.html)の3C50をダウンロードする。[README.txt](https://heasarc.gsfc.nasa.gov/docs/nicer/tools/README_nibackgen3C50_v7b.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](https://heasarc.gsfc.nasa.gov/lheasoft/ftools/headas/nicerarf.html)で生成する。天体の座標をいれる必要があるので、HEASARC の[Coordinate Converter (Coco)](https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/convcoord/convcoord.pl)で調べて ``` 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 ``` <!-- ``` echo ni2010100101_0mpu7_cl_wo14_37.arf > arffiles.lis ``` --> [nicerrmf](https://heasarc.gsfc.nasa.gov/lheasoft/ftools/headas/nicerrmf.html)で、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](https://github.com/tenoto/hoppy/blob/master/hoppy/ftools/cli/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-** ``` ![](https://i.imgur.com/oVxRmTM.jpg) フィット結果は以下のようになる。 ``` ======================================================================== 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\times 10^{-11}$ 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) 時間変動解析 [時間変動解析の入門](https://hackmd.io/@tenoto/r1BoiIHfv)を参照のこと。 ### 3. 困ったら? - まずは、エラーメッセージを見よう。[Common NICER Error Messages and How to Fix Them](https://heasarc.gsfc.nasa.gov/docs/nicer/analysis_threads/common-errors/)など、便利なサイトもある。 - HEASoft の fhelp [tool name] で、マニュアルを読み込む。このマニュアルが一番正確な資料である。 - Google で調べる。誰か、だいたい似たようなことにハマっている。検索キーワードが鍵である。 ## :book: 参考資料やTIPS ### :egg: NICER関係のTips - [HEASARC Timeline](https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/timeline/timeline.pl?mission=NICER) -- 衛星がいつどの天体を見ていたのかを知りたい場合に便利 - [NICER Recent and Planned Schedule](https://heasarc.gsfc.nasa.gov/docs/nicer/schedule/nicer_sts_current.html) -- NICER の最新の観測スケジュール - [NICER QuickLook Stream](https://heasarc.gsfc.nasa.gov/docs/nicer/ql/nicer_ql1.html) -- 現在どの天体を見ているかをリアルタイムに表示する。 - [NICER Policy for Target of Opportunity Requests](https://heasarc.gsfc.nasa.gov/docs/nicer/proposals/too_policy.html) -- ToO をかけたい場合にまず読む。 - [NICER ToO Request](https://heasarc.gsfc.nasa.gov/docs/nicer/schedule/nicer_too_request.html) -- ここから ToO をかけられます。 - [NICER Enhanced Visibility Calculator](https://heasarc.gsfc.nasa.gov/wsgi-scripts/nicer/visibility/nicervis.wsgi/) -- 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](https://heasarc.gsfc.nasa.gov/docs/nicer/analysis_threads/time/) -- NICER で時刻解析をするなら、読んでおくと良い。 - デッドタイム補正 -- MIT の Ron Remillard さん他がよく調べている。SWG_deadtime_2020_May.pdf (2020-06-16) などを参照のこと(あとでまとめます)。 - NICER Field of view (FOV) -- 以下の vignetting curve を見てください。 ![NICER vignetting curve](https://raw.githubusercontent.com/tenoto/hoppy/master/data/nicer/nicer_Atot_temp_enoto150821a.jpg) ### :star: 便利な早見表ほか - [QDP/PLT Color Sheet](https://raw.githubusercontent.com/tenoto/repository/master/docs/qdp_color_code.png) - [Matplotlib symbol and color sheet](https://raw.githubusercontent.com/tenoto/repository/master/docs/matplotlib_color_symbol_sheet.jpg) - [Recommended figure formats of astrophysical journals](https://github.com/tenoto/repository/blob/master/docs/figure_formats.pdf) - [物理定数表](https://github.com/tenoto/repository/blob/master/docs/physical_const_entv220515j.pdf) ### :tv: NICER 関係の発表資料ほか - Craig Markwardt (NASA/GSFC) ["NICER Best Practices and Calibration"](http://iachec.org/wp-content/presentations/2020/NICER-IACHEC-Markwardt-2020a.pdf), IACHEC 2020 ### :Beer: HOPPY 榎戸の自分で使っている解析用スクリプト群 [HOPPY: High-energy Observatory Pipelines via PYthon](https://github.com/tenoto/hoppy)。そんなによくできているわけではないが、参考になるなら勝手にハックしてもらってかまわない。突発天体の時間変動を長期モニターする際に、なるべく自動化したいという意図で作った。 コードの改訂したい箇所 - [ ] パイプライン処理でライトカーブ作成時に毎回表示されるのを隠す。邪魔。 - [ ] spectal figure が blank-sky 仕様で見にくい。デフォルトの xcm を用意。 - [ ] パイプラインで作成した場合の pdf を merge すること。 <!-- ### :star: 榎戸個人的なメモ - [Teru's private Neutron Star Catalog](https://docs.google.com/spreadsheets/d/1FEZGHECslW2gNPvlScyPY1XZsw02FSFr4YY-0tcqhls/edit?usp=sharing) --> <!-- ## Python 1. [東工大「Python早見帳」](https://chokkan.github.io/python/index.html) 2. [たった1日で基本が身につく! Python超入門](https://speakerdeck.com/yuichi110/1ri-deji-ben-gashen-nituku-pythonchao-ru-men) 3. [東大「Pythonプログラミング入門」](https://utokyo-ipp.github.io/index.html) 4. [「Python ゼロからはじめるプログラミング」](https://mitani.cs.tsukuba.ac.jp/book_support/python/) --> <!-- ### :notebook: 榎戸の作業記録 - 2020-08-27 Thursday - Comet Atlas, Comet 2017T2 についてパイプライン処理して、Emanuele さんに送った。後者は soft X-ray に excess が見えるので、天体由来の信号が見えているのではないか? - 2020-08-26 Wednesday - 木邑さんの SS_Cyg のデータをパイプライン処理してみた。理研 Box の下に一式をアップロードしている。ObsID ごとに、ライトカーブ、スペクトル、バリセントリック補正したイベントファイルなどを生成し、GTI ごとのスペクトルも(条件が満たされて作成できる場合には)作成している。3201600104 で、<0.3 keV に変な周期性が見える。すごい気になる。 - Wynn Ho のサポートで、LIGO ターゲットのデータをダウンロードする。 - 2020-08-21 Friday - Keith/Baz のサポート目的で、UX_Ari のデータをダウンロード。 - comet2017-t2-doyXXX と ATLAS_doy116A についてパイプライン処理をかける。 - nibgdlc3c50 を試験的に作成してみた。HOPPY の中に入っている。 --> ###### tags: `tutorial` `NICER`