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
Added support for complex data #1058
Conversation
--HG-- branch : new_signals
Pull 19. May
Merge 25.05.2016
Merge 03.06.16
Don't forget the docs! :-) Looking forward to this. |
You're right, I forgot about the docs. I'll try to add as much as I can, again @FWin22 and @woozey, please update the .rst-files in the doc folder when you later add functions :-). |
I've just had a very quick look at this, so take my comments with a pinch of salt.
|
Thanks for the feedback!
|
@CodeMonkeyJan Signal1D/Signal2D went only in to 0.8.x so far and are in PR #1033 to go in to the master. You do need to work off of the master (not 0.8.x) as you have done it's just unfortunate that this came about the same time as the Signal1D/Signal2D merge.... The upshot is that we need to merge #1033 as soon as possible - unfortunately this has been stalled as we were finishing 0.8.5 for a workshop next Tuesday and even more unfortunately more things were added to 0.8.x and master after I made that PR... So now the PR branch needs conflicts resolving and then review. Feel free to add things to / review that PR though if you want to make this go faster. |
deepcopying inside the unwrapping method seems fine to me. If the numpy function does not operate in ndim, you could also use hspy's Regarding skimage, currently it is an optional package. It probably should be promoted to a required package as some other PRs use functions from them. To add the extra dependency you'll have to edit |
Added skimage as a recquirement. Properties now return HyperSpy Images.
…he tests. On different machines the unwrapped phase could be shifted by 2pi (which is still correct) but gives errors during testing. The test now has a seed to eliminate RNG effect and tests a more symmetric wrapped phase.
|
class TestSignalAssignSubclass: | ||
|
||
def test_signal(self): | ||
assert_true(assign_signal_subclass( |
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 could use assert_is
instead. The same goes for all other tests in this class.
Thanks for all the feedback, everything should be implemented now :-). I added the I left Or something completely different (which is the idea I'm going with at the moment): Now that we have a This also means that this PR no longer has anything to do with electron holography and purely adds complex functionality, so I'll change the title accordingly. Oh what a journey it's been :-). In my personal opinion, adding |
User guide is updated accordingly Plot docstrings are now defined in hyperspy/docstings/plot.py A lot of smaller changes
Great, I think that this is almost ready now. I only disagree with not adding the class CommonSignal1D:
def to_image
class Signal1D(BaseSignal, CommonSignal1D):
class ComplexSignal1D(ComplexSignal, CommonSignal1D): The goal is to avoid code duplication. |
Sorry, I think I misunderstood you :-)... Having those classes purely as interfaces seems fine to me (I think that should be the way I implemented them). |
I think that this is ready to merge, do you agree? |
I'd say yes, all tests run fine on my system, but I'd wait until at least one of the builds finishes, because I changed: if 'complex' in data.dtype.name: to the (in my opinion) more elegant numpy solution (which I just found today): if np.issubdtype(data.dtype, complex) so I did not just change some text in |
Everything should be fine now, from my point everything is ready :-)! |
Happy to merge this awesome contribution. |
@CodeMonkeyJan, it seems that several of the files in the PR contain windows line endings. For any new contribution, could configure your local git as explained here to avoid compatibility issues? |
Oh, I thought I had already done that, apparently I didn't fix that after re-forking HyperSpy, thanks for letting me know! |
As discussed in #787 I added the two classes for hologram and wave images.
As stated there, HologramImage is nearly empty and WaveImage has some basic functionality (convenience properties and a few functions).
There are a lot of TODOs in the code which in part hold a few things I could still do, for example making the functions work with image stacks. For this I would like to ask what the proper implementation for iterating over the images in the stack in HyperSpy would be. Any ideas?
Other TODOs include names of colleagues of mine (@FWin22 and @woozey), whose tasks it would be (after a successful merge) to fill the two classes with life :-)!
I also added a few basic tests.
I know this PR is in an early state, but maybe you could give me input what could be improved.
I'll track the required course of action here: