Commit d08bb65e authored by Gaetano Scandariato's avatar Gaetano Scandariato
Browse files

style(linting): apply safe auto-fixes for SIM118, RUF046, UP035, SIM117, RUF005

parent 5d65d988
Loading
Loading
Loading
Loading
Loading
+4 −1
Changes for PyAETNA/body_models.py: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -953,7 +953,10 @@ def compute_rossiter_mclaughlin(
    q2=0.1,
):
    """Public wrapper: converts scalar inputs to JAX float32 arrays, then calls the JIT core."""
    _f = lambda x: jnp.asarray(x, dtype=jnp.float32)

    def _f(x):
        return jnp.asarray(x, dtype=jnp.float32)

    return _compute_rossiter_mclaughlin_jit(
        jnp.asarray(times, dtype=jnp.float32),
        _f(rp_by_rs),
+7 −5
Changes for PyAETNA/reporting/confidence_bands.py: 7 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -139,8 +139,7 @@ def compute_data_bands(
                )
        else:
            params_i = {
                name: samples_dict[name][sample_indices[ii]]
                for name in samples_dict.keys()
                name: samples_dict[name][sample_indices[ii]] for name in samples_dict
            }
            params_i.update(param_config["fixed_params"])
            comp_i = compute_model_components(
@@ -335,7 +334,10 @@ def compute_grid_bands(
        ``_ov_mt_q{16,84}_grid``.
    """
    if log_func is None:
        log_func = lambda msg: None

        def log_func(msg):
            return None

    # Initialise all band variables to None (populated in the branches below)
    pn_q16_grid = pn_q84_grid = None
    pt_q16_grid = pt_q84_grid = None
@@ -400,7 +402,7 @@ def compute_grid_bands(
            else:
                params_i = {
                    name: samples_dict[name][sample_indices[ii]]
                    for name in samples_dict.keys()
                    for name in samples_dict
                }
                params_i.update(param_config["fixed_params"])

@@ -830,7 +832,7 @@ class ConfidenceBandComputer:
            sample_indices = self.get_sample_indices()
            params_i = {
                name: self.samples_dict[name][sample_indices[sample_idx]]
                for name in self.samples_dict.keys()
                for name in self.samples_dict
            }
            components = compute_model_components(
                ModelComponentsConfig(
+4 −2
Changes for PyAETNA/reporting/corner_plot.py: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -223,7 +223,8 @@ def plot_corner(

        stuck_names = [names[i] for i in np.where(stuck_params)[0]]
        warnings.warn(
            f"Parameters with no variation (stuck chain): {stuck_names}. Excluding from corner plot."
            f"Parameters with no variation (stuck chain): {stuck_names}. Excluding from corner plot.",
            stacklevel=2,
        )
        # Remove stuck parameters
        good_mask = ~stuck_params
@@ -238,7 +239,8 @@ def plot_corner(
        import warnings

        warnings.warn(
            "All parameters have no variation (stuck chains). Returning empty corner plot."
            "All parameters have no variation (stuck chains). Returning empty corner plot.",
            stacklevel=2,
        )
        fig, ax = plt.subplots(1, 1, figsize=(6, 4))
        ax.text(
+1 −1
Changes for PyAETNA/reporting/grid_builder.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -439,7 +439,7 @@ def _build_visit_time_grid(
    total_span = sum(hi - lo for lo, hi, _ in padded_spans)
    if total_span > 0:
        raw_alloc = [
            max(min_pts_per_visit, int(round(n_grid_total * (hi - lo) / total_span)))
            max(min_pts_per_visit, round(n_grid_total * (hi - lo) / total_span))
            for lo, hi, _ in padded_spans
        ]
    else:
+1 −3
Changes for PyAETNA/reporting/model_components.py: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -492,9 +492,7 @@ def compute_model_components(
                        kernel, x_inst_jax, res_inst_jax, dy_sq_jax, x_inst_jax
                    )
            except Exception as e:
                _log(
                    f"WARNING: GP prediction failed for instrument {inst_id}: {e!s}"
                )
                _log(f"WARNING: GP prediction failed for instrument {inst_id}: {e!s}")
                continue

            mu_full_np = np.array(mu_full)
Loading