Teruaki Enoto
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # HOPPY: High-energy Observatory Pipelines via PYthon ###### tags: `python` `library` [![hackmd-github-sync-badge](https://hackmd.io/KktKqjMbT3Gj3zNO0Jpk6w/badge)](https://hackmd.io/KktKqjMbT3Gj3zNO0Jpk6w) :beer::beer::beer: https://github.com/tenoto/hoppy このパッケージは、X線データ解析でよく使う処理を自動化するためのライブラリやスクリプトの集合体です。 ## 初期設定 ### Python 環境 `pyenv` と `pyenv-virtualenv` の環境で動かせるのが理想です。 ### パス設定 シェル設定ファイル (e.g., ~/.zshrc) に以下の ``` export HOPPY_PATH="Path/To/User/Hoppy/Directory" alias hoppyinit="source $HOPPY_PATH/setenv/setenv.bashrc" ``` 毎回、コマンドプロンプトを立ち上げるたびに、 ``` heainit hoppyinit ``` とすれば動かせるようになるはずです。Python の必要なライブラリは要求されたら、`pip install xxx` で随時入れてください。 (本当は python ライブラリのバージョン管理して、環境ごとダウンロードできるようにしたいのですが、時間が取れないので、とりあえず...) ## Xspec Xspec の自動解析を、コマンドラインをそのまま書き下して実装。 ### ライブラリ - `xspec.py`: ### コマンド (CLI) - `get_xspec_rate.py`: Xspec の `show rate` コマンドで表示されるレートを読んでくれる。 - `xspec_fit.py`: ひとつの Xspec のフィッティングを実行する。 - `make_csv2xspec.py`: 入力するスペクトルファイル、rmf, arf のレスポンスファイル、パラメータの yaml ファイルを入力したら、`xspec_multi_fit.py` の入力ファイルに変換してくれる。 - `xspec_multi_fit.py`: `xspec_fit.py` をシリーズで複数回実行する。 ## :jack_o_lantern: NICER ``` hoppy/nicer ├── cli (コマンドライン・スクリプト群) │   ├── niwget.py │   ├── ... │   └── niauto.py ├── nicer.py (モジュール) ``` ### パスワード設定 ``` export HEADAS_REPOSITORY="HEADAS のデータ一式を保管する" export NICERTEAM_REPOSITORY="NICER のチーム内初期データ保存" export NICERPAGE_USERNAME="NICER のウェブページ閲覧用チームID" export NICERPAGE_PASSWORD="NICER のウェブページ閲覧用チーム・パスワード" export NICERDATA_DECRYPT_PASSPHRASE="NICERチーム gpg解凍用" ``` ### ライブラリ - `nicer.py`: メインのライブラリ。`NicerElf` クラスは、寝ている間に仕事をしてくれる妖精さん(Elf)で、複数の ObsID のデータを扱う。`NicerObsID` と `NicerGTI` はそれぞれ、ObsID 単位、GTI 単位でのデータを扱う。 ### コマンド (CLI) #### ダウンロード関係 - `niget_target_summary_sheet.py`: NICER Team のターゲット天体と ObsID リスト(Target Summary Sheet)をダウンロードします。チームの ID と Password が必要になります。 - `nishow_target_segment_sheet.py`: Target Summary Sheet から、該当する天体もしくは ObsID の情報を抜き出して表示してくれます。 - `niget_yyyymm.py`: ObsID を指定し、該当するデータが保存されているディレクトリ(観測年と月)を教えてくれる。 - `niwget.py`: 指定した ObsID もしくは、ターゲット名のデータをすべてダウンロードしてくる。HEASARC の公式アーカイブを探し、もしなければ NICER チーム内のアーカイブを確認する。 #### パイプライン処理 - `nipipeline.py`: 設定条件ファイルのレシピにしたがって、複数の ObsID についてパイプライン処理をしていきます。簡易的にスペクトル生成の結果まで作りますが、フィットは別にしてあります。 - `niauto.py`: データダウンロード、パイプライン処理、スペクトル・フィットまでを自動化してある。 #### Google spreadsheet と連動したパイプライン処理 Google spreadsheet との API を使ったやりとりは[参考](https://qiita.com/akabei/items/0eac37cb852ad476c6b9)などを参照すればよい。nicer-auto-gspread という名前の Google Spreadsheet を作った。 - 解析を行うマシンで、cron 設定により一定の感覚で、google spredsheet を読みに行き、その input sheet に要求があるファイルを探す。これが存在した場合、以下を行う。 - HEASARC からのダウンロード - パイプライン処理でのライトカーブ、スペクトルの生成 - 基本的なフィット - 処理したデータは dropbox 経由で別のフォルダに置く。 ## 時間変動解析 (未実装・実装中) ### ライブラリ - `timeseries.py`: ### コマンド (CLI) - `tmsearchburst.py`: イベント形式のデータで、一定幅の時間変動を示すライトカーブから、それに当てはまらな増大を検出する。 ## Reference - Python package lesson https://github.com/BillMills/pythonPackageLesson (see demo python package) - PEP 8 -- Style Guide for Python Code https://www.python.org/dev/peps/pep-0008/? ## History - 2020-08-17 modified (Teruaki Enoto) - 2018-11-14 new version 0.1.0 is created for CLI interface using click. <!-- This package includes libararies and scripts for X-ray analyses of High-energy Observatory Pipeines of PYthon (HOPPY). # Setup Write following lines to the initialization setup (e.g., ~/.zshrc). ``` export HOPPY_PATH="/Users/enoto/work/drbv1/soft/git/hoppy" alias hoppyinit="cd $HOPPY_PATH; source setenv/setenv.bashrc; pipenv shell" ``` Everytime, you need to run the following command line inputs, ``` heainit hoppyinit ``` ## NICER ``` hoppy/nicer ├── cli │   ├── nibarytime.py │   ├── niget_target_segment_sheet.py │   ├── niget_yyyymm.py │   ├── nipipe01_nicerl2.py │   ├── nishow_target_segment_sheet.py │   ├── nitimeconv.py │   ├── niwget.py │   └── plot_mitbgd3c50_photfile.py ├── nicer.py ├── nievent.py ``` * nicer.py: main library of the NICER data analysis framework. The "NicerElf" class is organizign the framwork. There are two main calsses NicerObsID and NicerGTI. * nipipeline.py: command line to run the nicer.py process. * niwget.py * niget_yyyymm.py * nishow_target_segment_sheet.py * niget_target_segment_sheet.py ## Files and Libraries * hoppy * nicer * [nievent.py](https://github.com/tenoto/hoppy/blob/master/hoppy/nicer/nievent.py) library * maxi * nustar * physics * plot * rxte * script * swift * timing * xmm * xspec * xte * gallery (example of plots and illustrations) * QDP * 2018 * setenv/setenv.bashrc (environmental setups) * tests (test scripts) ## Structure ``` hoppy ├── LICENSE ├── MANIFEST.in ├── README.md ├── dist ├── hoppy │   ├── general │   │   └── __init__.py │   ├── nicer │   │   └── __init__.py │   ├── plot │   │   └── __init__.py │   └── swift │   └── __init__.py └── setup.py ``` ## Class Description - XrayObservationDatabase - attribute - name - directory_path - csvfile - htmlfile - methods - run_pipeline - XrayObservation(XrayObservationDatabase) - attribute - target - satellite - obsid - name (target_satellite_obsid) - directory_path (target/satellite/obsid) - yamlfile - detector - obsmode - start_mjd - stop_mjd - start_yyyymmdd - start_hhmmss - stop_yyyymmdd - stop_hhmmss - exposure - ra_obs - dec_obs - rate - rate_error - source_count - backgrnd_count - soruce_pha - backgrnd_pha - rmffile - arffile - grppha_min_significance - grppha_max_bins - grppha_emin - grppha_emax - flag_generate_spectra (done,error,none) - flag_fit_spectra (done,error,none) - xspec_model_xcmfile - parnum_fixed - parnum_error - parameters ([parnum,value,error_min,error_max]...]) - methods - generate_spectra - fit_spectrum -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully