44 parser = argparse.ArgumentParser(description=
"Simulation of toy data for training of SVD hit time esitmator")
52 help=
'Size of the sample to generate'
60 help=
'Lower bound of t0 distribution, ns')
67 help=
'Upper bound of t0 distribution, ns')
74 help=
'Lower bound of tau distribution, ns')
81 help=
'Upper bound of tau distribution, ns')
88 help=
'RMS of tau jitter, 0 - no jitter, ns')
95 help=
'Lower bound of amplitude distribution, S/N units')
102 help=
'Upper bound of amplitude distribution, S/N units')
109 help=
'Lower bound of sigma distribution, S/N units')
116 help=
'Upper bound of sigma distribution, S/N units')
123 help=
'Size of t0 PDF bin, ns')
125 args = parser.parse_args()
127 generator = SampleGenerator(
128 (args.t0_low, args.t0_high),
129 (args.tau_low, args.tau_high),
130 (args.amp_low, args.amp_high),
131 (args.sigma_low, args.sigma_high),
135 print(
'Generating {0} samples...'.format(args.n_samples))
136 sample = generator.generate(args.n_samples)
139 timearray = generator.get_t0_array()
140 timebins = generator.get_t0_bins()
141 bins = pd.DataFrame({
142 'midpoint': timearray,
143 'lower': timebins.values[:-1],
144 'upper': timebins.values[1:]
148 bounds = pd.DataFrame({
149 'value': np.array([
't0',
'amplitude',
'tau',
'sigma']),
150 'sampling': np.array([
'uniform',
'uniform',
'uniform',
'uniform']),
152 generator.get_t0_bounds()[0],
153 generator.get_amp_bounds()[0],
155 generator.get_sigma_bounds()[0]
158 generator.get_t0_bounds()[1],
159 generator.get_amp_bounds()[1],
161 generator.get_sigma_bounds()[1]
164 orderedcols = [
'value',
'sampling',
'low',
'high']
165 bounds = bounds[orderedcols]
167 print(
'Samples created.')
169 output_name =
'SVDTime_Training{0}_{1}.pkl'
173 sample.to_pickle(output_name.format(
'Sample', args.n_samples))
174 bins.to_pickle(output_name.format(
'Bins', args.n_samples))
175 bounds.to_pickle(output_name.format(
'Bounds', args.n_samples))
177 print(
'Done.\nResults saved to {0}.'.format(output_name.format(
178 '{Sample, Bins, Bounds}', args.n_samples)))