Giter Site home page Giter Site logo

cylammarco / wdphottools Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 5.0 56.89 MB

WDPhotTools--A White Dwarf Photometric Toolkit in Python

License: BSD 3-Clause "New" or "Revised" License

Python 99.33% TeX 0.67%
photometry python whitedwarf luminosity-function

wdphottools's Issues

Array handling issue with plotter.plot_atmosphere_model() with RBF interpolation

On the left, it is the correct plot of the white dwarf cooling sequence at different surface gravity using the CT interpolator. On the right, it uses the RBF interpolator. I believe there is something wrong with the list/array handling somewhere in the atmosphere model reader, and for some reason, fitter can use the RBF interpolator to fit WD atmosphere properly but in plotter it fails.

image

WDfitter inherits AtmosphereModelReader

Currently, WDfitter holds an instance of AtmosphereModelReader. It should be inheriting it to make the future extensions of the package easier without needing to write a wrapper function for every new method added.

fitting Mbol & WD mass

Hi, I am trying to fit for the WD mass and Mbol. Broadly, I am following the approach outlined here: https://wdphottools.readthedocs.io/en/latest/tutorials/fitting.html. From what I understood, one needs to pick for the independent list one parameter from (Mbol or Teff) and the second one from (mass/Mbol) for the fitting. I am trying to run something like this:

from WDPhotTools.fitter import WDfitter
ftr = WDfitter()

ftr.fit(
    atmosphere="H",
    filters=["G3", "G3_BP", "G3_RP"],
    mags=[19.1, 18.8, 19.2],
    mag_errors=[0.006, 0.01, 0.07],
    distance=210.0,
    distance_err=10,
    extinction_convolved=True,
    kind="cubic",
    Rv=3.1,
    ebv=0.1,
    independent=["Mbol", "mass"],
    initial_guess=[13.0, 0.6],
    method="least_squares"
   )

but I keep getting this error:

ValueError                                Traceback (most recent call last)

[<ipython-input-58-2b54e9b12163>](https://localhost:8080/#) in <cell line: 4>()
      2 ftr = WDfitter()
      3 
----> 4 ftr.fit(
      5     atmosphere="H",
      6     filters=["G3", "G3_BP", "G3_RP"],

[/usr/local/lib/python3.9/dist-packages/WDPhotTools/fitter.py](https://localhost:8080/#) in fit(self, atmosphere, filters, mags, mag_errors, allow_none, distance, distance_err, extinction_convolved, kind, Rv, ebv, ra, dec, independent, initial_guess, logg, atmosphere_interpolator, reuse_interpolator, method, nwalkers, nsteps, nburns, progress, refine, refine_bounds, kwargs_for_RBF, kwargs_for_CT, kwargs_for_minimize, kwargs_for_least_squares, kwargs_for_emcee)
   2061                         # the [:2] is to separate the distance from the filters
   2062                         self.best_fit_params[j][i] = float(
-> 2063                             self.interpolator[j][i](self.results[j].x[0])
   2064                         )
   2065 

[/usr/local/lib/python3.9/dist-packages/WDPhotTools/atmosphere_model_reader.py](https://localhost:8080/#) in atmosphere_interpolator(*x)
    486                 def atmosphere_interpolator(*x):
    487 
--> 488                     x_0, x_1 = np.asarray(x, dtype="object").reshape(-1)
    489 
    490                     if independent[0] in ["Teff", "age"]:

ValueError: not enough values to unpack (expected 2, got 1)

I am probably missing something obvious. I would be glad for any help.
Thanks.

WDLF inherits CoolingModelReader

Currently, WDLF holds an instance of CoolingModelReader. It should be inheriting it to make the future extensions of the package easier without needing to write a wrapper function for every new method added.

Running on scipy 1.8.1 ok but not scipy 1.9

Hi, thanks for letting me know. Also found that when running on scipy 1.8.1 everything runs ok but when running on scipy 1.9 I get the following error: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''.
Screenshot 2022-08-04 at 16 13 44

Originally posted by @cm775 in #15 (reply in thread)

Consider using a fraction of the total extinction as a function of distance

Harris et al. (2006) used the following scheme in https://arxiv.org/pdf/astro-ph/0510820.pdf

The SDSS database gives the total interstellar absorption and reddening along the line of sight for each star, determined from the reddening maps of Schlegel et al. (1998). Because most of the WDs in this paper have distances within a few hundred pc, they are affected by only a fraction of the total absorption and reddening. This fraction is determined as part of the fitting for the distance of each star in an iterative procedure. We make the assumption that the absorption is zero for stars with distances < 100 pc, that it is the full absorption for stars with distances from the Galactic plane |z| > 250 pc, and that the absorption varies linearly along the line of sight between these distances.

wrong extinction labelling

Error message as follow

>>> ftr.show_best_fit(display=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\xxxxxxxxxxxxxxxxxxxxxx\wdphottools\WDPhotTools\fitter.py", line 2268, in show_best_fit
    reddening = [
  File "c:\xxxxxxxxxxxxxxxxxxxxxx\wdphottools\WDPhotTools\fitter.py", line 2269, in <listcomp>
    self.best_fit_params[k]["Av_" + f]
KeyError: 'Av_g_ps1'

Manually rescale RBF interpolation for Teff

RBF interpolator does not natively support rescaling before interpolation. This has to be done before interpolating the Temperature because the dynamic range is very different from the mass, Mbol and logg.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.