def run_spotfinder(O): _ = O.active_wavelengths if (_ == 1): px = O.pixels elif (_ == 2): px = O.pixels_2 else: if (O.pixels is None or O.pixels_2 is None): px = None else: px = O.pixels + O.pixels_2 px /= 2 if (px is None): return if (O.work_params.noise.max == 0): print print "WARNING:" print " noise.max = 0: spotfinder is likely to crash..." print sys.stdout.flush() dpx,dpy = O.work_params.detector.pixels if (dpx < 100 or dpy < 100): return from rstbx.simage import run_spotfinder O.spots = run_spotfinder.process( work_params=O.work_params, pixels=px, show_spots=False) O.Refresh()
def run_spotfinder(O): _ = O.active_wavelengths if (_ == 1): px = O.pixels elif (_ == 2): px = O.pixels_2 else: if (O.pixels is None or O.pixels_2 is None): px = None else: px = O.pixels + O.pixels_2 px /= 2 if (px is None): return if (O.work_params.noise.max == 0): print() print("WARNING:") print(" noise.max = 0: spotfinder is likely to crash...") print() sys.stdout.flush() dpx, dpy = O.work_params.detector.pixels if (dpx < 100 or dpy < 100): return from rstbx.simage import run_spotfinder O.spots = run_spotfinder.process(work_params=O.work_params, pixels=px, show_spots=False) O.Refresh()
def index_and_integrate_one(work_params, image_mdls_miller_indices, pixels): from rstbx.simage import run_spotfinder spots = run_spotfinder.process(work_params=work_params, pixels=pixels, show_spots=False) if (spots.size() < work_params.min_number_of_spots_for_indexing): print "Insufficient number of spots for indexing." print sys.stdout.flush() return (spots.size(), None) from rstbx.simage import run_labelit_index ai = run_labelit_index.process(work_params=work_params, spots=spots) good_i_seqs, miller_indices, co = run_labelit_index.report_uc_cr(ai) from rstbx.simage import refine_uc_cr refined = refine_uc_cr.refine( work_params=work_params, spots=spots, good_i_seqs=good_i_seqs, miller_indices=miller_indices, unit_cell=co.unit_cell(), crystal_rotation=co.crystal_rotation_matrix()) from rstbx.simage import integrate_crude predicted_spot_positions, \ predicted_spot_miller_index_i_seqs = integrate_crude.predict_spot_positions( work_params=work_params, miller_indices=image_mdls_miller_indices, unit_cell=refined.unit_cell, crystal_rotation=refined.crystal_rotation) print "Number of predicted spot positions:", predicted_spot_positions.size( ) print spot_intensities = integrate_crude.collect_spot_intensities( pixels=pixels, spot_positions=predicted_spot_positions, point_spread_inner=work_params.point_spread, point_spread_outer=work_params.point_spread + 4) sel = spot_intensities != 0 return ( spots.size(), image_model( spot_positions=predicted_spot_positions.select(sel), spot_intensities=spot_intensities.select(sel), miller_index_i_seqs=predicted_spot_miller_index_i_seqs.select(sel), unit_cell=refined.unit_cell, crystal_rotation=refined.crystal_rotation))
def index_and_integrate_one(work_params, image_mdls_miller_indices, pixels): from rstbx.simage import run_spotfinder spots = run_spotfinder.process( work_params=work_params, pixels=pixels, show_spots=False) if (spots.size() < work_params.min_number_of_spots_for_indexing): print "Insufficient number of spots for indexing." print sys.stdout.flush() return (spots.size(), None) from rstbx.simage import run_labelit_index ai = run_labelit_index.process(work_params=work_params, spots=spots) good_i_seqs, miller_indices, co = run_labelit_index.report_uc_cr(ai) from rstbx.simage import refine_uc_cr refined = refine_uc_cr.refine( work_params=work_params, spots=spots, good_i_seqs=good_i_seqs, miller_indices=miller_indices, unit_cell=co.unit_cell(), crystal_rotation=co.crystal_rotation_matrix()) from rstbx.simage import integrate_crude predicted_spot_positions, \ predicted_spot_miller_index_i_seqs = integrate_crude.predict_spot_positions( work_params=work_params, miller_indices=image_mdls_miller_indices, unit_cell=refined.unit_cell, crystal_rotation=refined.crystal_rotation) print "Number of predicted spot positions:", predicted_spot_positions.size() print spot_intensities = integrate_crude.collect_spot_intensities( pixels=pixels, spot_positions=predicted_spot_positions, point_spread_inner=work_params.point_spread, point_spread_outer=work_params.point_spread+4) sel = spot_intensities != 0 return ( spots.size(), image_model( spot_positions=predicted_spot_positions.select(sel), spot_intensities=spot_intensities.select(sel), miller_index_i_seqs=predicted_spot_miller_index_i_seqs.select(sel), unit_cell=refined.unit_cell, crystal_rotation=refined.crystal_rotation))