Class: NoyesC::BentCentMarker

Inherits:
Object
  • Object
show all
Defined in:
lib/cext/bent_cent_marker.c

Instance Method Summary collapse

Constructor Details

#initializeObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cext/bent_cent_marker.c', line 11

static VALUE t_init(VALUE self, VALUE args) {
  double adjustment = 0.003;
  double average_number = 1.0;
  double background = 100.0;
  double level = 0.0;
  double min_signal = 0.0;
  double threshold = 10.0;
  int len = RARRAY_LEN(args);
  if (len > 0)
     threshold = NUM2INT(rb_ary_entry(args, 0));
  if (len > 1)
    adjustment = NUM2INT(rb_ary_entry(args, 1));
  if (len > 2)
    average_number = NUM2INT(rb_ary_entry(args, 2));
  if (len > 3)
    background = NUM2INT(rb_ary_entry(args, 3));
  if (len > 4)
    level = NUM2INT(rb_ary_entry(args, 4));
  if (len > 5)
    min_signal = NUM2INT(rb_ary_entry(args, 5));

  BentCentMarker *pre = bent_cent_marker_new(threshold, adjustment,
                        average_number, background, level, min_signal);

  VALUE prev = Data_Wrap_Struct(cBentCentMarker, 0, _bent_cent_marker_free, pre);
  rb_iv_set(self, "@bent_cent_marker", prev);
  return self;
}

Instance Method Details

#<<Object


40
41
42
43
44
45
46
47
48
# File 'lib/cext/bent_cent_marker.c', line 40

static VALUE t_left_shift(VALUE self, VALUE obj) {
  Carr *M = r2carr(obj);
  BentCentMarker *pre;
  VALUE prev = rb_iv_get(self, "@bent_cent_marker");
  Data_Get_Struct(prev, BentCentMarker, pre);
  int res = bent_cent_marker_apply(pre, M);
  carr_free(M);
  return res ? Qtrue : Qfalse;
}