Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
nss_to_conex.root
nssenv
*.png
*.root
1 change: 1 addition & 0 deletions sample_input_file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ max_azimuth_angle = "360.0 deg"
angle_from_limb = "7.0 deg"
eas_long_profile = "Greisen"
cherenkov_light_engine = "nuspacesim"
conex_output = true

[simulation.ionosphere]
enable = true
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ keywords =
packages = find:
install_requires =
astropy>=4.3
awkward
click>=8.0.3
cubepy
dask
Expand All @@ -38,6 +39,7 @@ install_requires =
rich
scipy
tomli-w
uproot
configparser;python_version<"3.8"
importlib-metadata;python_version<"3.8"
importlib-resources;python_version<"3.9"
Expand Down
10 changes: 10 additions & 0 deletions src/nuspacesim/apps/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
@click.option(
"-o", "--output", type=click.Path(exists=False), default=None, help="Output file."
)
@click.option(
"-c",
"--conex_output",
is_flag=True,
help="Write output as a .root file with conex-like format.",
)
@click.option(
"-p",
"--plot",
Expand Down Expand Up @@ -139,6 +145,7 @@ def run(
plot: list,
plotconfig: str,
plotall: bool,
conex_output: bool,
write_stages: bool,
monospectrum: float,
powerspectrum: click.Tuple,
Expand Down Expand Up @@ -186,6 +193,9 @@ def run(
config.simulation.thrown_events = int(
config.simulation.thrown_events if count == 0.0 else count
)
# Conex-like Output
if conex_output:
config.simulation.conex_output = conex_output

overwrite_spectrum = parse_spectra_options(monospectrum, powerspectrum)
if overwrite_spectrum:
Expand Down
17 changes: 10 additions & 7 deletions src/nuspacesim/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from rich.console import Console

from . import results_table
from .conex_out import conex_out
from .config import NssConfig
from .simulation.atmosphere.clouds import CloudTopHeight
from .simulation.eas_optical.eas import EAS
Expand Down Expand Up @@ -141,13 +142,13 @@ def logv(*args):
console.rule("[bold blue] NuSpaceSim")

def mc_logv(mcint, mcintgeo, numEvPass, mcunc, method):
logv(f"\t[blue]Monte Carlo Integral [/][magenta][{method}][/]:", mcint)
logv(f"\t[blue]Monte Carlo Integral [/][magenta][{method}][/]: ", mcint)
logv(
f"\t[blue]Monte Carlo Integral, GEO Only [/][magenta][{method}][/]:",
f"\t[blue]Monte Carlo Integral, GEO Only [/][magenta][{method}][/]: ",
mcintgeo,
)
logv(f"\t[blue]Number of Passing Events [/][magenta][{method}][/]:", numEvPass)
logv(f"\t[blue]Stat uncert of MC Integral [/][magenta][{method}][/]:", mcunc)
logv(f"\t[blue]Number of Passing Events [/][magenta][{method}][/]: ", numEvPass)
logv(f"\t[blue]Stat uncert of MC Integral [/][magenta][{method}][/]: ", mcunc)

sim = results_table.init(config)
geom = RegionGeom(config)
Expand Down Expand Up @@ -226,15 +227,15 @@ def add_meta(self, name: str, value: Any, comment: str):
# if config.detector.method == "Optical" or config.detector.method == "Both":
if config.detector.optical.enable:
logv("Computing [green] EAS Optical Cherenkov light.[/]")

numPEs, costhetaChEff = eas(
conex = config.simulation.conex_output
numPEs, costhetaChEff, profilesOut = eas(
beta_tr,
altDec,
showerEnergy,
init_lat,
init_long,
conex,
cloudf=cloud,
store=sw,
plot=to_plot,
)

Expand All @@ -257,6 +258,8 @@ def add_meta(self, name: str, value: Any, comment: str):
sw.add_meta("OMCINTUN", mcunc, "Stat unc of MonteCarlo Integral")

mc_logv(mcint, mcintgeo, passEV, mcunc, "Optical")
if conex:
conex_out(sim, profilesOut, output_file)

if config.detector.radio.enable:
logv("Computing [green] EAS Radio signal.[/]")
Expand Down
Loading
Loading