Skip to content

Commit ed0945d

Browse files
authored
Merge pull request #48 from ATTPC/gwm17_dev
Fix the SpyralWriter, update docs
2 parents d50cf16 + 1f52c09 commit ed0945d

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

docs/user_guide/detector/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ The final step of the process is to write the simulated detector response to dis
7575

7676
### Use with Spyral
7777

78-
For convience, attpc_engine includes a `SpyralWriter`, which will output a HDF5 file formatted to mimic [Spyral](https://attpc.github.io/Spyral), the AT-TPC group-supported analysis framework. `SpyralWriter` also includes the useful feature of splitting the output into multiple files based on file size, which can help take advantage of parallel analysis pipelines. Note that attpc_engine does not claim to provide values in the integral or amplitude fields of a Spyral point cloud that will match real data; `SpyralWriter` use the [theoretical response function](https://www.sciencedirect.com/science/article/pii/S0168900216309408?casa_token=DAWbhPvX49MAAAAA:Zen7nFs-pgG9wu__g0rrzus01B1pa7ZYspbz_KOnn-dZyhXNglEqtgywFKwYrvKKsIwEY10n49XV) of the GET electronics to make an attempt to approximate the amplitude and integral, but this should be regarded as dubious at best.
78+
For convience, attpc_engine includes a `SpyralWriter`, which will output a HDF5 file formatted to mimic [Spyral](https://attpc.github.io/Spyral), the AT-TPC group-supported analysis framework. `SpyralWriter` also includes the useful feature of splitting the output into multiple files based on number of events, which can help take advantage of parallel analysis pipelines. Note that attpc_engine does not claim to provide values in the integral or amplitude fields of a Spyral point cloud that will match real data; `SpyralWriter` use the [theoretical response function](https://www.sciencedirect.com/science/article/pii/S0168900216309408?casa_token=DAWbhPvX49MAAAAA:Zen7nFs-pgG9wu__g0rrzus01B1pa7ZYspbz_KOnn-dZyhXNglEqtgywFKwYrvKKsIwEY10n49XV) of the GET electronics to make an attempt to approximate the amplitude and integral, but this should be regarded as dubious at best.
7979

8080
Given that attpc_engine outputs point clouds, the results should not be run through the PointcloudPhase, rather starting directly with the ClusterPhase. Note that because Spyral expects trace data, one will need to "fake" the trace datapath. The simplest way to do this is to point the trace path to the Pointcloud directory of the workspace. Just be sure not to run the PointcloudPhase in this case!

docs/user_guide/getting_started.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ electronics = ElectronicsParams(
164164
shaping_time=1000,
165165
micromegas_edge=10,
166166
windows_edge=560,
167-
adc_threshold=40,
167+
adc_threshold=10,
168168
)
169169

170170
pads = PadParams()
171171

172172
config = Config(detector, electronics, pads)
173-
writer = SpyralWriter(output_path, config, 1_000_000_000)
173+
writer = SpyralWriter(output_path, config, 5_000)
174174

175175
def main():
176176
run_simulation(
@@ -216,18 +216,18 @@ electronics = ElectronicsParams(
216216
shaping_time=1000,
217217
micromegas_edge=10,
218218
windows_edge=560,
219-
adc_threshold=40,
219+
adc_threshold=10,
220220
)
221221

222222
pads = PadParams()
223223

224224
config = Config(detector, electronics, pads)
225225
```
226226

227-
Note that by not passing any arguments to `PadParams` we are using the default pad description that is bundled with the package. See the [detector](./detector/index.md) guide for more details. For the output, we create a SpyralWriter object. This will take in the simulation data and convert it to match the format expected by the Spyral analysis. Note the final argument of the Writer; this is the maximum size of an individual file in bytes (here we've specified 1GB). The writer will then split our output up into many files, which will help later when trying to analyze the data with a framework like Spyral.
227+
Note that by not passing any arguments to `PadParams` we are using the default pad description that is bundled with the package. See the [detector](./detector/index.md) guide for more details. For the output, we create a SpyralWriter object. This will take in the simulation data and convert it to match the format expected by the Spyral analysis. Note the final argument of the Writer; this is the maximum size of an individual file in events (here we've specified 5,000 events). The writer will then split our output up into many files, which will help later when trying to analyze the data with a framework like Spyral.
228228

229229
```python
230-
writer = SpyralWriter(output_path, config, 1_000_000_000)
230+
writer = SpyralWriter(output_path, config, 5_000)
231231
```
232232

233233
Then, just like in the kinematics script we set up a main function and set it to be run when the script is processed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "attpc_engine"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
description = "AT-TPC Monte-Carlo simulation engine"
55
authors = [
66
{name = "Gordon McCann", email = "gordonmccann215@gmail.com"},

src/attpc_engine/detector/writer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ def write(self, data: np.ndarray, config: Config, event_number: int) -> None:
229229
f"cloud_{event_number}", data=spyral_format
230230
)
231231

232+
dset.attrs["orig_run"] = self.run_number
233+
dset.attrs["orig_event"] = event_number
232234
# No ic stuff from simulation
233235
dset.attrs["ic_amplitude"] = -1.0
234236
dset.attrs["ic_multiplicity"] = -1.0

0 commit comments

Comments
 (0)