GithubHelp home page GithubHelp logo

keflavich / agpy Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 17.0 7.35 MB

agpy (cloned from googlecode: agpy.googlecode.com)

License: MIT License

Python 49.50% Shell 0.68% Common Lisp 0.36% C 0.61% Vim Script 0.06% TeX 0.08% Jupyter Notebook 48.71%

agpy's People

Contributors

acviana avatar keflavich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

agpy's Issues

Use of deprecated np.rank function in mpfit/mpfit.py causes warning upon call of gaussfitter.gaussfit

numpy version: 1.11.1
agpy version: 0.1.3 (from auto conda repository)
conda: 4.2.13

Calling gaussfitter.gaussfit raises a warning due to np.rank L2277 of mpfit.py.

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy
/core/fromnumeric.py:2641: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` 
attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  VisibleDeprecationWarning)

Consider replacing all instances of numpy.rank to numpy.ndim to comply with the new numpy standards.
if numpy.rank(rr) != 2:
by
if numpy.ndim(rr) != 2:
Line 2278 of /Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/mpfit/mpfit.py

Gaussfitter: ValueError: assignment destination is read-only (agpy 0.1.3, numpy 1.11 in conda)

Environment:
conda version: 4.2.13
Numpy version: numpy 1.11.1 py27_0
agpy version: agpy 0.1.3 py27_0 auto

Python command-line:

from agpy import gaussfitter
mpfit2, psf_fit2 = gaussfitter.gaussfit(testimg,returnfitimage=True)

raises a ValueError:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-2f88faf6f9b5> in <module>()
     40 plt.imshow(testimg,interpolation="None")
     41 #tmpcs=reduction.EvalDirtyImage2(testimg,verbose=True)
---> 42 mpfit2, psf_fit2 = gaussfitter.gaussfit(testimg,returnfitimage=True)

/Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/gaussfitter.pyc in gaussfit(data, err, params, autoderiv, return_all, circle, fixed, limitedmin, limitedmax, usemoment, minpars, maxpars, rotate, vheight, quiet, returnmp, returnfitimage, **kwargs)
    241 #        p, cov, infodict, errmsg, success = optimize.leastsq(errorfunction,\
    242 #                params, full_output=1)
--> 243         mp = mpfit(mpfitfun(data,err),parinfo=parinfo,quiet=quiet)
    244 
    245 

/Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/mpfit/mpfit.py in __init__(self, fcn, xall, functkw, parinfo, ftol, xtol, gtol, damp, maxiter, factor, nprint, iterfunct, iterkw, nocovar, rescale, autoderivative, quiet, diag, epsfcn, debug)
   1165                 catch_msg = 'calculating LM parameter (MPFIT_)'
   1166                 [fjac, par, wa1, wa2] = self.lmpar(fjac, ipvt, diag, qtf,
-> 1167                                                      delta, wa1, wa2, par=par)
   1168                 # Store the direction p and x+p. Calculate the norm of p
   1169                 wa1 = -wa1

/Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/mpfit/mpfit.py in lmpar(self, r, ipvt, diag, qtb, delta, x, sdiag, par)
   2153             temp = numpy.sqrt(par)
   2154             wa1 = temp * diag
-> 2155             [r, x, sdiag] = self.qrsolv(r, ipvt, wa1, qtb, sdiag)
   2156             wa2 = diag*x
   2157             dxnorm = self.enorm(wa2)

/Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/mpfit/mpfit.py in qrsolv(self, r, ipvt, diag, qtb, sdiag)
   1974         #x.flags.writeable=True
   1975         # END JGMOD
-> 1976         x[ipvt] = wa
   1977         return (r, x, sdiag)
   1978 

ValueError: assignment destination is read-only

Temporary fix:
add
x.flags.writeable=True
before
x[ipvt] = wa
at L.1973 in qrsolv function in
/Users/jgirard/anaconda/lib/python2.7/site-packages/agpy/mpfit/mpfit.py

but requires some long-term fixing.

Thanks !

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.