Commit 440546e9 authored by Gaetano Scandariato's avatar Gaetano Scandariato
Browse files

bug fixes

parent 071bf07e
Loading
Loading
Loading
Loading
Loading
+17 −0
Changes for PyAETNA/reporting/map_search.py: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -158,6 +158,13 @@ def find_map_parameters(samples, potential_energy, param_config, plModel, plData
        map_idx = int(np.argmin(potential_energy))
        map_params = {name: float(vals[map_idx]) for name, vals in samples.items()}

        # Apply aliasing for Named Priors: map registered names to model names.
        param_groups = param_config.get('param_groups', {})
        for model_name, reg_names in param_groups.items():
            for reg_name in reg_names:
                if reg_name in map_params:
                    map_params[model_name] = map_params[reg_name]

        # Recompute energy in constrained space (no Jacobian) for consistency
        _prev_x64 = jax.config.jax_enable_x64
        jax.config.update('jax_enable_x64', True)
@@ -327,6 +334,16 @@ def _evaluate_chain_endpoints(samples, param_config, plModel, plData, num_chains
                chain_params = {name: float(scalar_samples[name][last_idx])
                                for name in free_param_names
                                if name in scalar_samples}

                # Apply aliasing for Named Priors: map registered names to model names.
                # The physics model expects model names (e.g. 'tau_b'), but
                # Named Priors provide canonical names (e.g. 'prior__t_center').
                param_groups = param_config.get('param_groups', {})
                for model_name, reg_names in param_groups.items():
                    for reg_name in reg_names:
                        if reg_name in chain_params:
                            chain_params[model_name] = chain_params[reg_name]

                loglike  = _compute_loglikelihood_fast(
                    chain_params, param_config, plModel, ctx)
                logprior = _compute_log_prior(chain_params, param_config)
+12 −1
Changes for PyAETNA/reporting/model_components.py: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -92,8 +92,19 @@ def compute_model_components(params, plData, plModel, param_config, skip_gp=Fals
            inst_id_to_name[inst_id] = str(inst_id)
    
    rm_config = param_config.get('rm_config', {'enabled': False})
    
    # Alias Mapping: Map registered names (e.g. 'prior__t_center') to model names (e.g. 'tau_b').
    # This ensures that parameters tied to named priors are accessible by the names the reporting logic expects.
    param_groups = param_config.get('param_groups', {})
    aliased_params = params.copy()
    for model_name, registered_names in param_groups.items():
        if registered_names:
            for reg_name in registered_names:
                if reg_name in params:
                    aliased_params[model_name] = params[reg_name]
    
    planet_model, planet_terms = _compute_planet_model_for_plotting(
        params, time, instrument, plModel.uniqueInstruments, planet_configs, planet_names,
        aliased_params, time, instrument, plModel.uniqueInstruments, planet_configs, planet_names,
        plData.timeCenter, param_scopes, data_types=data_types,
        inst_id_to_name=inst_id_to_name, exptime=np.array(plData.exptime),
        rm_config=rm_config, skip_rm=skip_rm
+1 −1
Changes for PyAETNA/sampling/engine/data_loader.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ def load_data_and_config(dataFile, cfg_path, config, plModel, log_func):
    for inst_id, gp_cfg in gp_configs.items():
        for spec in gp_cfg.get('kernel_specs', []):
            kernel_type = spec.get('type', 'Matern32')
            supported = ("ExpSquared", "RBF", "Matern32", "Matern52", "ExpSineSquared", 
            supported = ("ExpSquared", "RBF", "Matern32", "Matern32_quasisep", "Matern52", "Matern52_quasisep", "ExpSineSquared", 
                       "SHO", "SHO_Quality", "Constant", "QuasiPeriodic", "SpectralMixture")
            if kernel_type not in supported:
                msg = f"Unknown GP kernel type '{kernel_type}'. Supported: {', '.join(supported)}"