xfel.command_line package

Submodules

xfel.command_line.auto_submit module

xfel.command_line.auto_submit.match_runs(dir, use_in_progress)
xfel.command_line.auto_submit.run(args)

xfel.command_line.brehm_diederichs module

xfel.command_line.brehm_diederichs.run(args)

xfel.command_line.cbf_average module

xfel.command_line.cbf_average.run(argv=None)

Compute mean, standard deviation, and maximum projection images from a set of CSPAD cbf images given on the command line.

@param argv Command line argument list @return @c 0 on successful termination, @c 1 on error, and @c 2

for command line syntax errors

xfel.command_line.cluster_42 module

xfel.command_line.cluster_intensity_statistics module

xfel.command_line.cluster_per_frame_wilson module

xfel.command_line.cluster_unit_cell module

xfel.command_line.cluster_visualise_orientations module

xfel.command_line.convert_gain_map module

xfel.command_line.convert_gain_map.convert_2x2(data)
xfel.command_line.convert_gain_map.convert_detector(raw_data, detector_format_version, address, optical_metrology_path=None)
class xfel.command_line.convert_gain_map.fake_config

Bases: object

quadMask()
roiMask(i)
sections(i)
class xfel.command_line.convert_gain_map.fake_cspad_ElementV2(data, quad)

Bases: object

data()
quad()
class xfel.command_line.convert_gain_map.fake_env(config)

Bases: object

getConfig(Id, address)
class xfel.command_line.convert_gain_map.fake_evt(data3d)

Bases: object

getCsPadQuads(address, env)
getTime()
xfel.command_line.convert_gain_map.fake_get_config(address, env)
xfel.command_line.convert_gain_map.run(args)

xfel.command_line.convert_gain_map_cbf module

xfel.command_line.convert_gain_map_cbf.convert_detector(raw_data)
xfel.command_line.convert_gain_map_cbf.run(args)

xfel.command_line.cxi_apply_metrology module

xfel.command_line.cxi_cspad_pinwheel module

xfel.command_line.cxi_cspad_pinwheel.run(argv=None)

xfel.command_line.cxi_diff module

xfel.command_line.cxi_diff.run(args)

xfel.command_line.cxi_display_metrology module

xfel.command_line.cxi_generate_circular_gain_mask module

xfel.command_line.cxi_image2pickle module

xfel.command_line.cxi_index module

xfel.command_line.cxi_lsf module

xfel.command_line.cxi_lsf.run(argv=None)

xfel.command_line.cxi_merge module

exception xfel.command_line.cxi_merge.OutlierCellError

Bases: Exception

exception xfel.command_line.cxi_merge.WrongBravaisError

Bases: Exception

xfel.command_line.cxi_merge.consistent_set_and_model(work_params, i_model=None)
xfel.command_line.cxi_merge.get_boundaries_from_sensor_ID(sensor_ID, detector_version_phil=None, image_with_header=None)
xfel.command_line.cxi_merge.get_observations(work_params)
xfel.command_line.cxi_merge.load_result(file_name, ref_bravais_type, reference_cell, params, reindex_op, out, get_predictions_to_edge=False, image_info=None, exclude_CSPAD_sensor=None)
xfel.command_line.cxi_merge.plot_overall_completeness(completeness)
class xfel.command_line.cxi_merge.plot_statistics(prefix, unit_cell_statistics, reference_cell, correlations, min_corr, rejected_fractions, frame_d_min)

Bases: object

Container for assorted histograms of frame statistics. The resolution bin plots are stored separately, since they can be displayed using the loggraph viewer.

plot_statistics_histograms(figure, n_slots=20)
plot_unit_cell_histograms(figure, a_values, b_values, c_values, n_slots=20, title='Distribution of unit cell edge lengths')
show_all_pyplot(n_slots=20)

Display histograms using pyplot. For use in a wxPython GUI the figure should be created separately in a wx.Frame.

class xfel.command_line.cxi_merge.resolution_bin(i_bin=None, d_range=None, d_min=None, redundancy_asu=None, redundancy_obs=None, redundancy_to_edge=None, absent=None, complete_tag=None, completeness=None, measurements=None, predictions=None, mean_I=None, mean_I_sigI=None, sigmaa=None)

Bases: object

xfel.command_line.cxi_merge.run(args)
class xfel.command_line.cxi_merge.scaling_manager(miller_set, i_model, params, log=None)

Bases: intensity_data

add_frame(data)

Combine the scaled data from a frame with the current overall dataset. Also accepts None or null_data objects, when data are unusable but we want to record the file as processed.

