Skip to content

Commit

Permalink
Merge pull request #67 from bene73/refactor
Browse files Browse the repository at this point in the history
Refactoring SolidStateDetectors.jl extension
  • Loading branch information
fhagemann authored Sep 19, 2024
2 parents 654e749 + abb3159 commit 7f2a917
Show file tree
Hide file tree
Showing 4 changed files with 441 additions and 334 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
*.lh5
.ipynb_checkpoints
Manifest.toml
17 changes: 16 additions & 1 deletion docs/src/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dsp = read_ldata(l200, :jldsp, :cal, :p03, :r000, det)
```
## `SolidStateDetectors` extension

LegendDataManagment provides an extension for [SolidStateDetectors](https://github.com/JuliaPhysics/SolidStateDetectors.jl). This makes it possible to create `SolidStateDetector` instances from LEGEND metadata.
LegendDataManagment provides an extension for [SolidStateDetectors](https://github.com/JuliaPhysics/SolidStateDetectors.jl). This makes it possible to create `SolidStateDetector` and `Simulation` instances from LEGEND metadata.

Example (requires a `$LEGEND_DATA_CONFIG` environment variable pointing to a legend data-config file):

Expand All @@ -52,6 +52,21 @@ A detector can also be constructed using the filename of the LEGEND metadata det
det = SolidStateDetector(LegendData, "V99000A.json")
```

In addition, when creating a `Simulation`, all simulation functions in SolidStateDetectors.jl can be applied. As usual, all fields stored in the `Simulation` can be written and read using `LegendHDF5IO`:

```julia
using LegendDataManagement
using SolidStateDetectors

sim = Simulation(LegendData, "V99000A.json")
simulate!(sim) # calculate electric field and weighting potentials

using LegendHDF5IO
ssd_write("V99000A.lh5", sim)
sim_in = ssd_read("V99000A.lh5", Simulation)
```


The following code will generate an overview plot of every 5th LEGEND detector (requires the actual LEGEND metadata instead of the metadata in legend-testdata):

```julia
Expand Down
Loading

0 comments on commit 7f2a917

Please sign in to comment.