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

New metrics to return Transaction table with quantity in units of kg/GWe #161

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

Conversation

louishartono
Copy link
Contributor

@louishartono louishartono commented Feb 19, 2020

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 :).

cymetric/metrics.py Show resolved Hide resolved
tests/test_metrics.py Show resolved Hide resolved
@louishartono louishartono changed the title [WIP] New metrics to return Transaction table with quantity in units of kg/GWe New metrics to return Transaction table with quantity in units of kg/GWe Mar 11, 2020
Copy link
Member

@bam241 bam241 left a 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)

cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
Copy link
Member

@bam241 bam241 left a 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 Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
'Commodity': tranacts.Commodity,
'Units': tranacts.Units,
'Quantity': tranacts.Quantity},
columns=['SimId','TransactionId','ResourceId','ObjId','Time','SenderId','ReceiverId','Commodity','Units','Quantity'])
Copy link
Member

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 ?

Copy link
Contributor Author

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.

Copy link
Member

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 ?

cymetric/metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Show resolved Hide resolved
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),
Copy link
Member

Choose a reason for hiding this comment

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

lines over 80 chars

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Member

@bam241 bam241 left a comment

Choose a reason for hiding this comment

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

Almost there :)

cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
@bam241
Copy link
Member

bam241 commented May 11, 2020

This is good, we are almost there !

Copy link
Member

@bam241 bam241 left a 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

tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
Copy link
Member

@bam241 bam241 left a 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 !

cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
cymetric/metrics.py Outdated Show resolved Hide resolved
Copy link
Member

@bam241 bam241 left a 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

tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
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