finalize_and_save_data()

Assemble a Miller array with the summed data, setting the unit cell to the consensus average if desired, and write to an MTZ file (including merged/non-anomalous data too).

get_overall_correlation(sum_I)

Correlate the averaged intensities to the intensities from the reference data set. XXX The sum_I argument is really a kludge!

get_plot_statistics()
reset()
scale_all(file_names)
scale_frame(file_name, db_mgr)

The scale_frame() function populates a back end database with appropriately scaled intensities derived from a single frame. The mark0 scaling algorithm determines the scale factor by correlating the frame’s corrected intensities to those of a reference structure, while the mark1 algorithm applies no scaling at all. The scale_frame() function can be called either serially or via a multiprocessing map() function.

@note This function must not modify any internal data or the

parallelization will not yield usable results!

@param file_name Path to integration pickle file @param db_mgr Back end database manager @return An intensity_data object

scale_frame_detail(result, file_name, db_mgr, out)
show_unit_cell_histograms()
static single_reflection_histograms(obs, ISIGI)
sum_intensities()
class xfel.command_line.cxi_merge.scaling_result(**keyword_arguments)

Bases: group_args

Container for any objects that might need to be saved for future use (e.g. in a GUI). Must be pickle-able!

xfel.command_line.cxi_merge.show_overall_observations(obs, redundancy, summed_wt_I, summed_weight, ISIGI, n_bins=15, out=None, title=None, work_params=None, redundancy_to_edge=None)
class xfel.command_line.cxi_merge.unit_cell_distribution

Bases: object

Container for collecting unit cell edge length statistics - both for frames included in the final dataset, and those rejected due to poor correlation. (Frames with incompatible indexing solutions will not be included.)

add_cell(unit_cell, rejected=False)
add_cells(uc)

Addition operation for unit cell statistics.

get_average_cell_dimensions()
show_histograms(reference, out, n_slots=20)

xfel.command_line.cxi_optical2cbfheader module

xfel.command_line.cxi_pbs module

xfel.command_line.cxi_pbs.run(argv=None)

xfel.command_line.cxi_pickle2cbf module

xfel.command_line.cxi_plotcv module

Main idea: go through the integration log files and grep out the difference vectors between observed and predicted spot positions. Plot these “correction vectors”, but do so separately for each ASIC tile, giving an independent check on whether a tile is positioned properly by the tile_translation parameters.

xfel.command_line.cxi_plotcv.run(args)

xfel.command_line.cxi_psana module

xfel.command_line.cxi_psana.run(args)

xfel.command_line.cxi_pyana module

xfel.command_line.cxi_pyana.run(args)

xfel.command_line.cxi_spots module

xfel.command_line.cxi_stream_to_pickle module

Utility for converting stream files from CrystFEL version 0.5.3 to cctbx.xfel pickle files.

xfel.command_line.cxi_stream_to_pickle.check_image(image)
xfel.command_line.cxi_stream_to_pickle.crystfel_to_cctbx_coord_system(abasis, bbasis, cbasis)

CrystFEL is RHS with z down the beam, and y to the ceiling. CCTBX.Postrefine is RHS with z to the source, and y to the ceiling.

xfel.command_line.cxi_stream_to_pickle.image_template()
xfel.command_line.cxi_stream_to_pickle.make_int_pickle(img_dict, filename)
xfel.command_line.cxi_stream_to_pickle.unit_cell_to_symetry_object(img_dict)

xfel.command_line.cxi_view module

xfel.command_line.cxi_xmerge module

xfel.command_line.cxi_xmerge.run(args)
class xfel.command_line.cxi_xmerge.xscaling_manager(miller_set, i_model, params, log=None)

Bases: scaling_manager

read_all_mysql()
scale_all()

xfel.command_line.get_next_trial_id module

xfel.command_line.grid_index module

xfel.command_line.histogram_finalise module

xfel.command_line.list_db_metadata module

xfel.command_line.list_db_metadata.run(args)

xfel.command_line.make_mask module

xfel.command_line.make_mask.point_in_polygon(point, poly)

Determine if a point is inside a given polygon or not. Polygon is a list of (x,y) pairs. Code adapted from a dials polygon clipping test algorithm

xfel.command_line.make_mask.point_inside_circle(x, y, center_x, center_y, radius)

Determine if a given point (x,y) is inside a circle whose center is at (center_x,center_y) with radius x.

xfel.command_line.make_mask.run(argv=None)

xfel.command_line.metrology module

