# -*- coding: utf-8 -*- """ GEPARD - Gepard-Enabled PARticle Detection Copyright (C) 2018 Lars Bittrich and Josef Brandt, Leibniz-Institut für Polymerforschung Dresden e. V. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program, see COPYING. If not, see . """ import os import configparser __all__ = ["RamanControl", "defaultPath", "simulatedRaman"] defaultPath = os.path.dirname(os.path.split(__file__)[0]) config = configparser.ConfigParser() config.read(os.path.join(defaultPath, 'gepard.cfg')) interface = "RENISHAW_CONTROL" try: defaultPath = config["Defaults"]["file_path"] except KeyError: pass try: interface = config["Interface"]["raman_interface"] except KeyError: pass if interface == "SIMULATED_RAMAN_CONTROL": from .simulatedraman import SimulatedRaman RamanControl = SimulatedRaman print("WARNING: using only simulated raman control!") simulatedRaman = True elif interface == "WITEC_CONTROL": from .WITecCOM import WITecCOM RamanControl = WITecCOM RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) # not yet implemented in WITecCOM, but would probably be a good idea... simulatedRaman = False elif interface == "RENISHAW_CONTROL": from .renishawcom import RenishawCOM RamanControl = RenishawCOM RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) try: bf_dims = config["Renishaw"]["img_size_BF"].split('*') df_dims = config["Renishaw"]["img_size_DF"].split('*') RamanControl.cam_bf_dims = [float(bf_dims[0]), float(bf_dims[1])] RamanControl.cam_df_dims = [float(df_dims[0]), float(df_dims[1])] except: print('Invalid image dimensions in config file!') # RamanControl.defaultMeasTemplate = config["Renishaw"]["defaultMeasTemplate"] RamanControl.measTemplatePath = config["Renishaw"]["measTemplatePath"] print(RamanControl.measTemplatePath) RamanControl.ramanParameters = RamanControl.updateRamanParameters(RamanControl, RamanControl.measTemplatePath) simulatedRaman = False