v0.0.5
The 0.0.5 release of jaxspec is out ! Many code refactoring and internal cleaning is happening, but there are also new features, including a direct fit method for your spectral models.
New features
jaxspec.fitmodule now includesBayesianFitterandMinimizationFitterclasses to perform either MCMC or direct minimization to find the best set of parameters. Note thatMinimizationFitteris faster but more likely to fall in local minima.- Both
BayesianFitterandMinimizationFittercan fit the same model using multipleObsConfigurationat once to obtain stronger constraints. Either pass alist[ObsConfiguration]or adict[str, ObsConfiguration]to achieve this. - Fit results are now plotable with any unit you want!
FitResult.plot_ppchaw two new kwargs :x_unitandy_type.x_unitargument can be any unit of length, frequency, or energy and the plot will adapt.y_typecan be any of "counts", "countrate", "photon_flux", "photon_flux_density" and will plot the equivalent curve. fakeitandfakeit_for_multiple_parameterscan specifysparsify_matrix = Truefor large RMF.jaxspec.util.abundancesnow contains two tables.abundance_tablecontains the most used abundance tables in astrophysics, andelement_tablecontains various data about elements, imported from themendeleevpackage.jaxspecis now tested against the HEACIT dataset to ensure that it is performant at reading the many types of instrument and observation files produced by the OGIP standard.
Breaking changes
ChainResultis renamed toFitResultChainResult.chainis renamed toFitResult.to_chainChainResult.samplehas been split toFitResult.samples_haikufor a two level dictionary of posterior samples, e.g.samples['powerlaw_1']['alpha'], and toFitResult.samples_flatfor a one level dictionary of posterior samples, e.g.samples['powerlaw_1_alpha'].BayesianModelis renamed toBayesianFitter.Instrument.from_ogip_filenow takes arf_path as a kwarg since some instruments use a single .rmf file to carry both the redistribution matrix and effective area.Instrument.from_ogip_file("data/PN.rmf","data/PN.arf")should be changed toInstrument.from_ogip_file("data/PN.rmf", arf_path="data/PN.arf"). Even if the first syntax should work, be carefull to check that you did not intervert .arf and .rmf.