Class: SRF::DTA

Inherits:
Object
  • Object
show all
Defined in:
lib/spec_id/srf.rb

Constant Summary collapse

Unpack =
"EeIvvvv"
First_record_start_byte =

is this universal?

3644

Instance Method Summary collapse

Instance Method Details

#from_handle(fh) ⇒ Object



347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/spec_id/srf.rb', line 347

def from_handle(fh)
  st = fh.read(24)
  # get the bulk of the data in single unpack
  self[0,7] = st.unpack(Unpack)
  
  # Scan numbers possibly hidden in this next sequence of bytes (I think)
  st2 = fh.read(24)

  num_bytes_to_read = num_peaks * 8  
  st3 = fh.read(num_bytes_to_read)
  self[7] = st3
  self
end

#inspectObject

note on peaks (self) this is a byte array of floats, you can get the peaks out with unpack(“e*”)



341
342
343
344
345
# File 'lib/spec_id/srf.rb', line 341

def inspect
  peaks_st = 'nil'
  if self[7] ; peaks_st = "[#{self[7].size} bytes]" end
  "<SRF::DTA @mh=#{mh} @dta_tic=#{dta_tic} @num_peaks=#{num_peaks} @charge=#{charge} @ms_level=#{ms_level} @total_num_possible_charge_states=#{total_num_possible_charge_states} @peaks=#{peaks_st} >"
end