Home » NUSTAR » NUSTAR PRESPEC » problem with a processor (software-wise)
problem with a processor (software-wise) [message #17144] |
Fri, 08 August 2014 16:23 |
thuyuk
Messages: 68 Registered: July 2014
|
continuous participant |
From: *ific.uv.es
|
|
Hi all,
I want to test an array of data with some 1D conditions and then set output of another array of data when the first data set fulfill the condition.
So, I modified Gate1D.cpp and .hpp as the following:
#include "Gate1D.hpp"
#include <iostream>
#include <cmath>
Gate1D::Gate1D(const std::string &config_dir,
const std::string &name,
const bool no_files)
: Processor(name, config_dir, no_files, std::vector<int>())
{
// make all the in/outputs, parameters and coefficients
// known by name.
NAME_PARAMETER(num_channels);
init();
read_parameters();
NAME_CONDITION_ARRAY(reference_gate, Window1D, parameter(num_channels));
NAME_INPUT_ARRAY(value, parameter(num_channels));
NAME_INPUT_ARRAY(value2test, parameter(num_channels));
NAME_OUTPUT_ARRAY(GatedValue, parameter(num_channels));
init();
read_conditions();
}
Gate1D::~Gate1D()
{
}
void Gate1D::process(prespec::viscon::Interface &viscon_interface, int trigger)
{
int chnr = parameter(num_channels);
for (int i = 0; i<chnr; i++)
{
double left_gate = condition_array(reference_gate, i, 0);
double right_gate = condition_array(reference_gate, i, 1);
if(input_array_value(value, i) == 0 && input_array_value(value2test, i) == 0 )
return;
if (input_array_value(value2test, i) > left_gate && input_array_value(value2test, i) < right_gate)
{
double girdi = input_array_value(value, i);
fill_output_array(GatedValue, i, girdi);
}
}
}
I created required Processor.par and Processor.con files which have parameter and the conditions, respectively.
When I want to run this processor, I get the following error:
go4analysis: prespec/process/Processor.cpp:665: const double& prespec::process::Processor::input_array_value(int, int): Assertion `input_arrays_[channel].size() > i' failed.
I checked if any of input_array_value requests data from any of the channel which has a number that is out of range of the array, but I couldn't see it.
If anyone could tell me what seems to be the problem, I would be grateful.
Thanks!
Tayfun
|
|
|
Goto Forum:
Current Time: Sun Nov 24 07:11:37 CET 2024
Total time taken to generate the page: 0.00811 seconds
|