[AstroPy] Blackbody plus power law fitting

Rudolf Baer rbaer25 at gmail.com
Mon Apr 19 12:24:44 EDT 2021


Hi Derek
that was very fast. I will try it tomorrow. Many thanks !!
Rudolf

On Mon, Apr 19, 2021 at 5:14 PM Derek Homeier <
derek at astro.physik.uni-goettingen.de> wrote:

> On 19 Apr 2021, at 3:40 pm, Rudolf Baer <rbaer25 at gmail.com> wrote:
> >
> > model_1 = models.PowerLaw1D([1, 1, 1])
>
> This seems to be a typo? This would define a PowerLaw1D with a list (or
> array-like) as amplitude
> and should already raise a ValueError unless your input `x` happened to
> have shape (3, ) as well.
> To define a model with amplitude=1, x_0=1, alpha=1, use PowerLaw1D(1, 1,
> 1) (or just the defaults… ;-)
>
> > model_2 = models.BlackBody(1800*u.K,5)
> > model_1_2=model_1+model_2
> > print(model_1_2)
> >
> > x and y are the input data (x: lambda, y: flux) given without units. By
> definition the blackbody temperature is in Kelvin. This leads to  a Unit
> conversion error in the combined model. Do I have a basic mistake in the
> code or what is the solution. Any help would be much appreciated.
> >
> The error arises from the fact that a BlackBody() model always returns
> flux density as a Quantity
> (by default in `u/Unit('erg / (cm2 Hz s sr)’)`), thus you need to define
> the PowerLaw1D with `amplitude`
> also as a Quantity in compatible units (e.g. the above, or  'Jy / sr', or
> 'W / (m2 * micron * sr)' if you set
> the BlackBody `scale` parameter to a F_lambda unit as well or enable
> `spectral_density` equivalencies).
>
> HTH
>                                                 Derek
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20210419/e209c5c7/attachment.html>


More information about the AstroPy mailing list