<commit_before>import copy
import math
import warnings
import os

import numpy

from scipy.special import j0, i1e
from scipy.interpolate import interp1d
from scipy.ndimage import map_coordinates

from .effects import PhysicalEffects
from . import io
from .config import Config
from .image import save_image, convert_8bit
from . import constants

from logging import getLogger
_log = getLogger(__name__)


class _EPIFMConfigs:

    def __init__(self):
        pass

    def initialize(self, config, rng=None):
        """Initialize based on the given config.

        Args:
            config (Config): A config object.
            rng (numpy.RandomState, optional): A random number generator
                for initializing this class. Defaults to `None`.

        """
        if rng is None:
            warnings.warn('A random number generator [rng] is not given.')
            rng = numpy.random.RandomState()

        # self.radial = numpy.arange(config.psf_radial_cutoff, dtype=float)
        # self.depth = numpy.arange(config.psf_depth_cutoff, dtype=float)
        self.radial = numpy.arange(0.0, config.psf_radial_cutoff, 1e-9, dtype=float)
        self.depth = numpy.arange(0.0, config.psf_depth_cutoff, 1e-9, dtype=float)

        self.wave_length = numpy.arange(config.psf_min_wave_length, config.psf_max_wave_length, dtype=int)
        N = len(self.wave_length)
        self.wave_number = 2 * numpy.pi / self.wave_length
        self.excitation_eff = numpy.zeros(N, dtype=float)
        self.dichroic_eff = numpy.zeros(N, dtype=float)
        self.emission_eff = numpy.zeros(N, dtype=float)

        self._set_data('hc_const', config.hc_const)

        self.set_shutter(
            config.shutter_start_time, config.shutter_end_time, config.shutter_time_open,
            config.shutter_time_lapse, config.shutter_switch)

        _log.info('--- Shutter:')
        _log.info('    Start-Time = {} sec'.format(self.shutter_start_time))
        _log.info('    End-Time   = {} sec'.format(self.shutter_end_time))
        _log.info('    Time-open  = {} sec'.format(self.shutter_time_open))
        _log.info('    Time-lapse = {} sec'.format(self.shutter_time_lapse))

        self.set_light_source(
            config.source_type, config.source_wavelength, config.source_flux_density,
            config.source_radius, config.source_angle, config.source_switch)

        _log.info('--- Light Source:{}'.format(self.source_type))
        _log.info('    Wave Length = {} nm'.format(self.source_wavelength))
        _log.info('    Beam Flux Density = {} W/cm2'.format(self.source_flux_density))
        _log.info('    1/e2 Radius = {} m'.format(self.source_radius))
        _log.info('    Angle = {} degree'.format(self.source_angle))

        self.set_fluorophore(
            config.fluorophore_type, config.psf_wavelength, config.psf_normalization,
            config.fluorophore_radius, config.psf_width)

        _log.info('--- Fluorophore: {} PSF'.format(self.fluorophore_type))
        _log.info('    Wave Length   =  {} nm'.format(self.psf_wavelength))
        _log.info('    Normalization =  {}'.format(self.psf_normalization))
        _log.info('    Fluorophore radius =  {} nm'.format(self.fluorophore_radius))
        if hasattr(self, 'psf_width'):
            _log.info('    Lateral Width =  {} nm'.format(self.psf_width[0]))
            _log.info('    Axial Width =  {} nm'.format(self.psf_width[1]))<commit_msg>#2 Edit the unit in dump<commit_after>import copy
import math
import warnings
import os

import numpy

from scipy.special import j0, i1e
from scipy.interpolate import interp1d
from scipy.ndimage import map_coordinates

from .effects import PhysicalEffects
from . import io
from .config import Config
from .image import save_image, convert_8bit
from . import constants

from logging import getLogger
_log = getLogger(__name__)


class _EPIFMConfigs:

    def __init__(self):
        pass

    def initialize(self, config, rng=None):
        """Initialize based on the given config.

        Args:
            config (Config): A config object.
            rng (numpy.RandomState, optional): A random number generator
                for initializing this class. Defaults to `None`.

        """
        if rng is None:
            warnings.warn('A random number generator [rng] is not given.')
            rng = numpy.random.RandomState()

        # self.radial = numpy.arange(config.psf_radial_cutoff, dtype=float)
        # self.depth = numpy.arange(config.psf_depth_cutoff, dtype=float)
        self.radial = numpy.arange(0.0, config.psf_radial_cutoff, 1e-9, dtype=float)
        self.depth = numpy.arange(0.0, config.psf_depth_cutoff, 1e-9, dtype=float)

        self.wave_length = numpy.arange(config.psf_min_wave_length, config.psf_max_wave_length, dtype=int)
        N = len(self.wave_length)
        self.wave_number = 2 * numpy.pi / self.wave_length
        self.excitation_eff = numpy.zeros(N, dtype=float)
        self.dichroic_eff = numpy.zeros(N, dtype=float)
        self.emission_eff = numpy.zeros(N, dtype=float)

        self._set_data('hc_const', config.hc_const)

        self.set_shutter(
            config.shutter_start_time, config.shutter_end_time, config.shutter_time_open,
            config.shutter_time_lapse, config.shutter_switch)

        _log.info('--- Shutter:')
        _log.info('    Start-Time = {} sec'.format(self.shutter_start_time))
        _log.info('    End-Time   = {} sec'.format(self.shutter_end_time))
        _log.info('    Time-open  = {} sec'.format(self.shutter_time_open))
        _log.info('    Time-lapse = {} sec'.format(self.shutter_time_lapse))

        self.set_light_source(
            config.source_type, config.source_wavelength, config.source_flux_density,
            config.source_radius, config.source_angle, config.source_switch)

        _log.info('--- Light Source:{}'.format(self.source_type))
        _log.info('    Wave Length = {} nm'.format(self.source_wavelength))
        _log.info('    Beam Flux Density = {} W/cm2'.format(self.source_flux_density))
        _log.info('    1/e2 Radius = {} m'.format(self.source_radius))
        _log.info('    Angle = {} degree'.format(self.source_angle))

        self.set_fluorophore(
            config.fluorophore_type, config.psf_wavelength, config.psf_normalization,
            config.fluorophore_radius, config.psf_width)

        _log.info('--- Fluorophore: {} PSF'.format(self.fluorophore_type))
        _log.info('    Wave Length   =  {} nm'.format(self.psf_wavelength))
        _log.info('    Normalization =  {}'.format(self.psf_normalization))
        _log.info('    Fluorophore radius =  {} nm'.format(self.fluorophore_radius))
        if hasattr(self, 'psf_width'):
            _log.info('    Lateral Width =  {} m'.format(self.psf_width[0]))
            _log.info('    Axial Width =  {} m'.format(self.psf_width[1]))
{'fraction_non_alphanumeric': 0.116542994325622, 'fraction_numerical': 0.005383384257238469, 'mean_word_length': 2.8359375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2175463', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2196, 'n_words': 426}