0

測定値からの直接データを含む Nexus ファイル (foo.nxs) があり、パンダで開きたいと考えています。ただし、典型的なものを試してみると

HDFStore('foo.nxs') or read_hdf('foo.nxs','/group')

空の Store を返すだけです:

<class 'pandas.io.pytables.HDFStore'>
File path: /foo.nxs
Empty

または TypeError:

TypeError: cannot create a storer if the object is not existing nor a value are passed

ドキュメント ページのすべての例は、hdf ファイルを作成し、そこにデータを保存してから取得することから始まりますが、これは同じ pandas から行われます。以前に pandas で生成されていない hdf ファイルを読み取ることができるかどうかを知りたいです。

@Jeff のリクエストによる、ptdump からの出力の一部を次に示します。

/ (RootGroup) ''
  /._v_attrs (AttributeSet), 4 attributes:
    [HDF5_Version := '1.8.11',
    NeXus_version := '4.3.0',
    file_name := '/Messdaten/C9/20140423/messung_21h14m01.197.nxs',
    file_time := '2014-04-23T21:14:01+01:00']
/exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001 (Group) ''
  /exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001._v_attrs (AttributeSet), 1 attributes:
   [NX_class := 'NXentry']
/exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001/scan_data (Group) ''
  /exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001/scan_data._v_attrs (AttributeSet), 1 attributes:
   [NX_class := 'NXdata']
/exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001/scan_data/actuator_1_1 (CArray(5, 121), zlib(6)) ''
  atom := Float64Atom(shape=(), dflt=0.0)
  maindim := 0
  flavor := 'numpy'
  byteorder := 'little'
  chunkshape := (5, 121)
4

1 に答える 1

0

プレーンなバニラ PyTables ストアがあります。したがって、これらは実際には非常に読みやすいです (パンダは必要ありません)。

with pd.get_store('test.h5') as store:
     data = store.root.exp_root.Kerr.DoublePulse2D.SuperDuperScan_V2_00001/scan_data/actuator_1_1.read()

ドキュメントはこちらです。

これは、PyTables ルート ノードを取得してデータを読み込むだけです。これはCArrayフォーマットされており、単純な配列です。

HDFStoreプレーン バニラの PyTablesTableオブジェクトを (メタ データなしで) 読み取ることができますが、配列を読み取るだけで十分に単純です。

于 2014-05-13T13:30:44.290 に答える