-
Notifications
You must be signed in to change notification settings - Fork 20
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
New metrics to return Transaction table with quantity in units of kg/GWe #161
base: main
Are you sure you want to change the base?
Conversation
…antity_per_gwe function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx @louishartono for adding this, this look great so far!
Some syntax changes are nevertheless necessary, we follow PEP8 suggestion about code style. Please try to modify your code accordingly.
Mainly:
- no space after
,
- lines should be shorter than 80 chars
- no tab, for indentation use multiple of 4 spaces
- argument of a method should be aligned (we split in multiple lines)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the code could be a improved a little. :)
Thank the addition !
cymetric/metrics.py
Outdated
'Commodity': tranacts.Commodity, | ||
'Units': tranacts.Units, | ||
'Quantity': tranacts.Quantity}, | ||
columns=['SimId','TransactionId','ResourceId','ObjId','Time','SenderId','ReceiverId','Commodity','Units','Quantity']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, I feel like you are redeclaring a copy of transacts, why is that required ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried deleting it but it caused an error because the name of the time column is 'TimeCreated' in tranacts while it is 'Time' in power.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so maybe remake one of the column, instead of making a copy ?
tests/test_metrics.py
Outdated
exp = pd.DataFrame(np.array([ | ||
(UUID('f22f2281-2464-420a-8325-37320fd418f8'), 1, 7, 3, 3, 10, 20, 'LWR Fuel', 'kg/GWe', 0.82), | ||
(UUID('f22f2281-2464-420a-8325-37320fd418f8'), 2, 8, 4, 3, 20, 30, 'FR Fuel', 'kg/GWe', 0.61), | ||
(UUID('f22f2281-2464-420a-8325-37320fd418f8'), 3, 9, 5, 12, 30, 40, 'Spent Fuel', 'kg/GWe', 0.09), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines over 80 chars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be confusing if I separate this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, PEP8 recommandation are line should be shorter than 80 chars to improve readability,
I might seem unintuitive, but this way readers don't have to scroll horizontally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :)
This is good, we are almost there ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#
should be followed by a space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some few more formatting issue :)
Almost there !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more formatting issues
Made some changes to metrics.py. Added a new metrics called "TransactionQuantityPerGWe" to return the transactions table with quantity in units of kg/GWe instead of kg and created some tests to check the expected output as well. Feel free to give feedback or suggestions :).