lib/mcg/signal_analysis/ecg_file.rb
def to_file( f )
          num_segments = @signals.first[1].num_blocks
          num_elements = @signals.first[1].signal.block_size
          elem_size = @signals.first[1].signal.elem_size
          ts = @signals.first[1].timestamp
          buf = [MAGIC, VERSION, ts.to_i, @pairs.length, @signals.length,
                 num_segments, num_elements, elem_size
                ].pack(PFORMAT)
          f.write(buf)

          @signals.values.each { |s| s.to_file(f) }
          @pairs.each { |p| p.to_file(f) }
        end
# Pack contents to binary and write to file
Pack contents to binary and write to file
Pack contents to binary and write to file
def to_file( f )
          num_segments = @signals.first[1].num_blocks
          num_elements = @signals.first[1].signal.block_size
          elem_size = @signals.first[1].signal.elem_size
          ts = @signals.first[1].timestamp
          buf = [MAGIC, VERSION, ts.to_i, @pairs.length, @signals.length,
                 num_segments, num_elements, elem_size
                ].pack(PFORMAT)
          f.write(buf)
          @signals.values.each { |s| s.to_file(f) }
          @pairs.each { |p| p.to_file(f) }
        end
def to_file ( f ) num_segments = @signals . first [ 1 ] . num_blocks num_elements = @signals . first [ 1 ] . signal . block_size elem_size = @signals . first [ 1 ] . signal . elem_size ts = @signals . first [ 1 ] . timestamp buf = [ MAGIC , VERSION , ts . to_i , @pairs . length , @signals . length , num_segments , num_elements , elem_size ] . pack ( PFORMAT ) f . write ( buf ) @signals . values . each { | s | s . to_file ( f ) } @pairs . each { | p | p . to_file ( f ) } end
Pack contents to binary and write to file
Pack contents to binary and write to file
f