Code Monkey home page Code Monkey logo

snpy's People

Contributors

chrisrburns avatar deerwhale avatar eabaron avatar emirkmo avatar obscode avatar wmwv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

snpy's Issues

Gaussian Process: outdated calls to PyMC class constructors pymc.gp.Mean and pymc.gp.Covariance

I'm a final year physics undergrad modelling photometric data on sn2022vqz. When attempting to fit or call the template class with method="gp", I get error messages saying that Mean(const) is not a valid attribute of gp object. Browsing the pymc codes on GitHub, there seems to be Mean and Covariance objects, although the keyword arguments the Covariance constructor may take do not match those input in the fit1dcurve.py of SnooPy. Not finding what the first gp.matern.euclidean in PyMC past documentations on their website, I couldn't replace it on my local machine.

Problems with fitMCMC (with proposed fixes)

Hi, I’m a grad student attempting to use snpy to fit some SNe Ia data. Specifically I’m attempting to use the fitMCMC method to enforce priors. I have two corrections which I believe should be made:

  1. In the documentation for fitMCMC (https://users.obs.carnegiescience.edu/cburns/SNooPyDocs/html/fitting_MCMC.html), the first fit is run using
s.fit(Rv=2.0)

This correctly fixes the Rv parameter. However, the MCMC fit is run using

s.fitMCMC(bands=['u','B','V','g','r','i','Y','J','H'], R_V="N,2.3,0.9")

R_V is not a parameter, Rv is. I believe passing this extra argument does nothing (e.g. if I pass foobar=’N,2.3,0.9’ then the fit will run without errors, but obviously that’s not a parameter).

I believe that R_V should be changed to Rv in the MCMCfit documentation.

  1. However, making sure parameter names match introduces an error. Here’s the partial traceback when I try to enforce a prior on EBVhost:
emcee: Exception while calling your likelihood function:
  params: [3.25815455e+01 1.55605255e+00 5.81841998e+04]
  args: ({'varlist': ['DM', 'dm15', 'EBVhost', 'Tmax'], 'fitflux': True, 'free': ['DM', 'dm15', 'Tmax'], 'DM': {'fixed': False, 'index': 0, 'prior_type': 'model'}, 'dm15': {'fixed': False, 'index': 1, 'prior_type': 'model'}, 'EBVhost': {'value': 'U,0,1', 'fixed': True}, . . .
. . .
"/Users/jamisonfrost/miniconda3/envs/earlysne/lib/python3.7/site-packages/snpy/model.py", line 473, in __call__
    temp = temp + self.Robs[band]*self.EBVhost + R*self.parent.EBVgal
TypeError: can't multiply sequence by non-int of type 'numpy.float64'

The parameter is getting fixed as a string, instead of translated into the desired prior. In order for the built-in priors (uniform, exponential, and normal) to be instantiated, I believe this line should be changed:

if type(args[var]) is bytes:

Currently it’s checking for an arg with type bytes, and I think this should be changed to str. Passing the argument as a byte string doesn’t work, I get ValueError: I don't understand the prior code b'U,0,1' (since it checks if st[0] in [‘U’, ‘G’, ‘E’], and b’U,0,1’[0] is apparently 85). I’ve tested it and making the change to str allows priors to be enforced as expected.

For completeness, I’m running this on python 3.7.9, snpy version 2.5.3.

Residual Plots on snpy Plotting Function

I have been using SNooPy to plot light curves in 3 bands and have been plotting them on a single plot with each band offset to allow for better viewing. A feature I think would be really nice would be to be able to plot residuals under this main plot to show how well the model curves fit to the data. Perhaps there could also be the option to specify which bands you'd want to plot the residuals for. This would be a really useful feature.

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.