mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-05 04:34:13 +02:00
Update alvra format
This commit is contained in:
+20
-16
@@ -17,7 +17,7 @@ class AlvraFormat : public H5Format
|
||||
public:
|
||||
~AlvraFormat(){};
|
||||
|
||||
AlvraFormat()
|
||||
AlvraFormat(const string& dataset_name, int n_bad_modules)
|
||||
{
|
||||
// Input values definition type.
|
||||
// Which type should be the parameters you receive over the REST api.
|
||||
@@ -30,24 +30,28 @@ class AlvraFormat : public H5Format
|
||||
}));
|
||||
|
||||
// Default values used in the file format.
|
||||
default_values.reset(new std::unordered_map<string, boost::any>({}));
|
||||
default_values.reset(new std::unordered_map<string, boost::any>(
|
||||
{
|
||||
{"general/n_bad_modules", n_bad_modules},
|
||||
{"general/detector_name", dataset_name}
|
||||
}));
|
||||
|
||||
// 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/JF4.5M/data"},
|
||||
{"pulse_id", "data/JF4.5M/pulse_id"},
|
||||
{"frame", "data/JF4.5M/frame"},
|
||||
{"is_good_frame", "data/JF4.5M/is_good_frame"},
|
||||
{"missing_packets_1", "data/JF4.5M/missing_packets_1"},
|
||||
{"missing_packets_2", "data/JF4.5M/missing_packets_2"},
|
||||
{"daq_recs", "data/JF4.5M/daq_recs"},
|
||||
{"daq_rec", "data/JF4.5M/daq_rec"},
|
||||
{"framenum_diff", "data/JF4.5M/framenum_diff"},
|
||||
{"pulse_ids", "data/JF4.5M/pulse_ids"},
|
||||
{"framenums", "data/JF4.5M/framenums"},
|
||||
{"pulse_id_diff", "data/JF4.5M/pulse_id_diff"},
|
||||
{"module_number", "data/JF4.5M/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 +65,7 @@ class AlvraFormat : public H5Format
|
||||
})),
|
||||
|
||||
s_ptr(new h5_group("data", {
|
||||
s_ptr(new h5_group("JF4.5M", {}))
|
||||
s_ptr(new h5_group(dataset_name, {}))
|
||||
}))
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
if (argc != 8) {
|
||||
if (argc != 10) {
|
||||
cout << endl;
|
||||
cout << "Usage: alvra_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] [n_bad_modules] [detector_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,8 @@ 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 << "\tn_bad_modules: Number of detector modules which has more then half bad pixels" << endl;
|
||||
cout << "\tdetector_name: Name of the detector, data will be written as data/detector_name/ " << endl;
|
||||
cout << endl;
|
||||
|
||||
exit(-1);
|
||||
@@ -34,6 +36,8 @@ 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]);
|
||||
int n_bad_modules = atoi(argv[8]);
|
||||
string detector_name = string(argv[9]);
|
||||
|
||||
if (user_id != -1) {
|
||||
writer_utils::set_process_id(user_id);
|
||||
@@ -60,7 +64,7 @@ int main (int argc, char *argv[])
|
||||
{"module_number", HeaderDataType("uint64", n_modules)}
|
||||
});
|
||||
|
||||
AlvraFormat format;
|
||||
AlvraFormat format(detector_name, n_bad_modules);
|
||||
|
||||
WriterManager writer_manager(format.get_input_value_type(), output_file, n_frames);
|
||||
ZmqReceiver receiver(connect_address, config::zmq_n_io_threads, config::zmq_receive_timeout, header_values);
|
||||
|
||||
Reference in New Issue
Block a user