Commit ed29615d authored by Jason Wu's avatar Jason Wu
Browse files

filename updates for leap dada writer and baseband multithread writer

parent a9591eb6
Pipeline #110030 passed with stages
in 10 minutes and 57 seconds
......@@ -55,6 +55,17 @@ bool DiskSinkLeap::operator()(RawBytes& block)
}
std::size_t heap_size = HEAP_SIZE;
int fstart = 1340;
std::string date;
std::stringstream ss;
ss << _start_time;
date = ss.str();
std::string str2("-");
date.replace(date.find(str2),str2.length(),"");
date.replace(date.find(str2),str2.length(),"");
std::string filename;
std::stringstream xx;
xx << _start_time;
filename = xx.str();
std::size_t nheap_groups = block.used_bytes() / heap_size / _nchan;
_transpose.resize(block.used_bytes());
#pragma omp parallel for num_threads(_nchan)
......@@ -75,7 +86,7 @@ bool DiskSinkLeap::operator()(RawBytes& block)
ascii_header_set(_loop_header, "OBS_OFFSET", "%ld", _counter);
ascii_header_set(_loop_header, "FILE_SIZE", "%ld", 640000000);
std::stringstream fname;
fname << _start_time << "_" << fstart + 16 * ii << "_" << std::setw(20) << std::setfill('0') << _counter << ".dada";
fname << date.substr(0, 8) <<"_EFF_"<< fstart + 16 * ii <<"/"<< filename.substr(0,19) << "_" << std::setw(16) << std::setfill('0') << _counter << ".000000.dada";
BOOST_LOG_TRIVIAL(debug) << "filename" << fname.str();
_output_streams[ii].open(fname.str().c_str(), std::ios::out | std::ios::app | std::ios::binary);
_output_streams[ii].write((char*) _loop_header, HEADER_SIZE);
......
......@@ -51,6 +51,10 @@ bool DiskSinkMultithread::operator()(RawBytes& block)
of.close();
}
}
std::string time;
std::stringstream xx;
xx << _start_time;
time = xx.str();
#pragma omp parallel for num_threads(_nthread)
for (std::size_t ii = 0; ii < _nthread; ++ii) {
std::size_t index = ii * block.used_bytes()/_nthread;
......@@ -59,7 +63,7 @@ bool DiskSinkMultithread::operator()(RawBytes& block)
ascii_header_set(_loop_header, "OBS_OFFSET", "%ld", _counter + ii * block.used_bytes() / _nthread);
ascii_header_set(_loop_header, "FILE_SIZE", "%ld", block.used_bytes() / _nthread);
std::stringstream fname;
fname << _start_time << "_" << std::setw(20) << std::setfill('0') << _counter + ii * block.used_bytes() / _nthread << ".dada";
fname << time.substr(11, 8) << "_" << std::setw(20) << std::setfill('0') << _counter + ii * block.used_bytes() / _nthread << ".dada";
BOOST_LOG_TRIVIAL(debug) << "filename" << fname.str();
_output_streams[ii].open(fname.str().c_str(), std::ios::out | std::ios::app | std::ios::binary);
_output_streams[ii].write((char*) _loop_header, HEADER_SIZE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment