예제 #1
0
KstHistogram::KstHistogram(const QString &in_tag, KstVectorPtr in_V,
                           double xmin_in, double xmax_in,
                           int in_n_bins,
                           KstHsNormType in_norm_mode)
: KstDataObject() {
  setRealTimeAutoBin(false);

  commonConstructor(in_tag, in_V, xmin_in, xmax_in, in_n_bins, in_norm_mode);
}
예제 #2
0
KstHistogram::KstHistogram(const QDomElement &e)
: KstDataObject(e) {
  KstHsNormType in_norm_mode;
  KstVectorPtr in_V;
  QString rawName;
  QString in_tag;
  double xmax_in =  1.0;
  double xmin_in = -1.0;
  int in_n_bins = 10;

  setRealTimeAutoBin(false);

  in_norm_mode = KST_HS_NUMBER;

  QDomNode n = e.firstChild();
  while( !n.isNull() ) {
    QDomElement e = n.toElement(); // try to convert the node to an element.
    if( !e.isNull() ) { // the node was really an element.
      if (e.tagName() == "tag") {
        in_tag = e.text();
      } else if (e.tagName() == "vectag") {
        rawName = e.text();
      } else if (e.tagName() == "NormMode") {
        if (e.text()=="NUMBER") {
          in_norm_mode = KST_HS_NUMBER;
        } else if (e.text()=="PERCENT") {
          in_norm_mode = KST_HS_PERCENT;
        } else if (e.text()=="FRACTION") {
          in_norm_mode = KST_HS_FRACTION;
        } else if (e.text()=="MAX_ONE") {
          in_norm_mode = KST_HS_MAX_ONE;
        }
      } else if (e.tagName() == "minX") {
        xmin_in = e.text().toDouble();
      } else if (e.tagName() == "maxX") {
        xmax_in = e.text().toDouble();
      } else if (e.tagName() == "numBins") {
        in_n_bins = e.text().toInt();
      } else if (e.tagName() == "realtimeautobin") {
        _realTimeAutoBin = (e.text() != "0");
      }
    }
    n = n.nextSibling();
  }

  _inputVectorLoadQueue.append(qMakePair(RAWVECTOR, rawName));
  commonConstructor(in_tag, in_V, xmin_in, xmax_in, in_n_bins, in_norm_mode);
}
예제 #3
0
Histogram::Histogram(ObjectStore *store)
  : DataObject(store) {
  setRealTimeAutoBin(false);
  _typeString = staticTypeString;
  _type = "Histogram";
  _initializeShortName();

  // _Bins, _bVector and _hVector need to be valid, 
  // so initialize them as size 2 (where 2 is a small valid number)
  _Bins = new unsigned long[2];

  VectorPtr v = store->createObject<Vector>();
  v->setProvider(this);
  v->setSlaveName("bin");
  v->resize(2);
  _bVector = _outputVectors.insert(BINS, v).value();

  v = store->createObject<Vector>();
  v->setProvider(this);
  v->setSlaveName("num");
  v->resize(2);
  _hVector = _outputVectors.insert(HIST, v).value();
}