makefile: fix some paths/dependencies and setup + gitignore
This commit is contained in:
parent
2772515dea
commit
2dcd67c194
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
/build
|
||||||
|
|
||||||
|
*.csv
|
Binary file not shown.
Binary file not shown.
14
makefile
14
makefile
@ -10,7 +10,7 @@ EXE = eatraw
|
|||||||
CCC = g++ -std=c++11
|
CCC = g++ -std=c++11
|
||||||
OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
||||||
|
|
||||||
# build executable
|
# build executable
|
||||||
$(EXE) : $(SRC)main.cpp $(LIB)raweat.hpp
|
$(EXE) : $(SRC)main.cpp $(LIB)raweat.hpp
|
||||||
$(CCC) $(OPT) $< -o $@
|
$(CCC) $(OPT) $< -o $@
|
||||||
|
|
||||||
@ -40,13 +40,15 @@ uninstall :
|
|||||||
rm /usr/local/bin/$(EXE)
|
rm /usr/local/bin/$(EXE)
|
||||||
|
|
||||||
# build python module
|
# build python module
|
||||||
build : setup.py raw_eater.pyx raw_eater.pxd $(SRC)raweat.hpp
|
build : setup.py raw_eater.pyx raw_eater.pxd $(LIB)raweat.hpp
|
||||||
python3 setup.py build_ext --inplace
|
python3 setup.py build_ext --inplace
|
||||||
|
cp raw_eater.cpython-*.so pyt/
|
||||||
|
|
||||||
install_py : setup.py raw_eater.pyx raw_eater.pxd $(SRC)raweat.hpp
|
py_install: setup.py raw_eater.pyx raw_eater.pxd $(LIB)raweat.hpp
|
||||||
python3 setup.py install
|
python3 setup.py install
|
||||||
|
|
||||||
clean_py :
|
py_clean :
|
||||||
rm -f raw_eater.cpython-36m-x86_64-linux-gnu.so
|
rm -f raw_eater.cpython-*.so
|
||||||
|
rm -f pyt/raw_eater.cpython-*.so
|
||||||
rm -f raw_eater.cpp
|
rm -f raw_eater.cpp
|
||||||
|
rm -rf build/
|
||||||
|
@ -11,7 +11,7 @@ from libcpp cimport bool
|
|||||||
|
|
||||||
# these method names have to match the C definitions of the methods!!
|
# these method names have to match the C definitions of the methods!!
|
||||||
|
|
||||||
cdef extern from "raweat.hpp":
|
cdef extern from "lib/raweat.hpp":
|
||||||
cdef cppclass raw_eater:
|
cdef cppclass raw_eater:
|
||||||
raw_eater(string) except +
|
raw_eater(string) except +
|
||||||
# get channel name and unit
|
# get channel name and unit
|
||||||
|
@ -11,18 +11,18 @@ int main(int argc, char* argv[])
|
|||||||
std::cout<<"number of CLI-arguments: "<<argc<<"\n";
|
std::cout<<"number of CLI-arguments: "<<argc<<"\n";
|
||||||
for ( int i = 0; i < argc; i++ ) std::cout<<std::setw(5)<<i<<": "<<argv[i]<<"\n";
|
for ( int i = 0; i < argc; i++ ) std::cout<<std::setw(5)<<i<<": "<<argv[i]<<"\n";
|
||||||
|
|
||||||
// check number of CLI arguments
|
// provide --help like return statement
|
||||||
assert( argc >= 3 );
|
|
||||||
|
|
||||||
// provide --help like return statement
|
|
||||||
if ( argc < 3 )
|
if ( argc < 3 )
|
||||||
{
|
{
|
||||||
std::cout<<"\n"<<"Usage: ./eatit INPUTRAW_1 INPUTRAW_2 ...INPUTRAW_N OUTPUTFILE"<<"\n"
|
std::cout<<"\n"<<"Usage: ./eatit INPUTRAW_1 INPUTRAW_2 ...INPUTRAW_N OUTPUTFILE"<<"\n"
|
||||||
<<"Convert set of related files in imc-format .raw corresponding to same measurement to single plain text .csv"<<"\n"
|
<<"Convert set of related files in imc-format .raw originating from same measurement to single plain text .csv"<<"\n"
|
||||||
<<"Example: ./eatit Druck_THZ_DK.raw pressure_Vacuum.raw druck_thz_dk.csv"<<"\n\n";
|
<<"Example: ./eatit Druck_THZ_DK.raw pressure_Vacuum.raw druck_thz_dk.csv"<<"\n\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check number of CLI arguments
|
||||||
|
assert( argc >= 3 );
|
||||||
|
|
||||||
// get list of names/paths of raw-files from CLI argument
|
// get list of names/paths of raw-files from CLI argument
|
||||||
std::vector<std::string> rawfiles;
|
std::vector<std::string> rawfiles;
|
||||||
for (int i = 1; i < argc-1; i++ ) rawfiles.push_back(std::string(argv[i]));
|
for (int i = 1; i < argc-1; i++ ) rawfiles.push_back(std::string(argv[i]));
|
||||||
@ -66,6 +66,7 @@ int main(int argc, char* argv[])
|
|||||||
std::vector<std::string> channinfo = {eatraw.get_name(),eatraw.get_unit(),eatraw.get_temp_unit()};
|
std::vector<std::string> channinfo = {eatraw.get_name(),eatraw.get_unit(),eatraw.get_temp_unit()};
|
||||||
channelinfo.push_back(channinfo);
|
channelinfo.push_back(channinfo);
|
||||||
}
|
}
|
||||||
|
std::cout<<"\n";
|
||||||
|
|
||||||
// obtain number of channels
|
// obtain number of channels
|
||||||
int num_chann = (int)alldata.size();
|
int num_chann = (int)alldata.size();
|
||||||
@ -86,7 +87,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// open .csv-file for dumping all data
|
// open .csv-file for dumping all data
|
||||||
std::ofstream fout(argv[argc-1]);
|
std::ofstream fout(argv[argc-1]);
|
||||||
|
|
||||||
// define output properties
|
// define output properties
|
||||||
int width = 30;
|
int width = 30;
|
||||||
int doubleprec = 9;
|
int doubleprec = 9;
|
||||||
@ -116,17 +117,17 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
// get time to process in this channel
|
// get time to process in this channel
|
||||||
double chtimenow = timedata[ch][0] + channidx[ch] * timedata[ch][2];
|
double chtimenow = timedata[ch][0] + channidx[ch] * timedata[ch][2];
|
||||||
|
|
||||||
if ( chtimenow <= firsttime and channidx[ch] < alldata[ch].size() )
|
if ( chtimenow <= firsttime and channidx[ch] < alldata[ch].size() )
|
||||||
{
|
{
|
||||||
firsttime = chtimenow;
|
firsttime = chtimenow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// print time step
|
// print time step
|
||||||
fout<<std::fixed<<std::dec<<std::setprecision(doubleprec)
|
fout<<std::fixed<<std::dec<<std::setprecision(doubleprec)
|
||||||
<<std::setw(width)<<std::right<<firsttime;
|
<<std::setw(width)<<std::right<<firsttime;
|
||||||
|
|
||||||
// std::cout<<std::setprecision(9)<<std::setw(20)<<firsttime<<" "<<std::setw(20)<<sometimeleft<<" ";
|
// std::cout<<std::setprecision(9)<<std::setw(20)<<firsttime<<" "<<std::setw(20)<<sometimeleft<<" ";
|
||||||
// for ( int ch = 0; ch < num_chann; ch++ ) std::cout<<channidx[ch]<<" / "<<alldata[ch].size()<<" ";
|
// for ( int ch = 0; ch < num_chann; ch++ ) std::cout<<channidx[ch]<<" / "<<alldata[ch].size()<<" ";
|
||||||
// std::cout<<"\n";
|
// std::cout<<"\n";
|
||||||
@ -139,18 +140,18 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
// this channel's time step
|
// this channel's time step
|
||||||
double chtimenow = timedata[ch][0] + channidx[ch] * timedata[ch][2];
|
double chtimenow = timedata[ch][0] + channidx[ch] * timedata[ch][2];
|
||||||
|
|
||||||
// get set of channels featuring next time step
|
// get set of channels featuring next time step
|
||||||
if ( chtimenow == firsttime && channidx[ch] < alldata[ch].size() )
|
if ( chtimenow == firsttime && channidx[ch] < alldata[ch].size() )
|
||||||
{
|
{
|
||||||
// write actual data to file
|
// write actual data to file
|
||||||
fout<<std::fixed<<std::dec<<std::setprecision(doubleprec)
|
fout<<std::fixed<<std::dec<<std::setprecision(doubleprec)
|
||||||
<<std::setw(width)<<std::right<<alldata[ch][channidx[ch]];
|
<<std::setw(width)<<std::right<<alldata[ch][channidx[ch]];
|
||||||
|
|
||||||
// increment time index of channel
|
// increment time index of channel
|
||||||
channidx[ch] = channidx[ch] + 1;
|
channidx[ch] = channidx[ch] + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this channel gets a null = empty string for this timestep
|
// this channel gets a null = empty string for this timestep
|
||||||
fout<<std::setw(width)<<"";
|
fout<<std::setw(width)<<"";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user