class Labcom::ArcSamples
Authors-
S.imazu
Version-
23.0.0
Date-
2022-01-20
Comment-
Deprecated labcom module
[クラス名] ArcSamples¶ ↑
[説 明]¶ ↑
-
サンプリングデータクラス
-
計測データは、binary stringで保持する。
[メンバー]¶ ↑
block_bin_str(string)-
バイナリデータ(binary string)
image_type(string)-
データ型
- na_type (int)
-
NArrayデータ型
- bytes_per_sample (int)
-
1サンプルのバイト数
[クラスメソッド]¶ ↑
-
new( dtype=nil, data=nil, bsize=nil)
[インスタンスメソッド]¶ ↑
-
valWithThinning( n_thinning) -
set_val( dtype, data, bsize=nil)
[UPDATE履歴]¶ ↑
- 23.0.0
[DEPRECATED]¶ ↑
This class is scheduled to be removed in the next version 26.0.0.
Attributes
block_bin_str[R]
image_type[R]
Public Class Methods
new( dtype=nil, data=nil, bsize=nil)
click to toggle source
- 引 数
- dtype(string)
-
データ型
- data(string)
-
データ配列(binary string)
- bsize(int)
-
有効データバイト数
- 返 値
-
なし
- 説 明
-
コンストラクタ
# File lib/labcom/ArcSamples.rb, line 57 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
Public Instance Methods
num()
click to toggle source
- 引 数
-
なし
- 返 値
-
データ件数(int)
- 説 明
-
サンプリングデータのデータ件数を戻す。
バイトサイズではない。
# File lib/labcom/ArcSamples.rb, line 92 def num() return nil if( nil == @block_bin_str ) return @block_bin_str.length/@bytes_per_sample end
set_val( dtype, data, bsize=nil)
click to toggle source
- 引 数
- data(string)
-
データ配列(binary string)
- dtype(string)
-
データ型
- bsize(int)
-
有効データバイト数
- 返 値
-
なし
- 説 明
-
メンバー変数にサンプリングデータを設定する。
データ型 : ‘INT8’, ‘INT16’, ‘INT16’, ‘FLT32’, ‘FLT32’ (‘INT64’はNArrayが未サポート)
# File lib/labcom/ArcSamples.rb, line 155 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
val()
click to toggle source
- 引 数
-
なし
- 返 値
-
配列データ(NArray)
- 説 明
-
バイナリデータをNArrayクラスのオブジェクトに変換し戻す。
# File lib/labcom/ArcSamples.rb, line 107 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
valWithThinning( n_thinning=1 )
click to toggle source
- 引 数
- n_thinning(integer)
-
間引き 1/n
- 返 値
-
配列データ(NArray)
- 説 明
-
バイナリデータをNArrayクラスのオブジェクトに変換し戻す。
# File lib/labcom/ArcSamples.rb, line 126 def valWithThinning( n_thinning=1 ) num_sample = num() return nil if( nil == num_sample ) if( 2 > n_thinning ) then ary = NArray.to_na( @block_bin_str , @na_type, num_sample) else thin_ary = Retrieve.data_thinning( @block_bin_str , @block_bin_str.length, @bytes_per_sample, n_thinning) ary = NArray.to_na( thin_ary , @na_type, thin_ary.length/@bytes_per_sample) end return ary end