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 checks #31

Merged
merged 12 commits into from
Jan 29, 2021
Merged

Add checks #31

merged 12 commits into from
Jan 29, 2021

Conversation

scarlehoff
Copy link
Member

Added a check so that the program stop before starting if it finds a problem in the runcard. I'll might add a few more.

I'm thinking about the pdfflow thing, but I think it would be need to implement it in validphys instead because all the other stuff is the lhapdf-data which we don't really have in pdfflow (@scarrazza, should we implement the LHAPDF-data stuff into pdfflow? Basically getting track of the pdfs in the server and the computer... do you have maybe a master student who wants to do network services going forward :P?)

@codecov
Copy link

codecov bot commented Jan 25, 2021

Codecov Report

Merging #31 (e5f65ed) into master (24a297f) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #31   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files          14      14           
  Lines        1297    1299    +2     
======================================
- Misses       1297    1299    +2     
Flag Coverage Δ
unittests 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pycompressor/app.py 0.00% <0.00%> (ø)
src/pycompressor/compressing.py 0.00% <0.00%> (ø)
src/pycompressor/compressor.py 0.00% <0.00%> (ø)
src/pycompressor/errfunction.py 0.00% <ø> (ø)
src/pycompressor/estimators.py 0.00% <ø> (ø)
src/pycompressor/pdfgrid.py 0.00% <ø> (ø)
src/pycompressor/postgans.py 0.00% <ø> (ø)
src/pycompressor/scripts/correlations.py 0.00% <0.00%> (ø)
src/pycompressor/scripts/distributions.py 0.00% <0.00%> (ø)
src/pycompressor/scripts/fids.py 0.00% <0.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24a297f...e5f65ed. Read the comment docs.

@scarrazza
Copy link
Contributor

@scarlehoff yes, that sounds interesting at this point. Unfortunately I don't have students now, but for sure we can consider as a master topic.

@scarlehoff
Copy link
Member Author

scarlehoff commented Jan 26, 2021

I quite like how the pycompressor works, quite streamlined :)

I've made some changes which are just style since I was reading through the code I thought it was silly to write comments about them since they are all very small changes. Some comments below:

min_itereval=1000,

Here the minimization is deprecated, why do you want to keep it? Wouldn't it be better to remove altogether (since you don't have to worry about backwards compatibility yet!) so you can remove all code

Are you always using the same grid? I'm worried that then a change in the grid used by NNPDF or LHAPDF at some point could break the code. Maybe it would be good to have some check to ensure that the grid is the same (maybe an error for us in NNPDF to have the grid sort of fixed instead of being something generated by vp...)

dic_estm = eval(infoline[1])

It makes me nervous in general to see eval (one could write some malicious code in that file and then it'd be evaluated!). Of course is not a real problem in academic software but one never knows when a piece of software becomes widespread-ly used, so if you can change that to https://www.kite.com/python/docs/ast.literal_eval it would be better (otherwise don't fret about it since I don't really think is dangerous at all!)

Edit: please make sure I haven't broken anything with this changes before accepting the changes!

@Radonirinaunimi
Copy link
Member

I quite like how the pycompressor works, quite streamlined :)

I've made some changes which are just style since I was reading through the code I thought it was silly to write comments about them since they are all very small changes. Some comments below:

Thanks for having a quick look 👍 Every comments are always useful :-)

min_itereval=1000,

Here the minimization is deprecated, why do you want to keep it? Wouldn't it be better to remove altogether (since you don't have to worry about backwards compatibility yet!) so you can remove all code

Here, the CMA is deprecated in the sense that it is unable to perform an adiabatic minimization as the GA. It still can perform the a minimization but maybe not as efficient when it comes to compress from the enhanced (I haven't tested this much).

Are you always using the same grid? I'm worried that then a change in the grid used by NNPDF or LHAPDF at some point could break the code. Maybe it would be good to have some check to ensure that the grid is the same (maybe an error for us in NNPDF to have the grid sort of fixed instead of being something generated by vp...)

I think the gird here is pretty useless and could be in any form. The only part it matters is when generating the PDF grids that will be estimated (it does not go into the final output). Once the compression is done and the list of selected replicas is generated, what the compressor does is just to copy the exact file from the LHAPDF and rename the replica index.

dic_estm = eval(infoline[1])

It makes me nervous in general to see eval (one could write some malicious code in that file and then it'd be evaluated!). Of course is not a real problem in academic software but one never knows when a piece of software becomes widespread-ly used, so if you can change that to https://www.kite.com/python/docs/ast.literal_eval it would be better (otherwise don't fret about it since I don't really think is dangerous at all!)

Thanks a lot for this suggestion, I will do so.

Edit: please make sure I haven't broken anything with this changes before accepting the changes!

Comment on lines 49 to 54
members = pdfsetting["pdf"].load().GetMembers()
if members < compressed:
if not gans["enhance"] and not pdfsetting["existing_enhanced"]:
raise CheckError(f"Cannot get {requested_replicas} replicas from {members} members if enhancing is not active")
raise CheckError(
f" Cannot get {compressed} replicas from"
f" {members} members if enhancing is not active.")
Copy link
Member

Choose a reason for hiding this comment

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

I just fixed the GetMembers part as it was giving error. I also think that here what we would like to check is if the size of the compressed is smaller thatn the size of the prior, and then asked for enhancement if it is greater. I have also changed that.

@Radonirinaunimi
Copy link
Member

Oups, I forgot to change the eval. I will do now.

@Radonirinaunimi Radonirinaunimi merged commit da8e532 into master Jan 29, 2021
@Radonirinaunimi Radonirinaunimi deleted the checks branch January 29, 2021 12:37
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