Beispiel #1
0
    def set_parameters(self, params):
        default_params = {
            'sigma': 1.0,
            'n_sources': 100,
            'xmin': np.min(self.elec_pos[:, 0]),
            'xmax': np.max(self.elec_pos[:, 0]),
            'ymin': np.min(self.elec_pos[:, 1]),
            'ymax': np.max(self.elec_pos[:, 1]),
            'zmin': np.min(self.elec_pos[:, 2]),
            'zmax': np.max(self.elec_pos[:, 2]),
            'dist_table_density': 100,
            'lambd': 0.0,
            'R_init': 2 * parut.min_dist(self.elec_pos),
            'ext_X': 0.0,
            'ext_Y': 0.0,
            'ext_Z': 0.0,
            'h': 1.0,
            'source_type': 'gauss'
        }
        for (prop, default) in default_params.iteritems():
            setattr(self, prop, params.get(prop, default))

        self.gdX = params.get('gdX', 0.05 * (self.xmax - self.xmin))
        self.gdY = params.get('gdY', 0.05 * (self.ymax - self.ymin))
        self.gdZ = params.get('gdZ', 0.05 * (self.zmax - self.zmin))
        self.dist_table_density = 100

        self.source_type = params.get('source_type', 'gauss')
        basis_types = {
            "step": bf.step_rescale_3D,
            "gauss": bf.gauss_rescale_3D,
            "gauss_lim": bf.gauss_rescale_lim_3D,
        }
        if self.source_type not in basis_types.keys():
            raise Exception("Incorrect source type!")
        else:
            self.basis = basis_types.get(self.source_type)

        nx = (self.xmax - self.xmin)/self.gdX + 1
        ny = (self.ymax - self.ymin)/self.gdY + 1
        nz = (self.zmax - self.zmin)/self.gdZ + 1
        lin_x = np.linspace(self.xmin, self.xmax, nx)
        lin_y = np.linspace(self.ymin, self.ymax, ny)
        lin_z = np.linspace(self.zmin, self.ymax, nz)
        self.space_X, self.space_Y, self.space_Z = np.meshgrid(lin_x,
                                                               lin_y,
                                                               lin_z)

        (self.X_src, self.Y_src, self.Z_src, self.R) = sd.make_src_3D(
            self.space_X, self.space_Y, self.space_Z,
            self.n_sources,
            self.ext_X, self.ext_Y, self.ext_Z,
            self.R_init
        )

        Lx = np.max(self.X_src) - np.min(self.X_src) + self.R
        Ly = np.max(self.Y_src) - np.min(self.Y_src) + self.R
        Lz = np.max(self.Z_src) - np.min(self.Z_src) + self.R
        self.dist_max = (Lx**2 + Ly**2 + Lz**2)**0.5
Beispiel #2
0
    def set_parameters(self, params):
        default_params = {
            'sigma': 1.0,
            'n_sources': 300,
            'xmin': np.min(self.elec_pos[:, 0]),
            'xmax': np.max(self.elec_pos[:, 0]),
            'ymin': np.min(self.elec_pos[:, 1]),
            'ymax': np.max(self.elec_pos[:, 1]),
            'dist_table_density': 100,
            'lambd': 0.0,
            'R_init': 2 * parut.min_dist(self.elec_pos),
            'ext_x': 0.0,
            'ext_y': 0.0,
            'h': 1.0,
            'source_type': 'gauss'
        }
        for (prop, default) in default_params.iteritems():
            setattr(self, prop, params.get(prop, default))

        self.gdX = params.get('gdX', 0.01 * (self.xmax - self.xmin))
        self.gdY = params.get('gdY', 0.01 * (self.ymax - self.ymin))

        if self.source_type not in ["gauss", "step"]:
            raise Exception("Incorrect source type!")

        basis_types = {
            "step": bf.step_rescale_2D,
            "gauss": bf.gauss_rescale_2D,
            "gauss_lim": bf.gauss_rescale_lim_2D,
        }
        if self.source_type not in basis_types.keys():
            raise Exception("Incorrect source type!")
        else:
            self.basis = basis_types.get(self.source_type)

        nx = (self.xmax - self.xmin)/self.gdX + 1
        ny = (self.ymax - self.ymin)/self.gdY + 1

        lin_x = np.linspace(self.xmin, self.xmax, nx)
        lin_y = np.linspace(self.ymin, self.ymax, ny)
        self.space_X, self.space_Y = np.meshgrid(lin_x, lin_y)

        (self.X_src, self.Y_src, self.R) = sd.make_src_2D(
            self.space_X,
            self.space_Y,
            self.n_sources,
            self.ext_x,
            self.ext_y,
            self.R_init
        )

        Lx = np.max(self.X_src) - np.min(self.X_src) + self.R
        Ly = np.max(self.Y_src) - np.min(self.Y_src) + self.R
        self.dist_max = (Lx**2 + Ly**2)**0.5
