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

sinogram datasets and sparse overlaps cleanup #157

Merged
merged 8 commits into from
Nov 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try to keep python2 alive
jonwright committed Nov 3, 2022
commit 6297d31f411b1ce6cf445183ae68d0534b0e611e
12 changes: 7 additions & 5 deletions ImageD11/sinograms/dataset.py
Original file line number Diff line number Diff line change
@@ -78,10 +78,11 @@ def __init__(self,
def __repr__(self):
r = []
for name in "dataroot analysisroot sample dset".split():
r.append(f'{name} = "{getattr(self, name)}"' )
r.append('%s = "%s"'%( name, getattr(self, name) ) )
r.append( 'shape = ( %d, %d)'%tuple(self.shape) )
if self.scans is not None:
r.append( f'# scans {len(self.scans)} from {self.scans[0]} to {self.scans[-1]}' )
r.append( '# scans %d from %d to %d'%(
len(self.scans), self.scans[0], self.scans[-1] ))
return "\n".join(r)


@@ -176,9 +177,10 @@ def import_imagefiles(self):
self.sparsefiles = [ name.replace( '/', '_' ).replace( '.h5', '_sparse.h5' ) for name in
self.imagefiles ]
self.shape = (self.shape[0], npts)
logging.info( f'imported {np.sum(self.frames_per_file) } lima filenames' )
logging.info( f'sinogram shape = {self.shape} imageshape = {imageshape}' )

logging.info( 'imported %d lima filenames'%( np.sum(self.frames_per_file) ) )
logging.info( 'sinogram shape = ( %d , %d ) imageshape = ( %d , %d)'%(
self.shape[0], self.shape[1], imageshape[0], imageshape[1] ) )


def import_motors_from_master(self): # could also get these from sparse files if saved
""" read the motors from the lima file
6 changes: 3 additions & 3 deletions ImageD11/sinograms/lima_segmenter.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

import sys, time, os, math, logging

from . import dataset
from ImageD11.sinograms import dataset

# Code to clean the 2D image and reduce it to a sparse array:
# things we might edit
@@ -67,11 +67,11 @@ def load(self, h5name, h5group):
elif name in pgrp:
setattr(self, name, pgrp[name][()] )
else:
logging.warning(f"Missing {name}")
logging.warning("Missing " + name )
self.setup()

def save(self, h5name, h5group):
logging.info(f'saving to {h5name}::{h5group}')
logging.info("saving to "+h5name+"::"+h5group)
with h5py.File( h5name, "a" ) as hout:
grp = hout.require_group( h5group )
for name in self.jobnames: