binary to extract all, fixed index in check min/max
This commit is contained in:
parent
e9c8c37e97
commit
569909b391
40
extract_all.cpp
Normal file
40
extract_all.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "lib/tdm_ripper.hpp"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
// list of arguments: a) tdm file b) tdx file c) optional argument: output directory, default is ./
|
||||||
|
assert( argc == 3 || argc == 4 );
|
||||||
|
|
||||||
|
// declare and initialize tdm_ripper with two arguments specifying the files
|
||||||
|
tdm_ripper ripper(argv[1],argv[2],true);
|
||||||
|
|
||||||
|
// use given or default directory for output
|
||||||
|
std::string outdir;
|
||||||
|
outdir = ( argc == 4 ) ? argv[3] : "./" ;
|
||||||
|
|
||||||
|
ripper.print_hash_local((outdir+"hash_table_xml_local.dat").c_str());
|
||||||
|
ripper.print_hash_values((outdir+"hash_table_xml_value.dat").c_str());
|
||||||
|
ripper.print_hash_double((outdir+"hash_table_xml_double.dat").c_str());
|
||||||
|
ripper.print_extid((outdir+"channel_ext_id.dat").c_str());
|
||||||
|
|
||||||
|
std::ofstream gout((outdir+"list_of_groups.dat").c_str());
|
||||||
|
ripper.list_groups(gout);
|
||||||
|
gout.close();
|
||||||
|
|
||||||
|
std::ofstream fout((outdir+"list_of_channels.dat").c_str());
|
||||||
|
ripper.list_channels(fout);
|
||||||
|
fout.close();
|
||||||
|
|
||||||
|
// print all meta information
|
||||||
|
ripper.print_meta((outdir+"meta_info.csv").c_str());
|
||||||
|
|
||||||
|
for ( int i = 0; i < ripper.num_channels(); i++ )
|
||||||
|
{
|
||||||
|
ripper.print_channel(i,(outdir+"channel_"+std::to_string(i+1)+"_"
|
||||||
|
+ripper.channel_name(i)+".dat").c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -259,6 +259,9 @@ void tdm_ripper::parse_structure()
|
|||||||
// std::string keyinit("usi23258");
|
// std::string keyinit("usi23258");
|
||||||
// std::cout<<"xml test "<<xml_double_sequence_[xml_values_[xml_local_columns_[keyinit]]]<<"\n\n";
|
// std::cout<<"xml test "<<xml_double_sequence_[xml_values_[xml_local_columns_[keyinit]]]<<"\n\n";
|
||||||
|
|
||||||
|
// for ( auto el: minmax_ ) std::cout<<el.first<<" "<<el.second<<"\n";
|
||||||
|
// std::cout<<"\n\n";
|
||||||
|
|
||||||
// check consistency of number of channel-groups
|
// check consistency of number of channel-groups
|
||||||
int numgroups = count_occ_string(subtreedata.child("tdm_root").child_value("channelgroups"),"id");
|
int numgroups = count_occ_string(subtreedata.child("tdm_root").child_value("channelgroups"),"id");
|
||||||
assert( (neglect_empty_groups_ && numgroups == num_groups_+num_empty_groups_)
|
assert( (neglect_empty_groups_ && numgroups == num_groups_+num_empty_groups_)
|
||||||
@ -544,10 +547,8 @@ std::vector<double> tdm_ripper::get_channel(int channelid)
|
|||||||
// check if converted value is within expected range
|
// check if converted value is within expected range
|
||||||
for ( int i = 0; i < (int)chann.size(); i++ )
|
for ( int i = 0; i < (int)chann.size(); i++ )
|
||||||
{
|
{
|
||||||
// if ( chann[i] < minmax_[channelid-1].first
|
assert( chann[i] >= minmax_[channelid].first - 1.0e-6
|
||||||
// || chann[i] > minmax_[channelid-1].second ) std::cout<<std::setw(20)<<chann[i]<<std::setw(20)<<minmax_[channelid-1].first<<std::setw(20)<<minmax_[channelid-1].second<<"\n";
|
&& chann[i] <= minmax_[channelid].second + 1.0e-6 );
|
||||||
assert( chann[i] >= minmax_[channelid-1].first - 1.0e-6
|
|
||||||
&& chann[i] <= minmax_[channelid-1].second + 1.0e-6 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return chann;
|
return chann;
|
||||||
|
7
makefile
7
makefile
@ -15,9 +15,16 @@ main.o : main.cpp
|
|||||||
tdm_ripper.o : lib/tdm_ripper.cpp lib/tdm_ripper.hpp
|
tdm_ripper.o : lib/tdm_ripper.cpp lib/tdm_ripper.hpp
|
||||||
$(CC) -c $(CPPFLAGS) -I $(LIB) $< -o $@
|
$(CC) -c $(CPPFLAGS) -I $(LIB) $< -o $@
|
||||||
|
|
||||||
|
extall : extract_all.o tdm_ripper.o
|
||||||
|
$(CC) $(CPPFLAGS) $^ -o extract_all
|
||||||
|
|
||||||
|
extract_all.o : extract_all.cpp
|
||||||
|
$(CC) -c $(CPPFLAGS) -I $(LIB) $< -o $@
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -f $(EXE) *.o
|
rm -f $(EXE) *.o
|
||||||
rm -f *.dat
|
rm -f *.dat
|
||||||
|
rm -f extract_all
|
||||||
rm -f data/*.dat
|
rm -f data/*.dat
|
||||||
rm -f data/*.csv
|
rm -f data/*.csv
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user