Skip to content

Commit

Permalink
Merge pull request #631 from gammasim/layout_array_not_working
Browse files Browse the repository at this point in the history
Layout array simplify try and except
  • Loading branch information
VictorBarbosaMartins authored Oct 11, 2023
2 parents 3e5c058 + 3b823fc commit f0a3c5d
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions simtools/layout/layout_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,24 +262,19 @@ def _initialize_corsika_telescope_from_dict(self, corsika_dict):
dictionary with CORSIKA telescope parameters
"""

try:
self._corsika_telescope["corsika_obs_level"] = u.Quantity(
corsika_dict["corsika_obs_level"]
)
except (TypeError, KeyError):
self._corsika_telescope["corsika_obs_level"] = np.nan * u.m
try:
self._corsika_telescope["corsika_sphere_center"] = self._initialize_sphere_parameters(
corsika_dict["corsika_sphere_center"]
)
except (TypeError, KeyError):
pass
try:
self._corsika_telescope["corsika_sphere_radius"] = self._initialize_sphere_parameters(
corsika_dict["corsika_sphere_radius"]
)
except (TypeError, KeyError):
pass

for key in ["corsika_sphere_center", "corsika_sphere_radius"]:
try:
self._corsika_telescope[key] = self._initialize_sphere_parameters(corsika_dict[key])
except (TypeError, KeyError):
pass

def _initialize_coordinate_systems(self, center_dict=None):
"""
Expand Down Expand Up @@ -802,9 +797,8 @@ def get_corsika_input_list(self):
raise

corsika_list += "TELESCOPE"
corsika_list += f"\t {pos_x.value:.3f}E2"
corsika_list += f"\t {pos_y.value:.3f}E2"
corsika_list += f"\t {pos_z.value:.3f}E2"
for pos in [pos_x, pos_y, pos_z]:
corsika_list += f"\t {pos.value:.3f}E2"
corsika_list += f"\t {sphere_radius.value:.3f}E2"
corsika_list += f"\t # {tel.name}\n"

Expand Down

0 comments on commit f0a3c5d

Please sign in to comment.