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

Add multiple nodep_data_names support #187

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

mhliu0001
Copy link
Contributor

Previously only one nodep_data_name is supported. Most of the time we are setting this to "batch_size". But sometimes it is necessary to set multiple nodep_data_names, like ["x", "y", "z", "num_photons", "num_electrons"]. This PR adds support for multiple nodep_data_names.

MWE:

import appletree as apt
er = apt.ERBand(bins=[bins_cs1, bins_cs2], bins_type="irreg")
component.deduce(data_names=["s1_area", "s2_area", "anti_correlation_eff"], nodep_data_names=["num_photon", "num_electron", "x", "y", "z"], force_no_eff=True)
component.compile()
print(component.code)

@coveralls
Copy link

coveralls commented Sep 29, 2024

Pull Request Test Coverage Report for Build 11093980906

Details

  • 11 of 12 (91.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 85.186%

Changes Missing Coverage Covered Lines Changed/Added Lines %
appletree/component.py 11 12 91.67%
Totals Coverage Status
Change from base Build 10709265769: -0.01%
Covered Lines: 2444
Relevant Lines: 2869

💛 - Coveralls

Copy link
Collaborator

@dachengx dachengx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please:

  1. Add a test for this new feature
  2. Make sure that all nodep_data_name has been changed to nodep_data_names

@@ -268,22 +268,22 @@ def dependencies_deduce(
self,
data_names: Union[List[str], Tuple[str]] = ["cs1", "cs2", "eff"],
dependencies: Optional[List[Dict]] = None,
nodep_data_name: str = "batch_size",
nodep_data_names: Union[List[str], Tuple[str]] = "batch_size",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"batch_size" -> ["batch_size"]

@mhliu0001 mhliu0001 marked this pull request as draft September 29, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants