Method: Matrix#signature_set

Defined in:
lib/rbbt/expression_old/matrix.rb

#signature_set(field, cast = nil) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/rbbt/expression_old/matrix.rb', line 107

def signature_set(field, cast = nil)
  path = Persist.persistence_path(matrix_file, {:dir => File.join(Matrix::MATRIX_DIR, 'signature_set')}, {:field => field, :cast => cast})
  Persist.persist(data, :tsv, :file => path, :no_load => true, :check => [matrix_file]) do
    signatures = TSV.open(matrix_file, :fields => [], :type => :list, :cast => cast)
    labels.values.flatten.uniq.sort.each do |value|
      begin
        s = Signature.tsv_field(label_differences(value), field, cast)
        s.fields = [value]
        signatures.attach s
      rescue Exception
        Log.warn("Signature for #{ value } did not compute")
      end
    end
    signatures
  end
  path
end