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

Reuploading fix #401

Merged
merged 7 commits into from
Apr 30, 2021
Merged

Reuploading fix #401

merged 7 commits into from
Apr 30, 2021

Conversation

AdrianPerezSalinas
Copy link
Contributor

I have solve the issue with the saved_parameters.pl file from the reuploading example.

What I did is essentially add some code such that:

  • It tries to read the file and stores the contain as data
  • If it is not, then an empty dict is created as data = {}.

Then the code looks into data for parameters. If it is found, the figures are painted. If it is not, and we do not mind whether it was because the file did not exist or because this calculation was never done, then the optimization is performed. Afterwards it dumps data into the file in any case.

Let me know if this solves your problem

@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #401 (b2ce3c7) into master (b99568a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #401   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           80        80           
  Lines        12745     12745           
=========================================
  Hits         12745     12745           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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 b99568a...b2ce3c7. Read the comment docs.

@AdrianPerezSalinas
Copy link
Contributor Author

@jubaglio let me talk to you in this PR. IN response to #397 (comment)

I am sorry, if does not work because of my fault, I did not check it properly.

I have added the following:

        try:
            data[dataset][layers] = parameters
        except:
            data[dataset] = {}
            data[dataset][layers] = parameters

The problem is that it is not possible to create a dict inside something that does not exist. For this reason we must add a previous step. You were completely right. However, I did it in such a way that it is not necessary to create all the list of dataset, and then we do not have to change it if we add more examples.

try:
data[dataset][layers] = parameters
except:
data[dataset] = {}
Copy link
Member

Choose a reason for hiding this comment

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

I think you can avoid this by making sure e.g. in line 30 that data[dataset] is not empty / not defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed

AdrianPerezSalinas and others added 2 commits April 30, 2021 12:41
Co-authored-by: Stefano Carrazza <scarrazza@users.noreply.github.com>
@scarrazza scarrazza merged commit 463ceeb into master Apr 30, 2021
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.

2 participants