Hi guys,

one more thing. I want to calculate the radiation pressure force, and when there is some then plot it with a log scale. However if I set:

def _ConvertAccel(data):
    return data.convert("Length") / (data.convert("Time"))**2.0
def _RadiationAccelerationMagnitude(field, data):
    return ( (data["RadAccel1"])**2.0 + \
             (data["RadAccel2"])**2.0 + \
             (data["RadAccel3"])**2.0 )**(1.0/2.0)
add_field("RadiationAccelerationMagnitude", function=_RadiationAccelerationMagnitude, take_log=True,convert_function=_ConvertAccel, units=r"\rm{cm}/\rm{s}^{2}")
def _RadiationForceMagnitude(field, data):
    return ( data["RadiationAccelerationMagnitude"] * data["Density"] * data["CellVolume"])
add_field("RadiationForceMagnitude", function=_RadiationForceMagnitude, take_log=True, units=r"\rm{dynes}")


before the stars switch on when the radiation acceleration baryon fields are all 0.0 everywhere I get the following error:


Traceback (most recent call last):
  File "MultiPlotProj.py", line 65, in <module>
    s = pc.add_projection("RadiationForceMagnitude", ax, weight_field="Density", figure=fig, axes=axes[0][3], use_colorbar=False)
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_collection.py", line 742, in add_projection
    size=fig_size, periodic=periodic))
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_types.py", line 310, in __init__
    self.__init_temp_image(use_colorbar)
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_types.py", line 347, in __init_temp_image
    self.set_width(1,'unitary')
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_types.py", line 436, in set_width
    self._refresh_display_width()
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_types.py", line 454, in _refresh_display_width
    self._redraw_image()
  File "/home/h-clark/YT/src/yt-hg/yt/visualization/plot_types.py", line 384, in _redraw_image
    newmin = na.nanmin(buff[bI])
  File "/home/h-clark/YT/lib/python2.6/site-packages/numpy/lib/function_base.py", line 1494, in nanmin
    return _nanop(np.min, np.inf, a, axis)
  File "/home/h-clark/YT/lib/python2.6/site-packages/numpy/lib/function_base.py", line 1355, in _nanop
    res = op(y, axis=axis)
  File "/home/h-clark/YT/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 1829, in amin
    return amin(axis, out)
ValueError: zero-size array to ufunc.reduce without identity


Is there a way to set it so I get a log scale when plotting projections that does not break when the fields are all zero?

Many thanks,

Libby



--
Elizabeth Harper-Clark MA MSci
PhD Candidate, Canadian Institute for Theoretical Astrophysics, UofT
Sciences and Engineering Coordinator, Teaching Assistants' Training Program, UofT

www.astro.utoronto.ca/~h-clark
h-clark@cita.utoronto.ca
Astronomy office phone: +1-416-978-5759