Commit d2820f14 authored by Marco Selig's avatar Marco Selig
Browse files

bugfix in hp.get_plot; improvements in probing._parallel_probing;...

bugfix in hp.get_plot; improvements in probing._parallel_probing; nifty_tools.py added; version number updated.
parent d876195c
...@@ -484,7 +484,7 @@ class _about(object): ## nifty support class for global settings ...@@ -484,7 +484,7 @@ class _about(object): ## nifty support class for global settings
""" """
## version ## version
self._version = "0.4.2" self._version = "0.5.0"
## switches and notifications ## switches and notifications
self._errors = notification(default=True,ccode=notification._code) self._errors = notification(default=True,ccode=notification._code)
...@@ -2151,7 +2151,7 @@ class rg_space(space): ...@@ -2151,7 +2151,7 @@ class rg_space(space):
.. / __/ / _ / .. / __/ / _ /
.. / / / /_/ / .. / / / /_/ /
.. /__/ \____ / space class .. /__/ \____ / space class
.. /_____/ .. /______/
NIFTY subclass for spaces of regular Cartesian grids. NIFTY subclass for spaces of regular Cartesian grids.
...@@ -5427,6 +5427,7 @@ class hp_space(space): ...@@ -5427,6 +5427,7 @@ class hp_space(space):
cmap = pl.cm.jet ## default cmap = pl.cm.jet ## default
cmap.set_under(color='k',alpha=0.0) ## transparent box cmap.set_under(color='k',alpha=0.0) ## transparent box
hp.mollview(x,fig=None,rot=None,coord=None,unit=unit,xsize=800,title=title,nest=False,min=vmin,max=vmax,flip="astro",remove_dip=False,remove_mono=False,gal_cut=0,format="%g",format2="%g",cbar=cbar,cmap=cmap,notext=False,norm=norm,hold=False,margins=None,sub=None) hp.mollview(x,fig=None,rot=None,coord=None,unit=unit,xsize=800,title=title,nest=False,min=vmin,max=vmax,flip="astro",remove_dip=False,remove_mono=False,gal_cut=0,format="%g",format2="%g",cbar=cbar,cmap=cmap,notext=False,norm=norm,hold=False,margins=None,sub=None)
fig = pl.gcf()
if(bool(kwargs.get("save",False))): if(bool(kwargs.get("save",False))):
fig.savefig(str(kwargs.get("save")),dpi=None,facecolor=None,edgecolor=None,orientation='portrait',papertype=None,format=None,transparent=False,bbox_inches=None,pad_inches=0.1) fig.savefig(str(kwargs.get("save")),dpi=None,facecolor=None,edgecolor=None,orientation='portrait',papertype=None,format=None,transparent=False,bbox_inches=None,pad_inches=0.1)
...@@ -7437,8 +7438,6 @@ def arctanh(x): ...@@ -7437,8 +7438,6 @@ def arctanh(x):
else: else:
return np.arctanh(np.array(x)) return np.arctanh(np.array(x))
## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def sqrt(x): def sqrt(x):
""" """
Returns the square root of a given object. Returns the square root of a given object.
...@@ -7466,8 +7465,6 @@ def sqrt(x): ...@@ -7466,8 +7465,6 @@ def sqrt(x):
else: else:
return np.sqrt(np.array(x)) return np.sqrt(np.array(x))
## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def exp(x): def exp(x):
""" """
Returns the exponential of a given object. Returns the exponential of a given object.
...@@ -7541,8 +7538,6 @@ def log(x,base=None): ...@@ -7541,8 +7538,6 @@ def log(x,base=None):
else: else:
raise ValueError(about._errors.cstring("ERROR: invalid input basis.")) raise ValueError(about._errors.cstring("ERROR: invalid input basis."))
## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def conjugate(x): def conjugate(x):
""" """
Computes the complex conjugate of a given object. Computes the complex conjugate of a given object.
...@@ -7565,9 +7560,6 @@ def conjugate(x): ...@@ -7565,9 +7560,6 @@ def conjugate(x):
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
##-----------------------------------------------------------------------------
...@@ -7679,7 +7671,7 @@ class operator(object): ...@@ -7679,7 +7671,7 @@ class operator(object):
self.uni = bool(uni) self.uni = bool(uni)
if(self.domain.discrete): if(self.domain.discrete):
self.imp = False self.imp = True
else: else:
self.imp = bool(imp) self.imp = bool(imp)
...@@ -9245,7 +9237,7 @@ class power_operator(diagonal_operator): ...@@ -9245,7 +9237,7 @@ class power_operator(diagonal_operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def set_power(self,newspec,bare=None,pindex=None,**kwargs): def set_power(self,newspec,bare=True,pindex=None,**kwargs):
""" """
Sets the power spectrum of the diagonal operator Sets the power spectrum of the diagonal operator
...@@ -9280,14 +9272,12 @@ class power_operator(diagonal_operator): ...@@ -9280,14 +9272,12 @@ class power_operator(diagonal_operator):
binbounds : {list, array}, *optional* binbounds : {list, array}, *optional*
User specific inner boundaries of the bins, which are preferred User specific inner boundaries of the bins, which are preferred
over the above parameters; by default no binning is done over the above parameters; by default no binning is done
(default: None). vmin : {scalar, list, ndarray, field}, *optional* (default: None).
Lower limit of the uniform distribution if ``random == "uni"``
(default: 0).
""" """
if(bare is None): # if(bare is None):
about.warnings.cprint("WARNING: bare keyword set to default.") # about.warnings.cprint("WARNING: bare keyword set to default.")
bare = True # bare = True
## check implicit pindex ## check implicit pindex
if(pindex is None): if(pindex is None):
try: try:
...@@ -10615,13 +10605,15 @@ class probing(object): ...@@ -10615,13 +10605,15 @@ class probing(object):
pool = mp(processes=self.ncpu,initializer=None,initargs=(),maxtasksperchild=self.nper) pool = mp(processes=self.ncpu,initializer=None,initargs=(),maxtasksperchild=self.nper)
try: try:
## retrieve results ## retrieve results
results = pool.map_async(self._serial_probing,zip(seed,np.arange(self.nrun,dtype=np.int)),chunksize=None,callback=None).get(timeout=None) results = pool.map(self._serial_probing,zip(seed,np.arange(self.nrun,dtype=np.int)),chunksize=None)#,callback=None).get(timeout=None) ## map_async replaced
## close pool ## close and join pool
about.infos.cflush(" done.") about.infos.cflush(" done.")
pool.close() pool.close()
pool.join()
except: except:
## terminate pool ## terminate and join pool
pool.terminate() pool.terminate()
pool.join()
raise Exception(about._errors.cstring("ERROR: unknown. NOTE: pool terminated.")) ## traceback by looping raise Exception(about._errors.cstring("ERROR: unknown. NOTE: pool terminated.")) ## traceback by looping
## cleanup ## cleanup
results = [rr for rr in results if(rr is not None)] results = [rr for rr in results if(rr is not None)]
......
This diff is collapsed.
...@@ -23,7 +23,7 @@ from distutils.core import setup ...@@ -23,7 +23,7 @@ from distutils.core import setup
import os import os
setup(name="nifty", setup(name="nifty",
version="0.4.2", version="0.5.0",
description="Numerical Information Field Theory", description="Numerical Information Field Theory",
author="Marco Selig", author="Marco Selig",
author_email="mselig@mpa-garching.mpg.de", author_email="mselig@mpa-garching.mpg.de",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment