mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-06-07 08:38:41 +02:00
Add parameter for Bernina dataset name
This commit is contained in:
@@ -17,7 +17,7 @@ class BerninaFormat : public H5Format
|
||||
public:
|
||||
~BerninaFormat(){};
|
||||
|
||||
BerninaFormat()
|
||||
BerninaFormat(const string& dataset_name)
|
||||
{
|
||||
// Input values definition type.
|
||||
// Which type should be the parameters you receive over the REST api.
|
||||
@@ -35,19 +35,19 @@ class BerninaFormat : public H5Format
|
||||
// After format has been writen, where to move the raw datasets.
|
||||
dataset_move_mapping.reset(new std::unordered_map<string, string>(
|
||||
{
|
||||
{config::raw_image_dataset_name, "data/JF_3.0M/data"},
|
||||
{"pulse_id", "data/JF_3.0M/pulse_id"},
|
||||
{"frame", "data/JF_3.0M/frame"},
|
||||
{"is_good_frame", "data/JF_3.0M/is_good_frame"},
|
||||
{"missing_packets_1", "data/JF_3.0M/missing_packets_1"},
|
||||
{"missing_packets_2", "data/JF_3.0M/missing_packets_2"},
|
||||
{"daq_recs", "data/JF_3.0M/daq_recs"},
|
||||
{"daq_rec", "data/JF_3.0M/daq_rec"},
|
||||
{"framenum_diff", "data/JF_3.0M/framenum_diff"},
|
||||
{"pulse_ids", "data/JF_3.0M/pulse_ids"},
|
||||
{"framenums", "data/JF_3.0M/framenums"},
|
||||
{"pulse_id_diff", "data/JF_3.0M/pulse_id_diff"},
|
||||
{"module_number", "data/JF_3.0M/module_number"},
|
||||
{config::raw_image_dataset_name, "data/" + dataset_name + "/data"},
|
||||
{"pulse_id", "data/" + dataset_name + "/pulse_id"},
|
||||
{"frame", "data/" + dataset_name + "/frame"},
|
||||
{"is_good_frame", "data/" + dataset_name + "/is_good_frame"},
|
||||
{"missing_packets_1", "data/" + dataset_name + "/missing_packets_1"},
|
||||
{"missing_packets_2", "data/" + dataset_name + "/missing_packets_2"},
|
||||
{"daq_recs", "data/" + dataset_name + "/daq_recs"},
|
||||
{"daq_rec", "data/" + dataset_name + "/daq_rec"},
|
||||
{"framenum_diff", "data/" + dataset_name + "/framenum_diff"},
|
||||
{"pulse_ids", "data/" + dataset_name + "/pulse_ids"},
|
||||
{"framenums", "data/" + dataset_name + "/framenums"},
|
||||
{"pulse_id_diff", "data/" + dataset_name + "/pulse_id_diff"},
|
||||
{"module_number", "data/" + dataset_name + "/module_number"},
|
||||
}));
|
||||
|
||||
// Definition of the file format.
|
||||
@@ -61,7 +61,7 @@ class BerninaFormat : public H5Format
|
||||
})),
|
||||
|
||||
s_ptr(new h5_group("data", {
|
||||
s_ptr(new h5_group("JF_3.0M", {}))
|
||||
s_ptr(new h5_group(dataset_name, {}))
|
||||
}))
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
if (argc != 8) {
|
||||
if (argc != 9) {
|
||||
cout << endl;
|
||||
cout << "Usage: bernina_h5_writer [connection_address] [output_file] [n_frames]";
|
||||
cout << " [rest_port] [user_id] [bsread_address] [n_modules]" << endl;
|
||||
cout << " [rest_port] [user_id] [bsread_address] [n_modules] [dataset_name]" << endl;
|
||||
cout << "\tconnection_address: Address to connect to the stream (PULL). Example: tcp://127.0.0.1:40000" << endl;
|
||||
cout << "\toutput_file: Name of the output file." << endl;
|
||||
cout << "\tn_frames: Number of images to acquire. 0 for infinity (until /stop is called)." << endl;
|
||||
@@ -22,6 +22,7 @@ int main (int argc, char *argv[])
|
||||
cout << "\tuser_id: uid under which to run the writer. -1 to leave it as it is." << endl;
|
||||
cout << "\tbsread_address: HTTP address of the bsread REST api." << endl;
|
||||
cout << "\tn_modules: Number of detector modules to be written." << endl;
|
||||
cout << "\tdataset_name: Name of the detector data dataset in the file format." << endl;
|
||||
cout << endl;
|
||||
|
||||
exit(-1);
|
||||
@@ -34,6 +35,7 @@ int main (int argc, char *argv[])
|
||||
int user_id = atoi(argv[5]);
|
||||
string bsread_rest_address = string(argv[6]);
|
||||
int n_modules = atoi(argv[7]);
|
||||
string dataset_name = string(argv[8]);
|
||||
|
||||
if (user_id != -1) {
|
||||
writer_utils::set_process_id(user_id);
|
||||
@@ -41,7 +43,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
writer_utils::create_destination_folder(output_file);
|
||||
|
||||
BerninaFormat format;
|
||||
BerninaFormat format(dataset_name);
|
||||
WriterManager manager(format.get_input_value_type(), output_file, n_frames);
|
||||
|
||||
auto header_values = shared_ptr<unordered_map<string, HeaderDataType>>(new unordered_map<string, HeaderDataType> {
|
||||
|
||||
Reference in New Issue
Block a user