Skip to content

Commit 9820048

Browse files
author
jorge
committed
Final merging with main
1 parent e870ac7 commit 9820048

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,4 @@ cython_debug/
195195
nss_to_conex.root
196196
nssenv
197197
*.png
198+
*.root

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ install_requires =
3838
pydantic
3939
rich
4040
scipy
41-
uproot
4241
tomli-w
42+
uproot
4343
configparser;python_version<"3.8"
4444
importlib-metadata;python_version<"3.8"
4545
importlib-resources;python_version<"3.9"

src/nuspacesim/compute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ def add_meta(self, name: str, value: Any, comment: str):
228228
if config.detector.optical.enable:
229229
logv("Computing [green] EAS Optical Cherenkov light.[/]")
230230
conex = config.simulation.conex_output
231-
232231
numPEs, costhetaChEff, profilesOut = eas(
233232
beta_tr,
234233
altDec,

src/nuspacesim/conex_out.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import datetime
2+
13
import awkward as ak
24
import numpy as np
35
import uproot
4-
import datetime
5-
66
from scipy.optimize import curve_fit
77

8-
from .simulation.eas_optical.shower_properties import path_length_tau_atm
8+
from .simulation.eas_optical.shower_properties import (
9+
path_length_tau_atm,
10+
)
911
from .simulation.eas_optical.shower_properties import (
1012
slant_depth_trig_approx as slant_depth,
1113
)
@@ -50,22 +52,22 @@ def GH(X, X0, Xmax, Nmax, p3, p2, p1):
5052
mask2[i] = False
5153
nmasked = np.sum(~mask2) + np.sum(~mask)"""
5254

53-
#beta = beta[mask2]
54-
#Zfirst = Zfirst[mask2]
55+
# beta = beta[mask2]
56+
# Zfirst = Zfirst[mask2]
5557
n = np.size(Zfirst)
56-
#TauEnergy = TauEnergy[mask2]
57-
#Xfirst = Xfirst[mask2]
58+
# TauEnergy = TauEnergy[mask2]
59+
# Xfirst = Xfirst[mask2]
5860
azim = 360 * np.random.rand(n) # Random azimuth
5961
zenith = 90 + np.degrees(beta)
6062
dEdXratio = 0.0025935 # 0.0025935 when comparing with Conex. This paper says 0.00219, but for general cosmic ray, not electrons only. https://doi.org/10.1016/S0927-6505(00)00101-8 in GeV /
6163
rootfile = output_file.replace(".fits", ".root")
6264
print("Generating conex-like output in " + rootfile)
63-
#print("Number of masked events ", nmasked)
65+
# print("Number of masked events ", nmasked)
6466
print("Number of valid events ", n)
6567

66-
#X = X[mask2]
67-
#Z = Z[mask2]
68-
#RN = RN[mask2]
68+
# X = X[mask2]
69+
# Z = Z[mask2]
70+
# RN = RN[mask2]
6971

7072
# Useful variables to fill the conex File
7173
PID = np.array([100], dtype="i4") # Proton type for Conex
@@ -129,7 +131,7 @@ def GH(X, X0, Xmax, Nmax, p3, p2, p1):
129131
g3 = popt[3]
130132
g2 = popt[4]
131133
g1 = popt[5]
132-
if chi2[i]>0.1:
134+
if chi2[i] > 0.1:
133135
print(
134136
f"Warning: chi2 for event {i} is too high ({chi2[i]:.3f}). "
135137
"This may indicate a poor fit."

src/nuspacesim/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ def validate_cherenkov_light_engine(cls, value: str) -> str:
355355
)
356356
conex_output: bool = False
357357

358-
359358
target: Optional[TargetOfOpportunity] = TargetOfOpportunity()
360359

361360
@field_validator(
@@ -464,8 +463,7 @@ def s(key: str):
464463
"table_version": s("tau_shower table_version"),
465464
},
466465
"thrown_events": s("thrown_events"),
467-
"conex_output": s("conex_output")
468-
466+
"conex_output": s("conex_output"),
469467
},
470468
"title": h["Config title"],
471469
}

src/nuspacesim/simulation/eas_optical/cphotang.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def photon_sum(
525525
return photsum
526526

527527
def valid_arrays(
528-
self, zsave, delgram, gramsum, gramz, ZonZ, ThetPrpA, Eshow, Conex
528+
self, zsave, delgram, gramsum, gramz, ZonZ, ThetPrpA, Eshow, conex
529529
):
530530
"""
531531
Return data arrays with invalid values removed
@@ -624,7 +624,7 @@ def cherenkov_area(self, AveCangI, DistStep, izRNmax):
624624
CherArea = self.pi * np.power(CherArea, 2, dtype=self.dtype)
625625
return CherArea
626626

627-
def run(self, betaE, alt, Eshow100PeV, lat, long, Conex, profilesIn, cloudf=None):
627+
def run(self, betaE, alt, Eshow100PeV, lat, long, conex, profilesIn, cloudf=None):
628628
"""Main body of simulation code."""
629629

630630
# Should we just skip these with a mask in valid_arrays?
@@ -641,9 +641,9 @@ def run(self, betaE, alt, Eshow100PeV, lat, long, Conex, profilesIn, cloudf=None
641641
#
642642

643643
zs, delgram, ZonZ, ThetPrpA, AirN, s, RN, e2hill, gramsum = self.valid_arrays(
644-
*self.slant_depth(alt, sinThetView), Eshow, Conex
644+
*self.slant_depth(alt, sinThetView), Eshow, conex
645645
)
646-
if Conex == "1":
646+
if conex:
647647
profilesIn = ak.concatenate([profilesIn, [gramsum], [zs], [RN]], axis=0)
648648

649649
# Cloud top height
@@ -707,7 +707,7 @@ def run(self, betaE, alt, Eshow100PeV, lat, long, Conex, profilesIn, cloudf=None
707707
return photonDen, Cang, profilesIn
708708

709709
def __call__(
710-
self, betaE, alt, Eshow100PeV, init_lat, init_long, Conex, cloudf=None
710+
self, betaE, alt, Eshow100PeV, init_lat, init_long, conex, cloudf=None
711711
):
712712
"""
713713
Iterate over the list of events and return the result as pair of
@@ -731,6 +731,6 @@ def __call__(
731731
)
732732
with ProgressBar():
733733
Dphots, Cang, profilesOut = zip(
734-
*b.map(lambda x: self.run(*x, Conex, profilesIn, cloudf)).compute()
734+
*b.map(lambda x: self.run(*x, conex, profilesIn, cloudf)).compute()
735735
)
736736
return np.asarray(Dphots), np.array(Cang), profilesOut

0 commit comments

Comments
 (0)