Giter VIP home page Giter VIP logo

fastcat's People

Contributors

aimalz avatar johannct avatar slosar avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fastcat's Issues

Can't open .h5 file using fastcat

I am running the following code :

 `import numpy as np
  import fastcat as fc
  import treecorr as tc
  import healpy as hp
  import os

  data1=fc.Catalog(read_from="/home/nil/catalog0.h5")`

But I get the following error :

IOError Traceback (most recent call last)
in ()
5 import os
6
----> 7 data1=fc.Catalog(read_from="/home/nil/catalog0.h5")
8

/home/nil/Downloads/LSST/fastcat/catalog.pyc in init(self, N, fields, dNdz, bz, window, photoz, meta, read_from)
35 photoz=None,meta=None, read_from=None):
36 if (read_from!=None):
---> 37 self.readH5(read_from)
38 else:
39 self.data=np.zeros(N,dtype=map(lambda x:(x,np.float32),fields))

/home/nil/Downloads/LSST/fastcat/catalog.pyc in readH5(self, fname)
54 Reads Catalog from H5 file, specified as argument
55 """
---> 56 of=h5py.File(fname, "r")
57 self.data=of["objects"].value
58 self.meta=of["meta"].attrs

/home/nil/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/h5py/_hl/files.pyc in init(self, name, mode, driver, libver, userblock_size, swmr, *_kwds)
270
271 fapl = make_fapl(driver, libver, *_kwds)
--> 272 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
273
274 if swmr_support:

/home/nil/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/h5py/_hl/files.pyc in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
90 if swmr and swmr_support:
91 flags |= h5f.ACC_SWMR_READ
---> 92 fid = h5f.open(name, flags, fapl=fapl)
93 elif mode == 'r+':
94 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/tmp/pip-build-2HHYDA/h5py/h5py/_objects.c:2682)()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/tmp/pip-build-2HHYDA/h5py/h5py/_objects.c:2640)()

h5py/h5f.pyx in h5py.h5f.open (/tmp/pip-build-2HHYDA/h5py/h5py/h5f.c:1928)()

IOError: Unable to open file (Unable to open file: name = '/home/nil/catalog0.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

I have checked, catalog0.h5 is in /home/nil/ folder.

I also tried to run :

import numpy as np
import fastcat as fc
import treecorr as tc
import healpy as hp
import os

data1=fc.Catalog("/home/nil/catalog0.h5")

but I got another error:

TypeError Traceback (most recent call last)
in ()
5 import os
6
----> 7 data1=fc.Catalog("/home/nil/catalog0.h5")
8

/home/nil/Downloads/LSST/fastcat/catalog.pyc in init(self, N, fields, dNdz, bz, window, photoz, meta, read_from)
37 self.readH5(read_from)
38 else:
---> 39 self.data=np.zeros(N,dtype=map(lambda x:(x,np.float32),fields))
40 self.dNdz=dNdz
41 self.bz=bz

TypeError: an integer is required

Am I doing something wrong?

maximum-likelihood z

Would it make sense to have a getML(self,arr) function in the PhotoZ class?

Regardless of this, I think there may be a bug in getMeanRMS for Gaussian photo-z's. The function currently reads:

return arr["z"],self.sigma*(1+arr["z"])

but I think the latter is only correct if arr["z"] is the galaxy's true redshift (not its photo-z mean).

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.