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

Make the time_0 in decay framework required and an astropy quantity #1735

Open
wkerzendorf opened this issue Jul 16, 2021 · 1 comment
Open

Comments

@wkerzendorf
Copy link
Member

Currently the IsotopeAbundance dataframe subclass does not require a time_0 but will just assume 0 days and move on.
This should be clearly specified and not just an assumption. We need to raise an error if this is not specified and tell the users to specify this in the config or elsewhere.

@Soumya624
Copy link

Soumya624 commented Dec 28, 2022

Hi @wkerzendorf ,

I have worked on this. As I was going through the "\tardis\io\decay.py" file, I feel if I change the current init method in line 11, then it can be resolved.

Here is a modified version of the init method that includes a check to ensure that the time_0 parameter is specified by the user:

Screenshot 2022-12-29 011009

This modified version first checks if the time_0 parameter is included in the kwargs dictionary. If it is not, it raises a ValueError to inform the user that the time_0 parameter must be specified. If the time_0 parameter is present, it is extracted from the kwargs dictionary and assigned to the time_0 variable. The time_0 key is then removed from the kwargs dictionary before calling the parent class's init method. Finally, the value of time_0 is assigned to the time_0 attribute of the IsotopeAbundance instance.

Result:
Screenshot 2022-12-29 012543

Please let me know if this approach is alright. I have updated the PR in #2183

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

No branches or pull requests

2 participants