xfel.command_line.metrology.get_phil(args)
xfel.command_line.metrology.run(args)
xfel.command_line.metrology.validate_phil(wp)

xfel.command_line.monitor_detectors module

xfel.command_line.monitor_trials module

xfel.command_line.overlay_spectra module

xfel.command_line.overlay_spectra.estimate_signal_to_noise(x, y)
xfel.command_line.overlay_spectra.full_width_half_max(x, y)
xfel.command_line.overlay_spectra.run(args)

xfel.command_line.plot_to_subpixel module

xfel.command_line.plot_to_subpixel.run(input=None)

xfel.command_line.postrefine module

xfel.command_line.postrefine.determine_mean_I_mproc(frame_no, frame_files, iph)
xfel.command_line.postrefine.postrefine_by_frame_mproc(frame_no, frame_files, iph, miller_array_ref)
xfel.command_line.postrefine.read_input(args)
xfel.command_line.postrefine.scale_frame_by_mean_I_mproc(frame_no, frame_files, iph, mean_of_mean_I)

xfel.command_line.print_pickle module

xfel.command_line.print_pickle.generate_data_from_streams(args, verbose=False)
xfel.command_line.print_pickle.generate_streams_from_path(tar_or_other)
xfel.command_line.print_pickle.keywise_printout(data)

xfel.command_line.quadrants module

xfel.command_line.quadrants.view_raw_image(path, *command_line, **kwargs)

xfel.command_line.radial_average module

xfel.command_line.radial_average.apply_sub_pixel_metrology(tile, x, y, tcx, tcy, phil, handedness=0)
xfel.command_line.radial_average.distance(a, b)
xfel.command_line.radial_average.get_tile_center(tiles, tile)
xfel.command_line.radial_average.get_tile_coords(tiles, tile)

returns x1, y1, x2, y2

xfel.command_line.radial_average.get_tile_id(tiles, x, y)
xfel.command_line.radial_average.run(args, source_data=None)
xfel.command_line.radial_average.show_tiles(the_tiles, img, phil, bc, handedness=0)

xfel.command_line.smooth_spectrum module

xfel.command_line.smooth_spectrum.estimate_signal_to_noise(x, y_noisy, y_smoothed, plot=False)

Estimate noise in spectra by subtracting a smoothed spectrum from the original noisy unsmoothed spectrum.

See:

The extraction of signal to noise values in x-ray absorption spectroscopy A. J. Dent, P. C. Stephenson, and G. N. Greaves Rev. Sci. Instrum. 63, 856 (1992); https://doi.org/10.1063/1.1142627

xfel.command_line.smooth_spectrum.fourier_filter(x, y, cutoff_frequency)
xfel.command_line.smooth_spectrum.interpolate(x, y, half_window=10)
xfel.command_line.smooth_spectrum.pyplot_label_axes(xlabel='Pixel column', ylabel='Intensity', fontsize=20)
xfel.command_line.smooth_spectrum.run(args)

xfel.command_line.subtract_background module

xfel.command_line.subtract_background.run(args)
xfel.command_line.subtract_background.signal_to_noise_statistical(signal, background)

M.F. Koenig and J.T. Grant, Surface and Interface Analysis, Vol. 7, No.5, 1985, 217

xfel.command_line.subtract_background.subtract_background(signal, background, plot=False)

xfel.command_line.trial_stats module

xfel.command_line.trial_stats.run(args)

xfel.command_line.view_pixel_histograms module

exception xfel.command_line.view_pixel_histograms.PixelFitError

Bases: RuntimeError

xfel.command_line.view_pixel_histograms.check_pixel_histogram_fit(hist, gaussians)
xfel.command_line.view_pixel_histograms.hist_outline(hist)
class xfel.command_line.view_pixel_histograms.pixel_histograms(histograms, estimated_gain=30)

Bases: object

fit_one_histogram(pixel, n_gaussians=2)
pixels()
plot(pixels=None, starting_pixel=None, fit_gaussians=True, n_gaussians=2, window_title=None, log_scale=False, save_image=False)
plot_gaussians(pixel, n_gaussians=2, log_scale=False)
plot_one_histogram(histogram, window_title=None, title=None, log_scale=False, normalise=False, save_image=False)
single_peak_fit(hist, lower_threshold, upper_threshold, mean, zero_peak_gaussian=None)
xfel.command_line.view_pixel_histograms.run(args)
xfel.command_line.view_pixel_histograms.sliding_average(y, n=3)

xfel.command_line.xes_finalise module

xfel.command_line.xes_histograms module

Module contents