Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attribute renamed in SimulatedEventsInfo but not in PowerLaw.from_simulation #257

Closed
kosack opened this issue Sep 13, 2023 · 3 comments · Fixed by #258
Closed

attribute renamed in SimulatedEventsInfo but not in PowerLaw.from_simulation #257

kosack opened this issue Sep 13, 2023 · 3 comments · Fixed by #258
Labels
bug Something isn't working

Comments

@kosack
Copy link

kosack commented Sep 13, 2023

simualtion_info = SimulatedEventsInfo(
    n_showers=shower_distribution["histogram"].sum(),
    energy_min=simulation_config["energy_range_min"][0],
    energy_max=simulation_config["energy_range_max"][0],
    max_impact=simulation_config["max_scatter_range"][0],
    spectral_index=simulation_config["spectral_index"][0],
    viewcone_min=simulation_config["min_viewcone_radius"][0],
    viewcone_max=simulation_config["max_viewcone_radius"][0],
)

spectral.PowerLaw.from_simulation(simulation_info, obstime=obstime)
    117 index = simulated_event_info.spectral_index
    118 n_showers = simulated_event_info.n_showers
--> 119 viewcone = simulated_event_info.viewcone
    121 if viewcone.value > 0:
    122     solid_angle = 2 * np.pi * (1 - np.cos(viewcone)) * u.sr

AttributeError: 'SimulatedEventsInfo' object has no attribute 'viewcone'

Should use the new viewcone_min and viewcone_max attributes.

@kosack kosack added the bug Something isn't working label Sep 13, 2023
@maxnoe
Copy link
Member

maxnoe commented Sep 13, 2023

Huh... that means that this part is not covered by tests. How embarrassing...

@kosack
Copy link
Author

kosack commented Sep 13, 2023

The class is immutable with __slots__ as well, so i can't even fake it!

@kosack
Copy link
Author

kosack commented Sep 13, 2023

By the way, might as well make it a dataclass (if you don't have to support pre python 3.7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants