Example #1
0
    def __init__(self,  parameters=None, input_path=None, output_path=None):
        ### TODO
        """
        Constructor for the reconstruction analyser.

        @param  parameters : Dictionary of reconstruction parameters.
        <br/><b>type</b> : dict
        <br/><b>example</b> : parameters={}
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters,input_path,output_path)


        self.__provided_data = ['/data/electronDensity',
                                '/params/info',
                                '/history',
                                '/info',
                                '/misc',
                                '/version',
                                ]

        self.__expected_data = [
                                '/data/data',
                                '/data/diffr',
                                '/data/angle',
                                '/history/parent/detail',
                                '/history/parent/parent',
                                '/info/package_version',
                                '/info/contact',
                                '/info/data_description',
                                '/info/method_description',
                                '/params/geom/detectorDist',
                                '/params/geom/pixelWidth',
                                '/params/geom/pixelHeight',
                                '/params/geom/mask',
                                '/params/beam/photonEnergy',
                                '/params/beam/photons',
                                '/params/beam/focusArea',
                                '/params/info',
                                ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir( self.output_path ):
            intermediate_output_path = os.path.join( self.output_path, 'orient_out.h5' )
        else:
            intermediate_output_path  = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path, intermediate_output_path )
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path, self.output_path)
Example #2
0
class S2EReconstruction(AbstractPhotonAnalyzer):
    """
    Class representing photon data analysis for electron density reconstruction from 2D diffraction patterns.
    Uses the EMC orientation module and the DM phasing module.
    """

    def __init__(self,  parameters=None, input_path=None, output_path=None):
        ### TODO
        """
        Constructor for the reconstruction analyser.

        @param  parameters : Dictionary of reconstruction parameters.
        <br/><b>type</b> : dict
        <br/><b>example</b> : parameters={}
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters,input_path,output_path)


        self.__provided_data = ['/data/electronDensity',
                                '/params/info',
                                '/history',
                                '/info',
                                '/misc',
                                '/version',
                                ]

        self.__expected_data = [
                                '/data/data',
                                '/data/diffr',
                                '/data/angle',
                                '/history/parent/detail',
                                '/history/parent/parent',
                                '/info/package_version',
                                '/info/contact',
                                '/info/data_description',
                                '/info/method_description',
                                '/params/geom/detectorDist',
                                '/params/geom/pixelWidth',
                                '/params/geom/pixelHeight',
                                '/params/geom/mask',
                                '/params/beam/photonEnergy',
                                '/params/beam/photons',
                                '/params/beam/focusArea',
                                '/params/info',
                                ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir( self.output_path ):
            intermediate_output_path = os.path.join( self.output_path, 'orient_out.h5' )
        else:
            intermediate_output_path  = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path, intermediate_output_path )
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path, self.output_path)



    def expectedData(self):
        """ Query for the data expected by the Analyzer. """
        return self.__expected_data

    def providedData(self):
        """ Query for the data provided by the Analyzer. """
        return self.__provided_data

    @property
    def data(self):
        """ Query for the field data. """
        return self.__data

    def _readH5(self):
        """ """
        """ Private method for reading the hdf5 input and extracting the parameters and data relevant to initialize the object. """
        pass # Nothing to be done since IO happens in backengine.

    def saveH5(self):
        """ """
        """
        Private method to save the object to a file.

        @param output_path : The file where to save the object's data.
        <br/><b>type</b> : string
        <br/><b>default</b> : None
        """
        pass # No action required since output is written in backengine.



    def backengine(self):

        emc_status = self.__emc.backengine()
        if  emc_status!= 0:
            return emc_status
        dm_status = self.__dm.backengine()

        return dm_status
Example #3
0
    def __init__(self, parameters=None, input_path=None, output_path=None):
        """

        :param parameters: The parameters for the reconstruction.
        :type parameters: dict
        :example parameters: parameters={'EMC_Parameters' : EMCOrientationParameters(), 'DM_Parameters' : DMPhasingParameters()} # Use default parameters for EMC and DM.

        :param input_path: Path for input data.
        :type input_path: str

        :param output_path: Path where to write output to.
        :type output_path: str
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters, input_path,
                                                output_path)

        self.__provided_data = [
            '/data/electronDensity',
            '/params/info',
            '/history',
            '/info',
            '/misc',
            '/version',
        ]

        self.__expected_data = [
            '/data/data',
            '/data/diffr',
            '/data/angle',
            '/history/parent/detail',
            '/history/parent/parent',
            '/info/package_version',
            '/info/contact',
            '/info/data_description',
            '/info/method_description',
            '/params/geom/detectorDist',
            '/params/geom/pixelWidth',
            '/params/geom/pixelHeight',
            '/params/geom/mask',
            '/params/beam/photonEnergy',
            '/params/beam/photons',
            '/params/beam/focusArea',
            '/params/info',
        ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir(self.output_path):
            intermediate_output_path = os.path.join(self.output_path,
                                                    'orient_out.h5')
        else:
            intermediate_output_path = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path,
                                    intermediate_output_path)
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path,
                              self.output_path)
Example #4
0
class S2EReconstruction(AbstractPhotonAnalyzer):
    """
    Class representing photon data analysis for electron density reconstruction from 2D diffraction patterns.
    Uses the EMC orientation module and the DM phasing module.

    """
    def __init__(self, parameters=None, input_path=None, output_path=None):
        """

        :param parameters: The parameters for the reconstruction.
        :type parameters: dict
        :example parameters: parameters={'EMC_Parameters' : EMCOrientationParameters(), 'DM_Parameters' : DMPhasingParameters()} # Use default parameters for EMC and DM.

        :param input_path: Path for input data.
        :type input_path: str

        :param output_path: Path where to write output to.
        :type output_path: str
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters, input_path,
                                                output_path)

        self.__provided_data = [
            '/data/electronDensity',
            '/params/info',
            '/history',
            '/info',
            '/misc',
            '/version',
        ]

        self.__expected_data = [
            '/data/data',
            '/data/diffr',
            '/data/angle',
            '/history/parent/detail',
            '/history/parent/parent',
            '/info/package_version',
            '/info/contact',
            '/info/data_description',
            '/info/method_description',
            '/params/geom/detectorDist',
            '/params/geom/pixelWidth',
            '/params/geom/pixelHeight',
            '/params/geom/mask',
            '/params/beam/photonEnergy',
            '/params/beam/photons',
            '/params/beam/focusArea',
            '/params/info',
        ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir(self.output_path):
            intermediate_output_path = os.path.join(self.output_path,
                                                    'orient_out.h5')
        else:
            intermediate_output_path = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path,
                                    intermediate_output_path)
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path,
                              self.output_path)

    def expectedData(self):
        """ Query for the data expected by the Analyzer. """
        return self.__expected_data

    def providedData(self):
        """ Query for the data provided by the Analyzer. """
        return self.__provided_data

    @property
    def data(self):
        """ Query for the field data. """
        return self.__data

    def _readH5(self):
        """ """
        """ Private method for reading the hdf5 input and extracting the parameters and data relevant to initialize the object. """
        pass  # Nothing to be done since IO happens in backengine.

    def saveH5(self):
        """ """
        """
        Private method to save the object to a file.

        :param output_path: The file where to save the object's data.
        :type output_path: str
        """
        pass  # No action required since output is written in backengine.

    def backengine(self):
        """ Run the EMC and DM backengine executables. """

        # Run EMC.
        emc_status = self.__emc.backengine()

        # If EMC was not successful, return with error code.

        if emc_status != 0:
            return emc_status

        # Else run DM.
        return self.__dm.backengine()
    def __init__(self,  parameters=None, input_path=None, output_path=None):
        """

        :param parameters: The parameters for the reconstruction.
        :type parameters: dict
        :example parameters: parameters={'EMC_Parameters' : EMCOrientationParameters(), 'DM_Parameters' : DMPhasingParameters()} # Use default parameters for EMC and DM.

        :param input_path: Path for input data.
        :type input_path: str

        :param output_path: Path where to write output to.
        :type output_path: str
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters,input_path,output_path)


        self.__provided_data = ['/data/electronDensity',
                                '/params/info',
                                '/history',
                                '/info',
                                '/misc',
                                '/version',
                                ]

        self.__expected_data = [
                                '/data/data',
                                '/data/diffr',
                                '/data/angle',
                                '/history/parent/detail',
                                '/history/parent/parent',
                                '/info/package_version',
                                '/info/contact',
                                '/info/data_description',
                                '/info/method_description',
                                '/params/geom/detectorDist',
                                '/params/geom/pixelWidth',
                                '/params/geom/pixelHeight',
                                '/params/geom/mask',
                                '/params/beam/photonEnergy',
                                '/params/beam/photons',
                                '/params/beam/focusArea',
                                '/params/info',
                                ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir( self.output_path ):
            intermediate_output_path = os.path.join( self.output_path, 'orient_out.h5' )
        else:
            intermediate_output_path  = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path, intermediate_output_path )
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path, self.output_path)
class S2EReconstruction(AbstractPhotonAnalyzer):
    """
    Class representing photon data analysis for electron density reconstruction from 2D diffraction patterns.
    Uses the EMC orientation module and the DM phasing module.

    """

    def __init__(self,  parameters=None, input_path=None, output_path=None):
        """

        :param parameters: The parameters for the reconstruction.
        :type parameters: dict
        :example parameters: parameters={'EMC_Parameters' : EMCOrientationParameters(), 'DM_Parameters' : DMPhasingParameters()} # Use default parameters for EMC and DM.

        :param input_path: Path for input data.
        :type input_path: str

        :param output_path: Path where to write output to.
        :type output_path: str
        """

        # Initialize base class.
        super(S2EReconstruction, self).__init__(parameters,input_path,output_path)


        self.__provided_data = ['/data/electronDensity',
                                '/params/info',
                                '/history',
                                '/info',
                                '/misc',
                                '/version',
                                ]

        self.__expected_data = [
                                '/data/data',
                                '/data/diffr',
                                '/data/angle',
                                '/history/parent/detail',
                                '/history/parent/parent',
                                '/info/package_version',
                                '/info/contact',
                                '/info/data_description',
                                '/info/method_description',
                                '/params/geom/detectorDist',
                                '/params/geom/pixelWidth',
                                '/params/geom/pixelHeight',
                                '/params/geom/mask',
                                '/params/beam/photonEnergy',
                                '/params/beam/photons',
                                '/params/beam/focusArea',
                                '/params/info',
                                ]

        emc_parameters = None
        dm_parameters = None

        # Construct emc and dm calculators.
        if self.parameters != {}:
            emc_parameters = self.parameters['EMC_Parameters']
            dm_parameters = self.parameters['DM_Parameters']

        if os.path.isdir( self.output_path ):
            intermediate_output_path = os.path.join( self.output_path, 'orient_out.h5' )
        else:
            intermediate_output_path  = 'orient_out.h5'

        self.__emc = EMCOrientation(emc_parameters, self.input_path, intermediate_output_path )
        self.__dm = DMPhasing(dm_parameters, intermediate_output_path, self.output_path)

    def expectedData(self):
        """ Query for the data expected by the Analyzer. """
        return self.__expected_data

    def providedData(self):
        """ Query for the data provided by the Analyzer. """
        return self.__provided_data

    @property
    def data(self):
        """ Query for the field data. """
        return self.__data

    def _readH5(self):
        """ """
        """ Private method for reading the hdf5 input and extracting the parameters and data relevant to initialize the object. """
        pass # Nothing to be done since IO happens in backengine.

    def saveH5(self):
        """ """
        """
        Private method to save the object to a file.

        :param output_path: The file where to save the object's data.
        :type output_path: str
        """
        pass # No action required since output is written in backengine.

    def backengine(self):
        """ Run the EMC and DM backengine executables. """

        # Run EMC.
        emc_status = self.__emc.backengine()

        # If EMC was not successful, return with error code.
        if  emc_status!= 0:
            return emc_status

        # Else run DM.
        return self.__dm.backengine()