Authors
S.imazu
Version
20.0.0
Date
2018-06-01
バイナリデータ(binary string)
データ型
NArrayデータ型
1サンプルのバイト数
new( dtype=nil, data=nil, bsize=nil)
サンプリングデータクラス
計測データは、binary stringで保持する。
データ型
データ配列(binary string)
有効データバイト数
なし
[説 明] コンストラクタ
# File labcom/ArcSamples.rb, line 48 def initialize( dtype=nil, data=nil, bsize=nil) if nil != dtype then @image_type = dtype @na_type = Labcom::to_narray_type( dtype) @bytes_per_sample = Labcom::to_bytes_per_sample( dtype) else @image_type = nil @na_type = nil @bytes_per_sample = 1 end if nil != data then if nil == bsize then @block_bin_str = data else @block_bin_str = data[0..bsize-1] end else @block_bin_str = nil end end
なし
データ件数(int)
[説 明] サンプリングデータのデータ件数を戻す。 バイトサイズではない。
# File labcom/ArcSamples.rb, line 84 def num() return nil if( nil == @block_bin_str ) return @block_bin_str.length/@bytes_per_sample end
データ配列(binary string)
データ型
有効データバイト数
なし
[説 明] メンバー変数にサンプリングデータを設定する。 データ型 : 'INT8', 'INT16', 'INT16', 'FLT32', 'FLT32' ('INT64'はNArrayが未サポート)
# File labcom/ArcSamples.rb, line 123 def set_val( dtype, data, bsize=nil) @image_type = dtype @na_type = Labcom::to_narray_type( dtype) @bytes_per_sample = Labcom::to_bytes_per_sample( dtype) if nil == bsize then @block_bin_str = data else @block_bin_str = data[0..bsize-1] end end
なし
配列データ(NArray)
[説 明] バイナリデータをNArrayクラスのオブジェクトに変換し戻す。
# File labcom/ArcSamples.rb, line 100 def val() num_sample = num() return nil if( nil == num_sample ) ary = NArray.to_na( @block_bin_str , @na_type, num_sample) return ary end