Skip to content

Dynamfit revamp#535

Open
richardsheridan wants to merge 19 commits into
developfrom
dynamfit_revamp
Open

Dynamfit revamp#535
richardsheridan wants to merge 19 commits into
developfrom
dynamfit_revamp

Conversation

@richardsheridan

Copy link
Copy Markdown

This is the remade dynamfit backend code as Tolu and I discussed. I've just gotten a local frontend working so we can work on getting it properly integrated. the backend should be ready for a code review and checking if it meets the API contract we discussed on zoom.

…e route

  Users can now supply per-point measurement uncertainties via optional
  error columns in the uploaded data file, and tune the fallback scale
  when they don't. The previous behavior (y_std = 0.2 * |E*|) is
  preserved as the default, so existing callers see identical fits.

  * smooth_prony_fit takes explicit E_stor_std / E_loss_std arrays
  * upload_init accepts 3/4/5-column frequency or temperature files
    (extras: a shared 'Error' column or per-modulus 'E Storage Error' /
    'E Loss Error') and 2/3-column shift files (extra 'Error' parsed but
    unused).
Prevents Windows/WSL from rewriting hook shebangs to CRLF, which breaks
execution in Linux containers (cannot run: No such file or directory).
…n data

Add fit_wlf_coefficients and fit_hybrid_coefficients to dynamfit2.py: fit
shift-model coefficients from uploaded shift-factor data (T, a_T) via
scipy.optimize.curve_fit in log10(a_T) space. Caller-supplied coefficients
are held fixed by excluding them from the fit (closure reparametrization,
since scipy 1.10.1 rejects equal bounds; TODO to switch to lb==ub on bump).
For hybrid, TL is a required upstream input (from a prior extract call), not
co-fit.

Expose via a fit_shift_coefficients short-circuit branch in /extract/ that
returns coefficients only (no Prony/charts) and does not require the primary
temp/freq file. Left as a branch with a TODO motivating a future dedicated
route, per its limited inputs/outputs.

Tests: WLF/hybrid round-trip recovery, param-fixing, ValueError guards, and a
new route-test harness (bare Flask app + blueprint, sidestepping the
in-container log-file handler) covering the branch's validation and response.
Add end-to-end route tests over real shift files (agilus30 WLF both-free,
VeroCyan hybrid) plus a cold-data unit test asserting convergence and the
C2 bound. Full module: 158 tests.
…r fit

Shift-factor files are not necessarily referenced to TL, but hybrid_shift was always 1 at TL. Now fit_hybrid_coefficients co-fits a_T_ref so even cases where TL is not aligned with the data will work.
Also fix tests.utils.test_db_utils so it passes outside docker
and package services/tests/ so discovery runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants