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

made the timo_0 in decay framework required #2183

Closed
wants to merge 8 commits into from

Conversation

Soumya624
Copy link

📝 Description

Type: 🪲 bugfix | 🚀 feature

Changed the current init method in line 11 of "\tardis\io\decay.py" file, to resolve the issue. Here is a snippet of the 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.

Also, link issues affected by this pull request by using the keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

📌 Resources

Examples, notebooks and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing Locally

Screenshot 2022-12-29 012543

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@Rodot-
Copy link
Contributor

Rodot- commented Feb 1, 2023

This seems to break the tests.

@sonachitchyan
Copy link
Member

This seems to break the tests.

The tests probably assume that the "default value" is set to 0, as it was in previously. @Soumya624 , can you look into that?

@Soumya624
Copy link
Author

Yeah sure!

@andrewfullard
Copy link
Contributor

@Soumya624 do you plan to address the currently failing checks soon?

@AyushiDaksh
Copy link
Contributor

@Soumya624 Are you still working on resolving this? If not, please let me know if I can take it forward from here.

@Soumya624
Copy link
Author

Soumya624 commented Feb 28, 2023

The tests probably assume that the "default value" is set to 0, as it was in previously

@andrewfullard I was going through the entire repository and i found that any test cases that create an instance of the IsotopeAbundance class without explicitly specifying the time_0 parameter are likely to fail.

So, I searched the test cases and found that if we can modify 'tardis/io/tests/test_decay.py' and 'tardis/model/tests/test_base.py', then we can omit these.

To modify the simple_abundance_model() fixture in tardis/io/tests/test_decay.py to avoid the failure due to the time_0 parameter not being specified, we can add an explicit time_0 parameter with a default value of 0 to the function definition and pass this default value to the constructor of IsotopeAbundances.

@pytest.fixture
def simple_abundance_model(time_0=0):
    index = pd.MultiIndex.from_tuples(
        [(28, 56)], names=["atomic_number", "mass_number"]
    )
    return IsotopeAbundances([[1.0, 1.0]], index=index, time_0=time_0)

And to modify the simple_isotope_abundance() function in tardis/model/tests/test_base.py, we can add a similar explicit time_0 parameter with a default value of 0 to the function definition and pass this default value to the constructor of IsotopeAbundances.

def simple_isotope_abundance(time_0=0):
    index = pd.MultiIndex.from_tuples(
        [(6, 14), (12, 28)], names=["atomic_number", "mass_number"]
    )
    abundance = [[0.2] * 20] * 2
    return IsotopeAbundances(abundance, index=index, time_0=time_0)

Please let me know if this approach is correct. I will made the PR!

@Soumya624
Copy link
Author

@Soumya624 Are you still working on resolving this? If not, please let me know if I can take it forward from here.

@AyushiDaksh Yeah i'm about to make a PR. With the necessary changes in the test cases!

@andrewfullard
Copy link
Contributor

Sorry for the late response. I think your solution is sensible, please commit it to this PR.

@AyushiDaksh
Copy link
Contributor

@Soumya624 Are you still working on this?

@andrewfullard If @Soumya624 is not actively working on this, then I'll take this up. In that case, would I have to make a new PR or append my changes to this PR?

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Soumya624
Copy link
Author

Soumya624 commented Mar 27, 2023

Hi @andrewfullard,
Please have a look at this now. Updated the changes!

Thanks

@Soumya624
Copy link
Author

@Soumya624 Are you still working on this?
Yeah. think rn it's passing the tests. Thanks for reminding!

@andrewfullard
Copy link
Contributor

Please resolve the merge conflict

@Soumya624
Copy link
Author

Hi @andrewfullard ,

Thanks for your review regarding the variable name. Please have a look at this now!

@andrewfullard andrewfullard self-requested a review April 10, 2023 19:09
@andrewfullard
Copy link
Contributor

@wkerzendorf do we want to require "time_0" now that we are changing how the model is set up?

@andrewfullard
Copy link
Contributor

Closing this in favour of later configuration restructure

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

Successfully merging this pull request may close these issues.

6 participants