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

Include 2D data treatment #10

Merged
merged 5 commits into from
Jul 16, 2018
Merged

Conversation

mpmdean
Copy link
Contributor

@mpmdean mpmdean commented Jul 14, 2018

2D RIXS data treatment routines.
Plotting functions are now in a different module.
if name == “main” test removed
Slightly changed in order to use numpy.fitpoly. The lmfit dependency has been removed.
Example notebooks are saved without them having been run.

@mpmdean
Copy link
Contributor Author

mpmdean commented Jul 14, 2018

This "This branch has conflicts that must be resolved" is a new situation for me, but I will follow (quasi-blindly) the suggestions github sent me.

@mpmdean
Copy link
Contributor Author

mpmdean commented Jul 14, 2018

Trying closing and making the pull request again

@codecov-io
Copy link

codecov-io commented Jul 15, 2018

Codecov Report

Merging #10 into master will increase coverage by 15.87%.
The diff coverage is 99.12%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #10       +/-   ##
===========================================
+ Coverage   43.26%   59.13%   +15.87%     
===========================================
  Files           3        4        +1     
  Lines         282      394      +112     
===========================================
+ Hits          122      233      +111     
- Misses        160      161        +1
Impacted Files Coverage Δ
rixs/tests/test_process2d.py 100% <100%> (ø)
rixs/process2d.py 98.38% <98.38%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 110a036...bc9fc69. Read the comment docs.

@danielballan
Copy link
Member

Rebased, because that's what we do for fun on a Saturday night at a SciPy conference. Rebasing across a reversion commit is a pretty rough first encounter with "This branch has conflicts that must be resolved", so I'm happy to take this one.

@danielballan
Copy link
Member

I tacked on a commit undoing the pytest.fixture usage because it wasn't actually doing anything. Am I right in think that that was inspired by this documentation? I will improve the documentation. A plain function is perfectly fine in this case.

@awalter-bnl
Copy link
Contributor

I asked for the @pytest fixture based on a review by @danielballan of other code I have done. If he thinks it isn't necesary here I am happy with that. (@danielballan perhaps at some point we can go over when/where to use pytest fixtures because it appears I am still not fully understanding that.

Copy link
Contributor

@awalter-bnl awalter-bnl left a comment

Choose a reason for hiding this comment

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

I think we are getting very close with this set of code now. I have only suggested a few minor changes this time around

@@ -0,0 +1,240 @@
""" Functions for processing 2D Image data.

Typical command line workflow is executed in run_rest()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we had discussed removing 'run_test()' so this should be updated with an actual typical comand line workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess there are a few different ways to guide the user here regarding how the package should be used. I think it would be better to delete this line and include this in the sphynx documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, this is a better option for a detailed discussion of how to run the software

def estimate_elastic_pos(photon_events, x_range=(0, 20), bins=None):
"""
Estimate where the elastic line is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should remove one of these empty lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure


def make_fake_image(curvature, elastic_y, sigma=2, noise=0.002):
"""Make a fake list of photon events.
Parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we are missing a blank line here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove

return elastic_y_value


def extract(photon_events, curvature, bins=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still not very keen on this function being called 'extract' as I think it makes reading code using this confusing.
Is there a reason this can't be renamed to something that more accurately describes it's function, a suggestion (but something else that is clearer is also welcomed) is 'apply_curvature'... This matches well with the other names used here (get_curvature_offset, fit_curvature, ....).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to apply_curvature

curvature : array
The polynominal coeffcients describing the image curvature.
These are in decreasing order e.g.
curvature[0]*x^2 + curvature[1]*x^1, + curvature[2]*x^0,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think placing this inside a code-block will be a good idea: this can be done using the syntax:
.. code-block:: python
curvature[0]*x^2 + curvature[1]*x^1 + curvature[2]*x^0

Alternatively it could be done inside as math, with the same syntax as above but with 'code-block:: python' replaced with 'math::'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do. Since this line is now code rather than just an illustration. I will change ^ to **

.. code-block:: python
   curvature[0]*x**2 + curvature[1]*x**1 + curvature[2]*x**0

@danielballan
Copy link
Member

Looks good to me.

Copy link
Contributor

@awalter-bnl awalter-bnl left a comment

Choose a reason for hiding this comment

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

For me I think this is fine to merge now.

@stuartcampbell stuartcampbell merged commit d804e96 into scikit-beam:master Jul 16, 2018
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.

5 participants