-
Notifications
You must be signed in to change notification settings - Fork 10
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
Multi slice: simulate image from exit wave (apply ctf, detector dqe, ntf, poisson shot noise) #3
Conversation
I looked through the deepsource failures. Is there an automated tool for style I can use in git hub? |
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 nice! It would have been better to split this into 2 PRs:
- one with the files about the continuous integration
- one with the science files.
But this is fine for this one!
I've put some comments but they're very minor.
About DeepSource:
- you can use
flake8
in your command line to spot deepsource errors in advance - you can use
black
andisort
to automatically correct your files for these errors (isort focuses on cleaning the import order).
It can be that deepsource and the formatting by black or isort
-
- are not equal: i.e. deepsource could be more restrictive
-
- disagree.
If this is the case, can you let me know? We would need to clean up the infrastructure of the package in this case.
- disagree.
We don't know at this point if the unit-tests pass, since you have just added the .yml file. When we merge this PR, we should see what they give and be ready to submit a followup HOTFIX" PR if any of the tests fail.
Thank you very much, this is great! 🎉
.github/workflows/build.yml
Outdated
matrix: | ||
os: [ubuntu-18.04] | ||
python-version: [3.7,3.8,3.9] | ||
test-folder : ['tests.test_multislice'] |
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.
test_multisclice.py
is a file.py and a folder, thus I don't really know if this will work, but let's try!
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.
there's actually just tests/tests_multislice.py
, so I will change it to test-folder : ['tests']
. I misread the template yml I was using: https://github.com/compSPI/ioSPI/blob/master/.github/workflows/build.yml#L27
"""Exit wave to image (ctf, detector dqe/ntf, and poisson shot noise). | ||
|
||
Convolution of (ctf, detector dqe/ntf,) with exit wave. | ||
Incorporates Poisson shot noise and the collapse of the wave 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.
Use the following syntax for references in the docstrings:
https://github.com/geomstats/geomstats/blob/90d9954f525fe6e5b6da625205657675a3baa830/geomstats/geometry/stiefel.py#L161
It allows to render kinda well on the (future) documentation website:
https://geomstats.github.io/geometry.html#geomstats.geometry.stiefel.StiefelCanonicalMetric.inner_product
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.
ok!
src/multislice.py
Outdated
Parameters | ||
---------- | ||
exit_wave_f : numpy.ndarray, shape (N,N) | ||
exit wave array. |
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.
NIT: Uppercase letter on the description of the parameters: we are just enforcing this so that all the docstrings parameters descriptions have the same convention, because that's how the (future) doc website will look clean too.
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.e. Exit wave array.
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.
ok!
@geoffwoollard another very minor comment : next time, could you put a PR's title and description that are a bit more informative? This will help
|
I fixed most of the style issues with black and isort. I think it should be good enough. I made the PR title more informative. I still need direction on how to import from ioSPI. I can do a separate PR for that, where I actually move the files around, once I know where everything should go. As things are, I think all the tests will fail, because they rely on |
@fredericpoitevin should I merge the pull request? |
@geoffwoollard looking great! Let's ignore the deepsource issues:
|
To import from ioSPI, add a line in the build.yml to import ioSPI from its github. You can find inspiration here: Basically, we want the unit tests to know about the github master of ioSPI, so we need to installing via Git in the build.yml |
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.
Actually, instead of hard-coding the import of ioSPI in the build.yml, you can install it via the simSPI.yml
- name: install dependencies | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
$CONDA/bin/conda env update --file simSPI.yml --name base |
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.
@geoffwoollard you can install ioSPI as a dependenci in simSPI.yml using pip.
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 under dependencies
in simSPI.yml I'm adding git+https://github.com/comSPI/ioSPI.git
, where something like numpy
would usually go. This will need me to put in fourier.py
into that, and make sure it installs (add in dependencies, etc)... I'll get another PR going for that.
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.
Looking good! I haven't tried to simulate anything yet, but the code is very readable, thanks
tests/test_multislice.py
Outdated
assert np.allclose(i / high_dose, exit_wave, atol=1e-4) | ||
|
||
|
||
test_exit_wave_to_image() |
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.
Is it necessary to execute the function explicitely?
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'll remove that. I see you didn't do that in https://github.com/compSPI/ioSPI/blob/master/tests/test_iotools/test_atomic_models.py
I didn't make it a class...
I meant to work on this before, did not find the time yet. Once we are happy with a mechanism to have the various compSPI repos working with one another, we can document it in compSPI/compSPI. |
I'm confused, I do not see those issues... See below what I can see: @geoffwoollard I think those issues could be addressed prior merging. |
I think the assert in tests was removed somehow. I used to see it, but it went away. I resolved all deepsourse issues that I can see. |
@geoffwoollard @fredericpoitevin yes I made deepsource ignored these errors automatically |
I use
ioSPI/ioSPI/fourier.py
insimSPI/src/multislice.py
I'm not sure how to import fourier into multislice.py, so just put https://github.com/geoffwoollard/simSPI/blob/multi_slice/src/multislice.py#L1 for now
If I have functions to test in
simSPI/src/multislice.py
simSPI/tests/test_multislice.py
?Once this PR is working, I can remove fourier.py and other things around. But let's just get things working in simSPI first, and then I'll make some other branches on ioSPI and compSPI and clean things up.