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

Provide example of CHX'sCSV of XPCS output format #70

Open
dylanmcreynolds opened this issue Oct 31, 2019 · 7 comments
Open

Provide example of CHX'sCSV of XPCS output format #70

dylanmcreynolds opened this issue Oct 31, 2019 · 7 comments
Assignees
Labels
Deploy at CSX Deploy Software Stack at CSX Beamline xi-cam

Comments

@dylanmcreynolds
Copy link
Collaborator

No description provided.

@dylanmcreynolds dylanmcreynolds added Deploy at CSX Deploy Software Stack at CSX Beamline xi-cam labels Oct 31, 2019
@dylanmcreynolds
Copy link
Collaborator Author

Andi, I think we talked about this a few weeks ago. Is this still on your radar?

@ambarb
Copy link

ambarb commented Dec 3, 2019

CHX uses csv files to save simple results for readback in notebooks. An example function is save_g2_general in pyCHX, but I cannot find the repo atm. Let me inquire about that. I also want to ask back to the group: Since our meeting with everyone at BNL, I thought we are going with the documents approach so I am not sure how important this item actually is in terms of meeting our objectives for January. If the .csv file is the first necessary step, I will focus on that.

Also, I think @qzhang234 and Yugang worked together on something that works for CHX and 8ID-I in terms of an HDF5 files, but I am not sure it is something we can call common to all beamlines as I haven't seen it. However, I am eager to finalize a common results file in this respect... but is that a different task?

@ambarb
Copy link

ambarb commented Dec 3, 2019

I should get access in the coming days to CHX's repo. I will follow up at that time.

@dylanmcreynolds
Copy link
Collaborator Author

@ronpandolfi and @ihumphrey, see the comment from @ambarb above. How important is getting this output format at this point?

@mrakitin
Copy link

mrakitin commented Dec 3, 2019

Andi, I added your account to the team, so you should be able to have access to https://github.com/NSLS-II/pyCHX.

@ambarb
Copy link

ambarb commented Jan 11, 2020

The CSV file format is very simple. However, it is more geared towards SAXS and not diffraction so it the CHX version is not broadly implementable. However, it can handle multiple one time results. See the code below.

I also noticed that CHX has complicated HDF5 results file option, that is far more powerful than the .csv file. However, it is not the same at 8ID-I's.

At the moment, I am a little scared of setting someone down the path of developing something we will not use. I think the larger questions for results viewings are:

  • How many options do we want?
    -- hdf5
    -- csv
    -- database retrieval
    -- nexus "XPCS RESULTS" - maybe this is the h5
  • How do we prioritize?
def save_g2_general(  g2, taus, qr=None, qz=None, uid='uid', path=None, return_res= False ):
    
    '''Y.G. Dec 29, 2016
    
        save g2 results, 
       res_pargs should contain
           g2: one-time correlation function
           taus, lags of g2
           qr: the qr center, same length as g2
           qz: the qz or angle center, same length as g2
           path:
           uid:
      
      '''    
    
    df = DataFrame(     np.hstack( [ (taus).reshape( len(g2),1) ,  g2] )  ) 
    t,qs = g2.shape
    if qr is None:
        qr = range( qs )
    if qz is None:        
        df.columns = (   ['tau'] + [str(qr_)  for qr_ in qr ]    )
    else:
        df.columns = (   ['tau'] + [ str(qr_) +'_'+ str(qz_)  for (qr_,qz_) in zip(qr,qz) ]    )
    
    #dt =datetime.now()
    #CurTime = '%s%02d%02d-%02d%02d-' % (dt.year, dt.month, dt.day,dt.hour,dt.minute)  
    
    #if filename is None:
      
    filename = uid
    #filename = 'uid=%s--g2.csv' % (uid)
    #filename += '-uid=%s-%s.csv' % (uid,CurTime)   
    #filename += '-uid=%s.csv' % (uid) 
    filename1 = os.path.join(path, filename)
    df.to_csv(filename1)
    print( 'The correlation function is saved in %s with filename as %s'%( path, filename))
    if return_res:
        return df
    ``

@ambarb
Copy link

ambarb commented Dec 16, 2020

@AbbyGi is creating the nexus file from the save CHX data that is structured like a python dictionary.

@ambarb now committing to make CSX results file as close as possible to CHX results file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deploy at CSX Deploy Software Stack at CSX Beamline xi-cam
Projects
None yet
Development

No branches or pull requests

3 participants