Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Two AMARES front ends, one engine: delete ours

Last edited: 2026-11-03 · #80

mnutils.fitting.AMARES was ~830 lines wrapping pyAMARES. xmris ships its own front end, xmris.fitting.fit_amares, over the same engine — batch, parallel, domain-preserving, with a fit_status flag. Two wrappers meant two sets of defaults (method, num_workers, g_global, ppm_offset all differed) and two result formats, and one of them was MNUtils-side upkeep for logic CLAUDE.md says belongs upstream. Keep both and they drift apart; the question was whether to soften the exit or just take it.

Shape: the series hand over FIDs, xmris does the rest

A series already carries reference_frequency and carrier_ppm on its FIDs, so the only thing a caller supplies is prior_knowledge. The rest of the old surface either has a direct xmris equivalent or went away with it.

Old (fitting.AMARES)Now
fit_single_fid, fit_multiple_fidsfit_amares via fit_average_fid, fit_single_voxel, fit_all_voxels, fit_grouped_by_duration
extract_from_fit_results, FitResultsthe returned xr.Dataset (fit_results on the series)
priorknowledge_to_multiindex and inversebuild_prior_knowledge
save/load_extracted_results (HDF5)none; old HDF5 files are not readable. save_processed_data still writes the voxel maps
plot_amares_fitting, table helpersnone; to come back upstream in xmris if wanted
filter_by_ppm, bad_fit_chisqr_thresholdnone
mrsi = MRSISeries(DATA_FOLDER, 8)
ds = mrsi.fit_all_voxels(prior_knowledge)  # an xr.Dataset on the full (i, j, k) grid
ds["amplitude"].sel(metabolite="PCr")
ds["fit_status"]  # 0 fitted, 1 no signal, 2 failed; unfitted voxels are NaN

fitted_metabolite_maps and goodness_of_fit_maps survive as plain arrays derived from the Dataset, because plotting and save_processed_data read them. The goodness-of-fit maps are now residual_rms and fit_status, since xmris reports no chi-squared.

Why not keep our wrapper and just fix the defaults?

It is the cheapest option, but it leaves two front ends to keep in step with every pyAMARES release, which is the cost this change exists to remove.

Why not a deprecation cycle first?

It would protect users with scripts calling fit_single_fid or holding old HDF5 results. There are none: the maintainer is the only user, and migrates their own scripts. A warning cycle would cost a release and keep the old code alive for nobody. New users never see the old API.

What changed from the plan