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

[WIP] Units system #160

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

[WIP] Units system #160

wants to merge 11 commits into from

Conversation

bam241
Copy link
Member

@bam241 bam241 commented Feb 14, 2020

This work aims to allow unit management within Cyclus.

@bam241
Copy link
Member Author

bam241 commented Feb 15, 2020

here is an example of what it would look like:
https://github.com/bam241/cymetric_play/blob/unit/conv_int.ipynb

@bam241
Copy link
Member Author

bam241 commented Feb 15, 2020

@gonuke DO you have any though about this ?

@gonuke
Copy link
Member

gonuke commented Feb 26, 2020

Is this still WIP or ready for review? (I can review things on request if they are still WIP, as well - of course)

@bam241
Copy link
Member Author

bam241 commented Feb 26, 2020

Is this still WIP or ready for review? (I can review things on request if they are still WIP, as well - of course)

thx for offering.
This is not ready yet but might require a quick in-person meeting to cover the basis...

@bam241
Copy link
Member Author

bam241 commented Feb 28, 2020

@gonuke, this is probably ready for a first set of review (test are not implemented yet...)

the is the light version of the units management.

Normalized metrics only depends on their direct parents (i.e. norm_Materials only depends on Materials).
When computing non normalized metrics, the not normalized dependencies are queried....

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

The main part of this is hard to review because I have to relearn all of Cymetric's patterns. For now, here are some comments on some of the integration parts.

"""Checks if metric is already in the registry; adds it if not."""
normed_name = "norm_" + metric
Copy link
Member

Choose a reason for hiding this comment

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

Can we define a variable to be "norm_" to help guarantee consistency?

frames = []
for dep in m.dependencies:
frame = self.eval(dep, conds=conds)
frame = self.eval(dep, conds=conds, normed=False)
Copy link
Member

Choose a reason for hiding this comment

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

why do we force this to False here? Maybe a comment?

@@ -40,7 +41,7 @@ def name(self):
return self.__class__.__name__


def _genmetricclass(f, name, depends, scheme):
def _genmetricclass(f, name, depends, scheme, register):
Copy link
Member

Choose a reason for hiding this comment

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

Update docstring to describe register

__doc__ = inspect.getdoc(f)

def shema(self):
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this method name is probably a typo?

And should this return self.schema?

@@ -105,8 +110,9 @@ def dec(f):
('Units', ts.STRING),
('Mass', ts.DOUBLE)
]
_matregistry = { "Mass": ["Units", "kg"]}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think I understand how the registry works?

return self._schema
# fill in schema code
registry = register
#@property
Copy link
Member

Choose a reason for hiding this comment

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

delete these lines?

]
resources = root_metric(name='Resources', schema=_resource_shema, registry=_resour_registry)

#del _resour_registry, _resource_shema
Copy link
Member

Choose a reason for hiding this comment

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

remove commented lines

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.

None yet

2 participants