astrorama / SourceXtractorPlusPlus

SourceXtractor++, the next generation SExtractor
https://astrorama.github.io/SourceXtractorPlusPlus/
GNU Lesser General Public License v3.0
72 stars 9 forks source link

Model fitting fails in latest development version #433

Closed mariorpd13 closed 2 years ago

mariorpd13 commented 2 years ago

With the latest development version (0.17) I get the errors below when I try to do model fitting:

2021-12-22T09:49:49CET Config INFO : Free parameter compiled 2021-12-22T09:49:49CET Config INFO : digraph G { label="Free parameter" "0" [label="_0.centroid_x"]; } 2021-12-22T09:49:49CET Config INFO : Range min compiled 2021-12-22T09:49:49CET Config INFO : digraph G { label="Range min" "0" [label="-"]; "1" [label="_0"]; "0" -> "1" "2" [label="_1.radius"]; "0" -> "2" } .... 2021-12-22T09:49:49CET Config INFO : Range max compiled 2021-12-22T09:49:49CET Config INFO : digraph G { label="Range max" "0" [label="10.000000"]; } 2021-12-22T09:49:50CET SourceXtractor FATAL : AttributeSet object has no attribute 'get_radius' 2021-12-22T09:49:50CET Python::Interpreter INFO : Python GIL acquired 18 times

This was working up to 0.16, did something change in the latest version ?

sersic = FreeParameter(2.0, Range((1.0, 7.0), RangeType.LINEAR)) ratio_sersic = FreeParameter(1, Range((0, 10), RangeType.LINEAR)) rad_sersic = FreeParameter(lambda o: o.get_radius(), Range(lambda v, o: (.01 v, 100 v), RangeType.EXPONENTIAL)) angle_sersic = FreeParameter(lambda o: o.get_angle(), Range((-np.pi, np.pi), RangeType.LINEAR))

Add a prior on the sersic profile

sersic0 = 4 nc = DependentParameter(lambda nt: np.exp(nt - sersic0), sersic) add_prior(nc, 0.0, 1.0)

Transform to world coordinates

ra, dec, wc_rad, wc_angle, wc_ratio = get_world_parameters(x, y, rad_sersic, angle_sersic, ratio_sersic) flux = get_flux_parameter() mag = DependentParameter(lambda f: -2.5 * np.log10(f) + args.mag_zp, flux)
add_model(group, SersicModel(x, y, flux, rad_sersic, ratio_sersic, angle_sersic, sersic))

ayllon commented 2 years ago

Hello,

Sorry for the trouble, but indeed the API has change somewhat. See the release notes for 0.16

Getters like o.get_radius() now are properties like o.radius. Same goes for get_angle() => angle.

get_flux_parameter() is still the same, though, since it is a method.

mkuemmel commented 2 years ago

There are a couple of syntax changes that started with 0.17:

That should be it.

We are behind with our documentation. Apologies for that.

mariorpd13 commented 2 years ago

That fixed it, many thanks !!