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

stitching #29

Merged
merged 5 commits into from
Nov 16, 2020
Merged

stitching #29

merged 5 commits into from
Nov 16, 2020

Conversation

Sniper2k
Copy link
Contributor

@Sniper2k Sniper2k commented Oct 13, 2020

Contributor Checklist:

@uellue
Copy link
Member

uellue commented Oct 23, 2020

Hi Oleh, thanks again for this pull request! As next step, we can work on two items:

Filename: test_stitching.py somewhere under the tests/ top-level directory in this repo.

import numpy as np

import stitch from ptychography.stitching.stitching


def test_stitching():
    known_good = ...
    your_result = stitch(...)
    assert np.allclose(known_good, your_result)

Basically a function that will throw an exception in case the actual result is different from the known good one. Pytest can do a lot more for complex test scenarios, but I think in this case the basic pattern will do just fine. :-)

You can run it like this: pytest tests/<path>/test_stitching.py

@Sniper2k
Copy link
Contributor Author

Hi Dieter,

I added a test file, base on your template and fixed my name & email.
I had a problem testing it with pytest.

First, it was missing utils.py file. I copied it from libertem repository
image

Then, it was trying to access SharedData function in libertem.web.server, which is not there.
image

Not sure, what I can do to make it work.

@uellue uellue mentioned this pull request Oct 30, 2020
4 tasks
@uellue
Copy link
Member

uellue commented Oct 30, 2020

Hi @Sniper2k, I just merged #25 that also included changes to the testing setup which should fix the issues you experienced.

In order to apply these changes to your branch, you can rebase your branch on the current master:

  • Remove the utils.py file again
  • Stash or commit any local changes (git status to see modified files, git stash to stow away changes to re-apply later)
  • Check out the master branch of your fork
  • git pull --ff-only upstream master to update your master branch to upstream. The --ff-only makes sure that you get an error message in case the two repos have diverged.
  • git push the master branch of your fork to GitHub to keep it in sync
  • Check out your working branch again
  • git rebase master to rebase your branch onto your updated master branch
  • If applicable, git stash apply to re-apply any stashed changes.
  • See if this updates fixes the issues you are experiencing
  • Finally, git push --force your updates to GitHub. Just doing git push without --force will give you an error message that suggests doing git pull, which you shouldn't do in this situation. Rebasing rewrites the commit history, and pulling in the previous history would mess things up. Force pushing forces your local changes to the target repo at GitHub, which is what we want here. [As a side note: A git reset --hard is required for anybody who has that branch checked out and wants to update it after you force-pushed -- same process, just pulling in the rewritten history instead of pushing it out.]

@Sniper2k
Copy link
Contributor Author

Hi @uellue,

Thanks for the detailed explanation!
I checked and test works and exits with success now.

@uellue
Copy link
Member

uellue commented Oct 30, 2020

Great to hear, looks good to me! @sk1p , @SimeonEhrig would you also like to do a code review or do you think this can be merged like that?

Copy link
Contributor

@sk1p sk1p left a comment

Choose a reason for hiding this comment

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

Looks good to me! The comments on the stitch function could be put into a docstring (https://numpydoc.readthedocs.io/en/latest/format.html), but that's mostly cosmetics.

src/ptychography/stitching/stitching.py Outdated Show resolved Hide resolved
Co-authored-by: Alexander Clausen <alex@gc-web.de>
@uellue
Copy link
Member

uellue commented Nov 16, 2020

@Sniper2k if this is ready for merging also from your perspective, you can mark it as "ready for review", i.e. not a draft PR anymore. :-)

@Sniper2k Sniper2k marked this pull request as ready for review November 16, 2020 13:29
@uellue uellue merged commit 511d390 into Ptychography-4-0:master Nov 16, 2020
@uellue
Copy link
Member

uellue commented Nov 16, 2020

Thank you, merging! 🚀

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