|
41 | 41 | configs = LegendMetadata(path=args.configs)
|
42 | 42 | channel_dict = configs.on(args.timestamp, system=args.datatype)
|
43 | 43 |
|
44 |
| -hdf_settings = Props.read_from(channel_dict["snakemake_rules"]["tier_raw"]["inputs"]["settings"])["hdf5_settings"] |
45 |
| -blinding_settings = Props.read_from(channel_dict["snakemake_rules"]["tier_raw_blind"]["inputs"]["config"]) |
| 44 | +hdf_settings = Props.read_from(channel_dict["snakemake_rules"]["tier_raw"]["inputs"]["settings"])[ |
| 45 | + "hdf5_settings" |
| 46 | +] |
| 47 | +blinding_settings = Props.read_from( |
| 48 | + channel_dict["snakemake_rules"]["tier_raw_blind"]["inputs"]["config"] |
| 49 | +) |
46 | 50 |
|
47 | 51 | centroid = blinding_settings["centroid_in_keV"] # keV
|
48 | 52 | width = blinding_settings["width_in_keV"] # keV
|
|
83 | 87 | )
|
84 | 88 |
|
85 | 89 | # figure out which event indices should be blinded
|
86 |
| - toblind = np.append(toblind, np.nonzero(np.abs(np.asarray(daqenergy_cal) - centroid) <= width)[0]) |
| 90 | + toblind = np.append( |
| 91 | + toblind, np.nonzero(np.abs(np.asarray(daqenergy_cal) - centroid) <= width)[0] |
| 92 | + ) |
87 | 93 |
|
88 | 94 | # remove duplicates
|
89 | 95 | toblind = np.unique(toblind)
|
|
105 | 111 | except ValueError:
|
106 | 112 | # if this isn't an interesting channel, just copy it to the output file
|
107 | 113 | chobj, _ = store.read_object(channel, args.input, decompress=False)
|
108 |
| - store.write_object(chobj, channel, lh5_file=temp_output, wo_mode="w", |
109 |
| - hdf5_settings=hdf_settings) |
| 114 | + store.write_object( |
| 115 | + chobj, channel, lh5_file=temp_output, wo_mode="w", hdf5_settings=hdf_settings |
| 116 | + ) |
110 | 117 | continue
|
111 | 118 |
|
112 | 119 | if (chnum not in list(ged_channels)) and (chnum not in list(spms_channels)):
|
113 | 120 | # if this is a PMT or not included for some reason, just copy it to the output file
|
114 | 121 | chobj, _ = store.read_object(channel + "/raw", args.input, decompress=False)
|
115 |
| - store.write_object(chobj, group=channel, name="raw", lh5_file=temp_output, wo_mode="w", |
116 |
| - hdf5_settings=hdf_settings) |
| 122 | + store.write_object( |
| 123 | + chobj, |
| 124 | + group=channel, |
| 125 | + name="raw", |
| 126 | + lh5_file=temp_output, |
| 127 | + wo_mode="w", |
| 128 | + hdf5_settings=hdf_settings, |
| 129 | + ) |
117 | 130 | continue
|
118 | 131 |
|
119 | 132 | # the rest should be the Ge and SiPM channels that need to be blinded
|
|
124 | 137 | )
|
125 | 138 |
|
126 | 139 | # now write the blinded data for this channel
|
127 |
| - store.write_object(blinded_chobj, group=channel, name="raw", lh5_file=temp_output, wo_mode="w", |
128 |
| - hdf5_settings=hdf_settings) |
| 140 | + store.write_object( |
| 141 | + blinded_chobj, |
| 142 | + group=channel, |
| 143 | + name="raw", |
| 144 | + lh5_file=temp_output, |
| 145 | + wo_mode="w", |
| 146 | + hdf5_settings=hdf_settings, |
| 147 | + ) |
129 | 148 |
|
130 | 149 | # rename the temp file
|
131 | 150 | os.rename(temp_output, args.output)
|
0 commit comments