Skip to content

Conex output implementation - #130

Open
Jorgecvb1 wants to merge 5 commits into
mainfrom
conex_output_refactor
Open

Jorgecvb1 wants to merge 5 commits into
mainfrom
conex_output_refactor

Conversation

@Jorgecvb1

Copy link
Copy Markdown

Implements the conex output functionality onto a .root file. Includes a flag -c and a variable in the .toml file that can be assigned as True to run nuSpaceSim with conex output. A GH fit is made to the profile to obtain the GH parameters (works directly with Greisen, parameterized GH or fluctuated GH). Events with decay altitude >20km and Xmax outside the atmosphere (RN max is the last element) are rejected and not saved as output. Resolves #129

@Jorgecvb1
Jorgecvb1 requested a review from Areustle September 24, 2026 17:56
@Jorgecvb1 Jorgecvb1 self-assigned this Sep 24, 2026
@Jorgecvb1 Jorgecvb1 added the enhancement New feature or request label Sep 24, 2026
Jorgecvb1 and others added 4 commits September 24, 2026 19:59
Adds CONEX-format output of the optical showers' longitudinal profiles
(resolves #129), enabled by `nuspacesim run -c` or simulation.conex_output.

* conex/format.py codifies the CONEX Header/Shower trees as fixed-shape
  NumPy structured dtypes. Every shower shares the fixed EAS node grid, so
  profile branches are fixed X[n_nodes] leaves -- no variable-length arrays.
* conex/root_file.py writes those trees directly; no uproot/awkward
  dependency. Verified with ROOT 6.40 and uproot.
* conex/writer.py maps profiles onto the format (Gaisser-Hillas fit, depths
  from ground, dE/dX) and provides ConexWriter.
* compute() takes an on_shower_profile callable, forwarded through EAS and
  CphotAng as on_profile; it receives a fixed-shape ShowerProfile without
  changing any return value (serial and dask alike). No conditional
  branching in compute.py.

lgE uses showerEnergy (the energy the profile was built with); geometry uses
the beta the node grid was built with (clamped to >= 1 deg); showers whose
maximum lies outside the visible window are skipped.

Co-Authored-By: jorge <jcaracavalente@mines.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Areustle Areustle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated this per my own concerns. It no longer uses 3rd party libraries. Please test it out and let me know how you like it or if there are issues.

Comment thread src/nuspacesim/compute.py Outdated
Comment on lines +244 to +273
if config.simulation.conex_output:
numPEs, costhetaChEff, RN, z_nodes, X_to_node = eas(
beta_tr,
altDec,
showerEnergy,
init_lat,
init_long,
cloudf=cloud,
conex=True,
client=optical_cluster.client() if use_cluster else None,
serial=not use_cluster,
store=sw,
plot=to_plot,
)
conex_out(sim, RN, z_nodes, X_to_node, output_file)

else:
numPEs, costhetaChEff = eas(
beta_tr,
altDec,
showerEnergy,
init_lat,
init_long,
cloudf=cloud,
conex=False,
client=optical_cluster.client() if use_cluster else None,
serial=not use_cluster,
store=sw,
plot=to_plot,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a more elegant implementation than this.

@Jorgecvb1 Jorgecvb1 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the run with the conex output on. All variables are saved correctly, root file is saved, it runs very fast for any reasonable N. Ran output .root file as input for Auger Offline simulation framework, and it ran smoothly. Offline was able to read the .root file and all its variables, and run the simulation without any issues.

@Jorgecvb1

Jorgecvb1 commented Nov 3, 2026 via email

Copy link
Copy Markdown
Author

@Areustle
Areustle dismissed their stale review November 5, 2026 16:28

Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implementation of conex output with new refactoring

2 participants