Skip to content

Add Lao beta_p/li profile adjustment for VCs - #79

Open
nicamo wants to merge 3 commits into
mainfrom
lao-betap-li-static-profile
Open

Add Lao beta_p/li profile adjustment for VCs#79
nicamo wants to merge 3 commits into
mainfrom
lao-betap-li-static-profile

Conversation

@nicamo

@nicamo nicamo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a static Lao85 fitter targeting Ip, beta_p and li with two alpha and two beta coefficients
  • add a VC profile_adjuster route and helper for VCs at fixed beta_p/li
  • evaluate VC baseline targets only after solving the profile-adjusted baseline equilibrium
  • start every finite-difference VC column from that same adjusted baseline profile
  • update Example09 with the fixed beta_p/li workflow while preserving the current-main Tikhonov examples
  • add focused regression tests for the Lao fitter, profile copying, and profile-adjusted VC construction

Reviewer correction

The original fixed-beta_p/li calculation recorded target values before refitting the baseline Lao profile. Each perturbed column therefore subtracted stale pre-fit targets. It also reused the preceding column's fitted Lao coefficients, making the underdetermined four-coefficient/two-metric fit depend on column order.

The correction evaluates targets after the adjusted baseline solve and resets every perturbation to a copy of that same fitted profile. The new synthetic regression has an exact known target derivative and also checks that all perturbations begin from the baseline profile state.

Validation

  • python -m pytest freegsnke/tests/test_jtor_update.py freegsnke/tests/test_virtual_circuits.py -q: 10 passed before merging current main
  • Black is clean after merging current main
  • affected modules and tests compile successfully
  • Example09 parses successfully and contains both the fixed beta_p/li and Tikhonov VC sections

A full physical execution of the fixed-profile VC section was attempted, but timed out during the expensive profile-metric finite-difference solve on this machine. The previously saved failed outputs were removed rather than replaced with unverified values.

@kpentland

Copy link
Copy Markdown
Collaborator

Had a quick look at this, will return to it later.

Example09 runs smoothly for me but I'm not sure it's doing what it intended. While the betap and li are held fixed using the new VCs, the actual perturbation of Rin and Rout (2cm requested) were <1e-5 (i.e. the shape doesn't change). Probably requires a bit of digging.

@kpentland kpentland self-assigned this Jul 23, 2026
@kpentland kpentland added the enhancement New feature or request label Jul 23, 2026
nicamo added 2 commits August 4, 2026 01:44
…rofile

# Conflicts:
#	examples/example09 - virtual_circuits_MASTU.ipynb
#	freegsnke/virtual_circuits.py
@nicamo

nicamo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@kpentland Thanks, this exposed two issues in the VC construction.

Baseline targets were recorded before the fixed-beta_p/li profile refit, so every column subtracted stale targets. Successive columns also reused the preceding fitted Lao coefficients, making the underdetermined fit order-dependent.

Both are now corrected: targets are evaluated after the adjusted baseline solve, and every perturbation starts from that same fitted profile. I added a synthetic regression with an exact known target derivative, and merged current main while preserving the newer Tikhonov VC path. The 10 focused tests pass, and all repository checks currently reported by GitHub pass.

I removed the previously saved failed outputs from Example09. A full physical rerun on this machine timed out in the expensive profile-metric finite-difference fit, so I have not replaced them with unverified output values.

@kpentland

Copy link
Copy Markdown
Collaborator

@nicamo

I've tried running Example09 but I'm getting some errors when calculating the VCs (with fixed betp and li).

Cell 17 is failing with:
cell17_error.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants