0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

XSPECで `statistic cstat` を設定すると segmentation fault が起きる条件メモ

0
Posted at

はじめに

XSPECで次のように、理由が分からないまま segmentation fault が起きることがあります。

XSPEC> statistic cstat
Default fit statistic is set to: C-Statistic
   This will apply to all current and newly loaded spectra.
Segmentation fault (core dumped)

(動作環境:XSPEC version 12.13.1)

原因:ignore によりデータが消えている

次のようにエネルギー範囲を指定すると、

XSPEC12> data spectrum.pha
XSPEC12> ignore **-Emin Emax-**

設定次第では 有効なデータ点が 0 個 になります。
これが segmentation fault の直接の原因です。

この core dump の危険性

データが存在しない場合でも、

  • pl data
    ***XSPEC Error: Unable to plot: no data points found.
  • fit
    ***Warning: Ill-formed Fit problem - number of variable parameters exceeds number of bins

などのコマンドは segmentation fault にはならず、
「データがない」ことを明示的に教えてくれます

しかし、

  • statistic cstat

警告を出さずにそのまま segmentation fault で落ちます
(※筆者が確認した範囲ではこの例ですが、同様の挙動は他のコマンドでも起きる可能性があります)。

そのため、

  • モデルやファイルが壊れているように見える
  • どこで問題が起きたのか分かりにくい

という状況になりがちです。

まとめ

ignore によって有効データが 0 になった状態で statistic cstat を設定すると、
XSPECは警告なしに segmentation fault を起こすことがあります。

pl data"no data points found" が出ないかを事前に確認することで、
このトラブルは簡単に回避できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?