test/func: created a test and function for MorphFuncy#186
test/func: created a test and function for MorphFuncy#186sbillinge merged 2 commits intodiffpy:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #186 +/- ##
==========================================
+ Coverage 96.99% 97.11% +0.12%
==========================================
Files 19 20 +1
Lines 831 866 +35
==========================================
+ Hits 806 841 +35
Misses 25 25
🚀 New features to boost your workflow:
|
sbillinge
left a comment
There was a problem hiding this comment.
wow, fantastic. I few tiny cosmetic comments, but you nailed it in one shot as far as I can tell!
| import pytest | ||
|
|
||
| from diffpy.morph.morphs.morphfuncy import MorphFuncy | ||
|
|
There was a problem hiding this comment.
I think these functions would be better with single blank lines between them.
There was a problem hiding this comment.
I am trying to delete these but every time I commit the files are modified by the hooks. I think this is the pre-commit?
There was a problem hiding this comment.
OK,, we can let it slide. It is because normally we want the functions well separated, but wehn we are defining a bunch of them for testing we just want them kind of closed up, but it is not a big deal.
Just fix the docstring and I can merge this.
| morph = MorphFuncy() | ||
| morph.function = function | ||
| morph.parameters = parameters | ||
| x_morph_actual, y_morph_actual, x_target_actual, y_target_actual = ( |
There was a problem hiding this comment.
Is there a reason you have the function call inside parens? It should work the same way without these and this is somewhat unconventional and therefore distracting?
There was a problem hiding this comment.
This is same as comment above, this is modified by the hooks.
| ------- | ||
| Import the funcy morph function: | ||
| >>> from diffpy.morph.morphs.morphfuncy import MorphFuncy | ||
| Define or import the user-supplied transformation function: |
There was a problem hiding this comment.
I wonder if this would be easier to read with judiciously placed blank lines, maybe after each code block, but play around till it looks nice? I am not sure if there is a docstring standard for this, in which case follow it, but if not, then I think a few blank lines could increase readability.
|
Thanks Simon! This is your mentoring ... after MorphSqueeze I did learn a lot. |
| import pytest | ||
|
|
||
| from diffpy.morph.morphs.morphfuncy import MorphFuncy | ||
|
|
There was a problem hiding this comment.
OK,, we can let it slide. It is because normally we want the functions well separated, but wehn we are defining a bunch of them for testing we just want them kind of closed up, but it is not a big deal.
Just fix the docstring and I can merge this.
|
@sbillinge should I work on MorphFuncx? Do we want to do the same as MorphFuncy but applied to the x-axis and then return the morphed data in the same grid as the input morph data? It would also be good if I could see the code for PDFgetX3, I can't find it in github. |
I do want this functionality in the fullness of time, and it should be relatively straightforward because we have the squeeze morph that uses a "particular" function which was the polynomial. So it should be relatively quick, almost a copy-paste. However, I would rather push next to see if we can figure out how to use a getX3 function to do the moprh onto the synchrtron data...... |
Sounds great to me! |
|
let me go and dig that up. This code is not open source..... |
I have created a draft for the
MorphFuncyclass and tested it using different functions with various parameters that I have defined usingpytest.parametrize. I am currently defining the parameters for the functions as a dictionary, where each function has its specific parameters. I'm unsure if using a dictionary is the best decision. We can implement more options such as if the user does not provide a function to raise a warning or something similar.