コード例 #1
0
ファイル: xpd_raw_pipeline.py プロジェクト: antiiles/xpdtools
mask_setting = {'setting': 'auto'}
# Default kwargs
mask_kwargs = {}
fq_kwargs = dict(dataformat='QA', qmaxinst=28, qmax=25, rstep=np.pi / 25)
pdf_kwargs = dict(dataformat='QA', qmaxinst=28, qmax=22, rstep=np.pi / 22)

# Detector corrections
raw_foreground = Stream(stream_name='raw foreground')
raw_foreground_dark = Stream(stream_name='raw foreground dark')
raw_background = Stream(stream_name='raw background')
raw_background_dark = Stream(stream_name='raw background dark')

# Get the image shape for the binner
img_shape = raw_foreground.map(np.shape).unique(history=1)
dark_corrected_foreground = (raw_foreground.combine_latest(raw_foreground_dark,
                                                           emit_on=0).starmap(
                                                               op.sub))
dark_corrected_background = (raw_background.combine_latest(raw_background_dark,
                                                           emit_on=0).starmap(
                                                               op.sub))
bg_corrected_img = (dark_corrected_foreground.combine_latest(
    dark_corrected_background,
    emit_on=0).starmap(op.sub, stream_name='background corrected img'))

# Calibration management
wavelength = Stream(stream_name='wavelength')
calibrant = Stream(stream_name='calibrant')
detector = Stream(stream_name='detector')
is_calibration_img = Stream(stream_name='Is Calibration')
geo_input = Stream(stream_name='geometry')
gated_cal = (bg_corrected_img.combine_latest(
コード例 #2
0
ファイル: main.py プロジェクト: Sasaank/xpdAn
image_name = glbl_dict['image_field']
db = glbl_dict['exp_db']
calibration_md_folder = {'folder': 'xpdAcq_calib_info.yml'}

filler = Filler(db=db)
# Build the general pipeline from the raw_pipeline
raw_source = Stream(stream_name='raw source')

# TODO: change this when new dark logic comes
# Check that the data isn't a dark
dk_uid = (FromEventStream(
    'start', (), upstream=raw_source).map(lambda x: 'sc_dk_field_uid' in x))
# Fill the raw event stream
source = (
    raw_source.combine_latest(dk_uid).filter(lambda x: x[1]).pluck(0)
    # Filler returns None for resource/datum data
    .starmap(filler).filter(lambda x: x is not None))
# Get all the documents
start_docs = FromEventStream('start', (), source)
descriptor_docs = FromEventStream('descriptor', (),
                                  source,
                                  event_stream_name='primary')
event_docs = FromEventStream('event', (), source, event_stream_name='primary')
all_docs = (event_docs.combine_latest(
    start_docs, descriptor_docs, emit_on=0, first=True).starmap(
        lambda e, s, d: {
            'raw_event': e,
            'raw_start': s,
            'raw_descriptor': d,
            'human_timestamp': _timestampstr(s['time'])
        }))
コード例 #3
0
    map_to_binner,
    generate_map_bin,
    move_center,
)

mask_setting = {"setting": "auto"}

motors = Stream(stream_name="motor positions")
raw_foreground = Stream(stream_name="raw foreground")
raw_foreground_dark = Stream(stream_name="raw foreground dark")
raw_background = Stream(stream_name="raw background")
raw_background_dark = Stream(stream_name="raw background dark")

# Get the image shape for the binner
dark_corrected_foreground = raw_foreground.combine_latest(raw_foreground_dark,
                                                          emit_on=0).starmap(
                                                              op.sub)
dark_corrected_background = raw_background.combine_latest(raw_background_dark,
                                                          emit_on=0).starmap(
                                                              op.sub)
bg_corrected_img = dark_corrected_foreground.combine_latest(
    dark_corrected_background,
    emit_on=0).starmap(op.sub, stream_name="background corrected img")

# Calibration management
wavelength = Stream(stream_name="wavelength")
calibrant = Stream(stream_name="calibrant")
detector = Stream(stream_name="detector")
is_calibration_img = Stream(stream_name="Is Calibration")
geo_input = Stream(stream_name="geometry")
gated_cal = (bg_corrected_img.combine_latest(