Beispiel #3
0
    def set_parameters(self, params):
        default_params = {
            "sigma": 1.0,
            "n_sources": 100,
            "xmin": np.min(self.elec_pos[:, 0]),
            "xmax": np.max(self.elec_pos[:, 0]),
            "ymin": np.min(self.elec_pos[:, 1]),
            "ymax": np.max(self.elec_pos[:, 1]),
            "zmin": np.min(self.elec_pos[:, 2]),
            "zmax": np.max(self.elec_pos[:, 2]),
            "dist_table_density": 100,
            "lambd": 0.0,
            "R_init": 2 * parut.min_dist(self.elec_pos),
            "ext_X": 0.0,
            "ext_Y": 0.0,
            "ext_Z": 0.0,
            "h": 1.0,
            "source_type": "gauss",
        }
        for (prop, default) in default_params.iteritems():
            setattr(self, prop, params.get(prop, default))

        self.gdX = params.get("gdX", 0.05 * (self.xmax - self.xmin))
        self.gdY = params.get("gdY", 0.05 * (self.ymax - self.ymin))
        self.gdZ = params.get("gdZ", 0.05 * (self.zmax - self.zmin))
        self.dist_table_density = 100

        self.source_type = params.get("source_type", "gauss")
        basis_types = {"step": bf.step_rescale_3D, "gauss": bf.gauss_rescale_3D, "gauss_lim": bf.gauss_rescale_lim_3D}
        if self.source_type not in basis_types.keys():
            raise Exception("Incorrect source type!")
        else:
            self.basis = basis_types.get(self.source_type)

        nx = (self.xmax - self.xmin) / self.gdX + 1
        ny = (self.ymax - self.ymin) / self.gdY + 1
        nz = (self.zmax - self.zmin) / self.gdZ + 1
        lin_x = np.linspace(self.xmin, self.xmax, nx)
        lin_y = np.linspace(self.ymin, self.ymax, ny)
        lin_z = np.linspace(self.zmin, self.ymax, nz)
        self.space_X, self.space_Y, self.space_Z = np.meshgrid(lin_x, lin_y, lin_z)

        (self.X_src, self.Y_src, self.Z_src, self.R) = sd.make_src_3D(
            self.space_X, self.space_Y, self.space_Z, self.n_sources, self.ext_X, self.ext_Y, self.ext_Z, self.R_init
        )

        Lx = np.max(self.X_src) - np.min(self.X_src) + self.R
        Ly = np.max(self.Y_src) - np.min(self.Y_src) + self.R
        Lz = np.max(self.Z_src) - np.min(self.Z_src) + self.R
        self.dist_max = (Lx ** 2 + Ly ** 2 + Lz ** 2) ** 0.5
Beispiel #4
0
    def set_parameters(self, params):
        default_params = {
            'sigma': 1.0,
            'n_sources': 300,
            'xmin': np.min(self.elec_pos),
            'xmax': np.max(self.elec_pos),
            'dist_density': 200,
            'lambd': 0.0,
            'R_init': 2 * parut.min_dist(self.elec_pos),
            'ext': 0.0,
            'h': 1.0,
            'source_type': 'gauss_lim'
        }
        for (prop, default) in default_params.iteritems():
            setattr(self, prop, params.get(prop, default))

        self.gdX = params.get('gdX', 0.01 * (self.xmax - self.xmin))
        basis_types = {
            "step": bf.step_rescale_1D,
            "gauss": bf.gauss_rescale_1D,
            "gauss_lim": bf.gauss_rescale_lim_1D,
        }
        if self.source_type not in basis_types.keys():
            raise Exception("Incorrect source type!")
        else:
            self.basis = basis_types.get(self.source_type)

        self.nx = int(np.ceil((self.xmax - self.xmin)/self.gdX))

        # space_X is the estimation area
        self.space_X = np.linspace(self.xmin - self.ext,
                                   self.xmax + self.ext,
                                   self.nx)
        (self.X_src, self.R) = sd.make_src_1D(self.space_X, self.ext,
                                              self.n_sources, self.R_init)
        Lx = np.max(self.X_src) - np.min(self.X_src) + self.R
        self.dist_max = Lx
Beispiel #5
0
    def set_parameters(self, params):
        default_params = {
            'sigma': 1.0,
            'n_sources': 300,
            'xmin': np.min(self.elec_pos),
            'xmax': np.max(self.elec_pos),
            'dist_density': 200,
            'lambd': 0.0,
            'R_init': 2 * parut.min_dist(self.elec_pos),
            'ext': 0.0,
            'h': 1.0,
            'source_type': 'gauss_lim'
        }
        for (prop, default) in default_params.iteritems():
            setattr(self, prop, params.get(prop, default))

        self.gdX = params.get('gdX', 0.01 * (self.xmax - self.xmin))
        basis_types = {
            "step": bf.step_rescale_1D,
            "gauss": bf.gauss_rescale_1D,
            "gauss_lim": bf.gauss_rescale_lim_1D,
        }
        if self.source_type not in basis_types.keys():
            raise Exception("Incorrect source type!")
        else:
            self.basis = basis_types.get(self.source_type)

        self.nx = int(np.ceil((self.xmax - self.xmin) / self.gdX))

        # space_X is the estimation area
        self.space_X = np.linspace(self.xmin - self.ext, self.xmax + self.ext,
                                   self.nx)
        (self.X_src, self.R) = sd.make_src_1D(self.space_X, self.ext,
                                              self.n_sources, self.R_init)
        Lx = np.max(self.X_src) - np.min(self.X_src) + self.R
        self.dist_max = Lx