Loop Fitting

33 views
Skip to first unread message

Sebastian Schmitt

unread,
Nov 6, 2018, 1:07:10 PM11/6/18
to pycroscopy
Dear Chris, 

I attached the code for the analysis of the files that contain the off-field loops only

your code:

usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_inds, {'labels': ['Frequency', 'DC_Offset', 'FORC_Cycle']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_vals, {'labels': ['Frequency', 'DC_Offset', 'FORC_Cycle']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_inds, {'units': ['Hz', 'V', '']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_vals, {'units': ['Hz', 'V', '']})
h5_file.flush()

adapted the .h5 files so they could be opened with the file we previously used for the on and off field loops.

The attached code is based on the BE_Processing.ipynb on github. From there I used the 

Fit loops to a function

section for the loop fitting but it seems that it cannot deal with the re-formatted files.

1) The goal would be to fit the loops for the highest voltage, so that the coerzive fields for the whole map can be extracted / plotted.

2) Further, if I try to open the current version of BE_Processing.ipynb on github, I get:

Unreadable Notebook: C:\Users\kwf\Downloads\ORNL\2018\BE_Processing (1).ipynb NotJSONError("Notebook does not appear to be JSON: '\\n\\n\\n\\n\\n\\n<!DOCTYPE html>\\n<html lang...",)

Could you please give me a hint on how to solve these issues?

Thank you very much for your kind assistance. 

Best regards, 

Sebastian
BE_single loop + averages + loop fit.html

Chris Smith

unread,
Nov 7, 2018, 9:14:38 AM11/7/18
to pycroscopy
Sebastian,

If I'm understanding you correctly, you want to make a modified version of the BELoopFitter that only fits some of the DC_Offset values.  Is this correct?  Can you not run the existing fitter on all your data?  It will take longer, but you won't need to write a new fitter.  If you have to have a new fitter, you should subclass the existing one, but you will still need to write your own version of many functions to take into account your reduction in the dataset.  You will absolutely have to re-write the I/O methods (_create_* and _get_*), and you will likely need to alter the _reshape_* methods and _get_sho_chunk_sizes.  

For you second question, downloading a notebook that you're viewing in github doesn't work properly.  We recommend using the nbviewer to both view and download individual notebooks.  You can also download the full repository from github and extract the notebooks yourself.  If these methods don't work, let me know and I'll work to find out why and get you the notebook through other means.

I hope this helps.  Please feel free to ask any other questions you may have.

Chris Smith

Sebastian Schmitt

unread,
Nov 8, 2018, 10:54:28 AM11/8/18
to pycroscopy
Dear Chris, 
running just some of the DC values or all of them does not matter, I could also take the existing fitter, time is not and issue the fileas are not very large. The problem is that it seems still my file format does not match with the BE_Processing script. I took the newest version including your modification 

usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_inds, {'labels': ['Frequency', 'DC_Offset', 'FORC_Cycle']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_vals, {'labels': ['Frequency', 'DC_Offset', 'FORC_Cycle']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_inds, {'units': ['Hz', 'V', '']})
usid.hdf_utils.write_simple_attrs(h5_main.h5_spec_vals, {'units': ['Hz', 'V', '']})
h5_file.flush()

and ran it until the loop fitting. There it gives:  
No loop fits found. Fitting now....
Loop fitting is applicable only to DC spectroscopy datasets!
(exept ValueError) so the argument given to the fitter should be of the right type but has an inappropriate value.

Is there a way we can make the input values match?

Thank you again an best regards, 
Sebastian

BE_Processing(2).html

Chris Smith

unread,
Nov 8, 2018, 12:09:13 PM11/8/18
to pycroscopy
Sebastian,

Could you comment out the try/except in the loop fitting cell so I can see what the error is that the loop fitter is throwing.

Chris Smith

Sebastian Schmitt

unread,
Nov 8, 2018, 12:48:20 PM11/8/18
to pycroscopy
Dear Chris, 
see attached with try/except.
Best regards, 
Sebastian
BE_Processing (1).html

Sebastian Schmitt

unread,
Nov 8, 2018, 12:50:12 PM11/8/18
to pycroscopy
without - try / except of course

Chris Smith

unread,
Nov 12, 2018, 9:46:38 AM11/12/18
to pycroscopy
Sebastian,

The error was in the loop fitter.  It wasn't handling the case where you only have FORC and DC_Offset dimensions properly.  It should be fixed in the latest commit to master.  Let us know if you have any other problems, questions, or suggestions.

Chris Smith

Sebastian Schmitt

unread,
Nov 13, 2018, 7:36:56 AM11/13/18
to pycroscopy
Dear Chris, 

thank you for your massage. I downloaded the newest version and ran it with together with the lines you sent me initially, unfortunately I still get an error. First it shows

Loop fitting is applicable only to DC spectroscopy datasets!

and after commenting out the try / except I get the attached result (KeyError: "Unable to open object (object 'Guess' doesn't exist)").

Would you mind trying one of the two files under study directly? In particular use the files 

C1144_2b_C75_12_0202.h5
C1144_2b_C75_12_0203.h5

in the 20180830 folder on Cypher. Maybe like this you see whether my problem comes from the code or the file?

Meanwhile I wrote a quick linear fitter for the V-axis intersections of the loops already, but fitting the entire loops would definetly help.

Thank you again, and best regards, 

Sebastian




BE_Processing.html

Chris Smith

unread,
Nov 14, 2018, 10:13:30 AM11/14/18
to pycroscopy
Sebastian,

I've been using the C1144_2b_C75_12_0202.h5 file for testing, and I am able to run it without any issues.  The problem shown in the latest html is likely due to previous failures of the loop fitter resulting in the group being created, but none of the datasets.  See if the fitter runs when you call it outside of that if statement.

Chris Smith
Reply all
Reply to author
Forward
0 new messages