implementing #709 requests#726
Conversation
|
@Swanson-Hysell If this looks okay, would you like this implemented in |
Yeah. Well, sort of. I believe the input arrays are being regularized (delta = 1) up until the last pair of values. I don't think that this has much affect on the behavior of the function result, so we could remove the warning, I suppose. Better yet would be to figure out how to continue the regularization through the whole array...which I'm working on.
Yes. I think that's a good idea. Including your most recent comment as far as approaches goes. I can work on this over the weekend.
Right. I think eventually the function should have some comprehensive approaches and only needs to live in one module. |
Right. That's been the implementation in the software for a while. Can see it in the 1998 textbook version. I think, looking at Fabian et al., 2013 Figure 8 that it probably does okay. But I think adjusting it is in our best interest going forward. So, a summary on the methods to implement:
It would be pretty easy to modify the function to address 1 and 3 together, really just a matter of reporting the minimum of the first derivative instead of the maximum of the second derivative. I have to see what exactly is up with the smoothing function.
Yes, this can be added as well, I think. I'll play around with these additions. |
|
Okay, whew. I've rewritten the function so that it gives the Curie point estimate based on first derivative min and second derivative zero crossing. Also, the interpolation for irregular input is better, that error is gone. The plotting is now done by I don't think the two tangent method is necessary, since it isn't particularly good for susceptibility data. The current iteration is probably a viable point to provide an update to the ipmag.curie() function. I haven't implemented the inverse susceptibility operability yet. Trying to figure out if it makes sense to let a user pick a linear section or to linefind through the 1/kT curve for them. Options, options. |
|
@Swanson-Hysell I have now added the option to use inverse susceptibility. It is called by setting There is an additional import added to
And a small additional utility function called The basic flow of the addition is:
|
|
I will dig into this tomorrow. What are your thoughts on having this as an option within a single function (which I know is what I originally suggested) vs having it be its own function. Given how many specific parameters for the inverse susceptibility analysis the user needs to provide, it seems like it might work better was its own function. |
|
The overall function does end up pretty busy. However, there isn't much the user needs to do, necessarily. The inverse_sus flag is probably the most involved piece by a fair degree. So...yeah. I think its reasonable break it out into its own function. Let me know if you want that to happen and it should be easy enough to implement. |
|
Okay, the inverse method is now broken out into its own function as suggested. |
|
Any improvements wished, @Swanson-Hysell? |





So, I made a few changes as related to #709.
I implemented the derivative calculation using np.gradient() docs. This uses second-order accurate central differences for interior points. It also runs over the entire array which removes some of the messy T-1, T-2 parametesr throughout. Running the test case:
ipmag.curie(file_name='curie_example.dat', window_length=10)shows identical behavior to the previous implementation with a slight difference in the maximum probably related to the T-array shift.I switched order of two docstring parameters to mirror the function and put 10 as the default window length.
I commented out the
sys.quit()line (so it's now just a warning, and doesn't quit the function) and moved that warning farther down the chain of loops to allow the earlier data interpolations to work.Two minor changes to account for numpy updates (np.float64 in
ipmag.curie()and np.ones inipmag.smooth().I've also tested this with an irregularly spaced example file curie_irregular.txt, and it works as well. Kicks out one warning for the last pair of values, but behaves otherwise.