-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/package #41
Feature/package #41
Conversation
great work. asking out of ignorance: are the pycache files there by accident or are they needed for packaging? :) |
My bad, I did not notice the pycache files left. I have removed them. Thanks for noticing! |
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.
Thanks Niccolò, this is good progress.
Something to bear in mind is that it is easier to review pull requests that are relatively focused—introducing new features and also restructuring the code at the same time makes it more difficult to spot potential issues.
Remember also that if you push to the branch from which you made your pull request, then it will add the commits to the PR (which if they are unrelated will further increase its scope).
Please take a look at the specific changes requested in the below. Do push the changes to the same branch, because in this case we do want them to become part of this PR. Any questions, please ask!
I should probably merge my other PR, since it addressed some of the open issues already |
src/LatticeInverseProblem/core.py
Outdated
@@ -79,16 +79,47 @@ def generalised_ft(t, alpha, sigma, e, e0): | |||
res = mp.fmul(res, arg) # Erfc() * exp() | |||
return res | |||
|
|||
def ft_mp(e, t, sigma_, alpha, e0=mpf("0"), type="EXP", T=0, ker_type='GAUSS'): | |||
def generalised_ft_halfnorm(t, alpha, sigma, e, e0): |
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.
@nickforce98 are we keeping the normalisation for the gaussian in [0,inf]?
that's fine by me if it's needed for the code release (so you dont have to re-do fits), but I would get rid of it right after. It's quite error prone because the kernel is no longer symmetric in the arguments and I can't vouch the rest of the code is aware of this
edit:
To be safe, we could use runExact.py with the various kernels, and make sure that without error on the correlators we can reproduce the true solution
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.
@LupoA, I introduced again the possibility of a half normalised gaussian to be consistent between the paper it will come out and the code release. At least in the version I release on Zenodo I would keep that. Then, it's fine to me to remove it.
The code has the options in the parser: 'FULLNORMGAUSS' (default), 'HALFNORMGAUSS', and 'CAUCHY'.
Thanks also for the suggestion.
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.
very good, let's indeed keep it for the release.
In order to use runExact.py, you should modify (locally on your machine) line 105 where you should put your kernel of choice. Then in line 152 you should tell the code to compute the coefficients with the same kernel. It should be a painless check, but let me know if I can assist!
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.
Since there will need to be a code release that wraps this library, could the normalisation be done there and this library kept "pure"? (Can discuss in more detail if my meaning isn't clear here.)
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.
you should modify (locally on your machine) line 105 where you should put your kernel of choice. Then in line 152 you should tell the code to compute the coefficients with the same kernel
You have to modify the installed library in place? This sounds like a design issue that is out of scope for addressing in this PR but is worth trying to improve.
@LupoA am I reading you correctly? If so then we can open an issue to track this.
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.
not the library, runExact.py is supposed to be an example file or rather a template for a specific application (performing the reconstruction on synthetic, error-free data). The exact smeared spectral density will depend on the specific kernel.
It is of course possible to input the kernel and let runExact work on any of them, by adding a couple of if statement. If we want this, it should be part of the "additional kernel implementation" effort that is already inside this PR (see commit 'adding cauchy kernel')
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.
Ahh, I see. In that case the version of runExact.py
or similar that Niccolò uses in our analysis should be in the code release for the paper, not the more general library.
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 am quite happy with what @nickforce98 has done having it in the example folder! notice that this specific file is not used in your analysis since you use real data, it is however an important file for checking the implementation is correct
I've lost track of changes... are we happy with the status or is some more work missing? once we are done I can resolve the conflicts and merge |
@LupoA I think I have fixed all the problems. Also the test runExact.py is working with CAUCHY. I am not quite happy with the speed of the high precision numerical integration performed to compute f_t and A_0 in the Cauchy case. Anyways, I thought for long, and made many attempts (also parallelization or similar) to speed it up, and I still did not find a solution. I will keep thinking if there's anything else I can do to speed it up, but I should have responded to all the points of the review of this PR. |
Perhaps open a separate issue to track that at this point.
Great! |
Sweet! I'll try resolving the conflicts and then merge |
This might be just me not being used to deal with python packages, but: Upon manual installation (git clone, cd directory, pip install . ) I obtain the following
which is not really a problem, but do you know why it shows up as unknown? |
Again, I might be doing something silly, but
returns
|
Until the PR is merged, |
Sorry I did not say but I did to that,
|
Just to document, I had a quick Zoom with Alessandro; it's not clear what was causing his issue, but creating a new virtual environment and retrying worked. @nickforce989 Take a look at dd046f3; it's an important part of creating a |
Ok, thanks for making me notice! and apologies to @LupoA if I made you lose some time. |
Before merging: I am a bit disturbed by the fact that I can only perform the installation in a new virtual environment. The problem I had, persists if I run outside of one. @edbennett any ideas? |
This appears to be the same issue as discussed in pypa/setuptools#3269 - Debian does weird things to the built-in Python (as you saw earlier when we had to The solution is to use virtual environments and/or to avoid using the OS-provided Python. (This is considered good practice anyway.) |
got it. thanks!!! |
I have implemented the systematics evaluation, Cauchy kernel and rho fitting procedure starting from the code in 'feature/GP'. This could a good start where one can do the refactoring, as it implements both HLT and Bayesian processes and perform fits and uses two kernels. Also a starting point for the package structure have been created.
Please, note that the fitting procedure is still maybe not the most user friendly, as I kept printRhoSamples.py, that Alessandro wrote, to print the bootstrap samples that then will be used to perform fits.
Also, I would suggest to check if there are modifications needed in printRhoSamples.py for the Bayesian processes.
The code 'runInverseProblem.py' runs and I have been able to perform a fit from that output.