tests/conftest.py
def metadata_xml(tmpdir):
    """
    This pytest factory constructs a fake metadata xml file, saves it to file
    and returns the path.
    """

    def _metadata_xml(
        timepoints=0,
        x_pixels=10,
        y_pixels=10,
        n_z=3,
        area_mode=2,
        channels=("ChanA", "ChanB"),
        pixel_size=1,
        z_step_size=1,
        dwell_time=1,
        frame_rate=10,
        width=1,
        gain_a=1,
        gain_b=1,
        flyback_frames=3,
        power=1,
        date="12/20/2018 18:33:52",
        z_fast_enable=1,
        streaming_enable=1,
        average_mode=1,
        average_num=2,
    ):
        wavelength_strings = ""
        for channel in channels:
            wavelength_strings = (
                wavelength_strings
                + f"""<Wavelength name="{channel}" exposuretimeMS="0" />"""
            )
        content = f"""<?xml version="1.0"?>
        <ThorImageExperiment>
            <Date date="{date}" />
            <Wavelengths nyquistExWavelengthNM="488" nyquistEmWavelengthNM="488">
                {wavelength_strings}
                <ChannelEnable Set="3" />
            </Wavelengths>
            <ZStage steps="{n_z}" stepSizeUM="{z_step_size}" />
            <Timelapse timepoints="{timepoints}" />
            <LSM pixelX="{x_pixels}" pixelY="{y_pixels}" averageMode="{average_mode}" averageNum="{average_num}" areaMode="{area_mode}" pixelSizeUM="{pixel_size}" dwellTime="{dwell_time}" frameRate="{frame_rate}" widthUM="{width}" />
            <PMT gainA="{gain_a}" gainB="{gain_b}" />
            <Streaming enable="{streaming_enable}" flybackFrames="{flyback_frames}" zFastEnable="{z_fast_enable}" />
            <PowerRegulator start="{power}" />
        </ThorImageExperiment>
        """
        path = tmpdir.join("Experiment.xml")
        path.write(content)
        return path

    return _metadata_xml

    This pytest factory constructs a fake metadata xml file, saves it to file
    and returns the path.
    
This pytest factory constructs a fake metadata xml file, saves it to file
and returns the path.
This pytest factory constructs a fake metadata xml file saves it to file and returns the path .
def metadata_xml(tmpdir):
    def _metadata_xml(
        timepoints=0,
        x_pixels=10,
        y_pixels=10,
        n_z=3,
        area_mode=2,
        channels=("ChanA", "ChanB"),
        pixel_size=1,
        z_step_size=1,
        dwell_time=1,
        frame_rate=10,
        width=1,
        gain_a=1,
        gain_b=1,
        flyback_frames=3,
        power=1,
        date="12/20/2018 18:33:52",
        z_fast_enable=1,
        streaming_enable=1,
        average_mode=1,
        average_num=2,
    ):
        wavelength_strings = ""
        for channel in channels:
            wavelength_strings = (
                wavelength_strings
                + f"""<Wavelength name="{channel}" exposuretimeMS="0" />"""
            )
        content = f"""<?xml version="1.0"?>
        <ThorImageExperiment>
            <Date date="{date}" />
            <Wavelengths nyquistExWavelengthNM="488" nyquistEmWavelengthNM="488">
                {wavelength_strings}
                <ChannelEnable Set="3" />
            </Wavelengths>
            <ZStage steps="{n_z}" stepSizeUM="{z_step_size}" />
            <Timelapse timepoints="{timepoints}" />
            <LSM pixelX="{x_pixels}" pixelY="{y_pixels}" averageMode="{average_mode}" averageNum="{average_num}" areaMode="{area_mode}" pixelSizeUM="{pixel_size}" dwellTime="{dwell_time}" frameRate="{frame_rate}" widthUM="{width}" />
            <PMT gainA="{gain_a}" gainB="{gain_b}" />
            <Streaming enable="{streaming_enable}" flybackFrames="{flyback_frames}" zFastEnable="{z_fast_enable}" />
            <PowerRegulator start="{power}" />
        </ThorImageExperiment>
        """
        path = tmpdir.join("Experiment.xml")
        path.write(content)
        return path
    return _metadata_xml
def metadata_xml ( tmpdir ) : def _metadata_xml ( timepoints = 0 , x_pixels = 10 , y_pixels = 10 , n_z = 3 , area_mode = 2 , channels = ( "ChanA" , "ChanB" ) , pixel_size = 1 , z_step_size = 1 , dwell_time = 1 , frame_rate = 10 , width = 1 , gain_a = 1 , gain_b = 1 , flyback_frames = 3 , power = 1 , date = "12/20/2018 18:33:52" , z_fast_enable = 1 , streaming_enable = 1 , average_mode = 1 , average_num = 2 , ) : wavelength_strings = "" for channel in channels : wavelength_strings = ( wavelength_strings + f"""<Wavelength name="{channel}" exposuretimeMS="0" />""" ) content = f"""<?xml version="1.0"?>
        <ThorImageExperiment>
            <Date date="{date}" />
            <Wavelengths nyquistExWavelengthNM="488" nyquistEmWavelengthNM="488">
                {wavelength_strings}
                <ChannelEnable Set="3" />
            </Wavelengths>
            <ZStage steps="{n_z}" stepSizeUM="{z_step_size}" />
            <Timelapse timepoints="{timepoints}" />
            <LSM pixelX="{x_pixels}" pixelY="{y_pixels}" averageMode="{average_mode}" averageNum="{average_num}" areaMode="{area_mode}" pixelSizeUM="{pixel_size}" dwellTime="{dwell_time}" frameRate="{frame_rate}" widthUM="{width}" />
            <PMT gainA="{gain_a}" gainB="{gain_b}" />
            <Streaming enable="{streaming_enable}" flybackFrames="{flyback_frames}" zFastEnable="{z_fast_enable}" />
            <PowerRegulator start="{power}" />
        </ThorImageExperiment>
        """ path = tmpdir . join ( "Experiment.xml" ) path . write ( content ) return path return _metadata_xml
This pytest factory constructs a fake metadata xml file, saves it to file
and returns the path.
This pytest factory constructs a fake metadata xml file saves it to file and returns the path .
"""
    This pytest factory constructs a fake metadata xml file, saves it to file
    and returns the path.
    """
tmpdir