Giter VIP home page Giter VIP logo

Comments (4)

wmorning avatar wmorning commented on August 14, 2024

I fixed the code so that it returns Msolar/Mpc^2 in the test case. Not sure if it is a perfect fix though. Let me know if there are any issues.

from evillens.

drphilmarshall avatar drphilmarshall commented on August 14, 2024

This fails for me:

import evillens as evil
lens = evil.GravitationalLens(0.4,1.5)

astropy.units.core.UnitsException: 'kg / (m)' and 'solMass / (Mpc2)'

are not convertible

Something's up! Also, I think units already knows about "Msun" as a unit of
mass - is this just a proxy for solMass?

On Tue, Sep 30, 2014 at 1:56 PM, Warren Morningstar <
[email protected]> wrote:

I fixed the code so that it returns Msolar/Mpc^2 in the test case. Not
sure if it is a perfect fix though. Let me know if there are any issues.


Reply to this email directly or view it on GitHub
#2 (comment).

from evillens.

wmorning avatar wmorning commented on August 14, 2024

Yeah, Msun and M_sun are both proxies for solMass.

As for the bug, I think I know what is happening. The function self.cosmological_angular_diameter_distance(z) for you might be returning a unitless output (while for me it returns a value with units of Mpc). If this is true, then the value of SigmaCrit would be in kg/m, since c/G returns a value with those units.

Try this:
import lens as evil
lens = evil.GravitationalLens(0.4,1.5) #this should make the error message you got, but it performs the earlier steps anyways.
print(self.Ds, self.Dd, self.Dds)

and see if the output is unitless.

from evillens.

drphilmarshall avatar drphilmarshall commented on August 14, 2024

Fixed by using anaconda python...

from evillens.

Related Issues (20)

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.