-
Notifications
You must be signed in to change notification settings - Fork 10
Fluctuations at High Q values #70
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
base: master
Are you sure you want to change the base?
Changes from 8 commits
deb2798
a32c3e9
c0f796c
f0d6283
2c72f54
721e492
eb28081
ed1f308
7ca4c8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import numpy as np | ||
|
|
||
| from toolz import get | ||
|
|
||
| from xpdtools.tools import avg_curvature | ||
|
|
||
| def max_intensity_mean(mean, q, **kwargs): | ||
| q_at_mean_max = ( | ||
|
|
@@ -21,6 +21,13 @@ def max_gr_mean(pdf, **kwargs): | |
| return locals() | ||
|
|
||
|
|
||
| def fluc_high_q(iq_comp, high_q_val=45, **kwargs): | ||
| q = iq_comp.pluck(0) | ||
| iq = iq_comp.pluck(1) | ||
| high_q_fluc = avg_curvature(iq, q, high_q_val) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might use the |
||
| return locals() | ||
|
|
||
|
|
||
| """ | ||
| r = pdf.pluck(0) | ||
| true_pdf = pdf.pluck(1) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -580,3 +580,30 @@ def inner(x, *args, **kwargs): | |
| return func(*args, **kwargs) | ||
|
|
||
| return inner | ||
|
|
||
|
|
||
| def avg_curvature(y, x, high_val): | ||
| """Computes the average of the curvature of a given signal past a | ||
|
||
| (currently) user provided high Q value, this will be used as the scalar | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't say what this will be used for. If it is just for that qoi it shouldn't be a separate function. If it has more broad application, it should be its own function but the docstring should just describe what it does. |
||
| representation for fluctuations at high Q values. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| y : ndarray | ||
| Dependent variable of a given signal | ||
| x : ndarray | ||
| Independent variable of a given signal | ||
| high_val : float | ||
| User-defined value start point of analysis. This should remain constant | ||
| over a scan. | ||
|
|
||
| Returns | ||
| ------- | ||
| float : | ||
| The average of curvature beyond a given high_val | ||
|
|
||
| """ | ||
| idx = np.abs(x - high_val).argmin() | ||
| first_der = np.gradient(y[idx:], x[idx:]) | ||
| sec_der = np.gradient(first_der, x[idx:]) | ||
| return np.average(np.abs(sec_der)/(1+first_der**2)**(3/2)) | ||
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 think this need docstrings.