Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*compare* (default=True): whether to include Kennicutt (1998) and
Bigiel+ (2008) for comparison
*radial* (default=True): should bins be annuli or a rectangular grid?
*bins* (default=10): How many radial bins should there be?
*legend*: boolean
whether to draw a legend or not
'''
if not radial:
raise NotImplementedError, "Sorry, only radial Schmidt law currently supported"
if center:
angmom.faceon(sim)
if isinstance(pretime, str):
pretime = units.Unit(pretime)
# select stuff
diskgas = sim.gas[filt.Disc(rmax, diskheight)]
diskstars = sim.star[filt.Disc(rmax, diskheight)]
formkey = 'tform'
try:
diskstars['tform']
except KeyError:
formkey = 'timeform'
youngstars = np.where(diskstars[formkey].in_units("Myr") >
density for the entire galaxy based on the half mass cold gas radius.
**Usage:**
import pynbody.plot as pp
pp.oneschmidtlawpoint(h[1])
*pretime* (default='50 Myr'): age of stars to consider for SFR
*diskheight* (default='3 kpc'): height of gas and stars above
and below disk considered for SF and gas densities.
*rmax* (default='20 kpc'): radius of disk considered
'''
if center:
angmom.faceon(sim)
cg = h[1].gas[filt.LowPass('temp', 1e5)]
cgd = cg[filt.Disc('30 kpc', '3 kpc')]
cgs = np.sort(cgd['rxy'].in_units('kpc'))
rhgas = cgs[len(cgs) / 2]
instars = h[1].star[filt.Disc(str(rhgas) + ' kpc', '3 kpc')]
minstars = np.sum(
instars[filt.LowPass('age', '100 Myr')]['mass'].in_units('Msol'))
ingasm = np.sum(
cg[filt.Disc(str(rhgas) + ' kpc', '3 kpc')]['mass'].in_units('Msol'))
rpc = rhgas * 1000.0
rkpc = rhgas
xsigma = ingasm / (np.pi * rpc * rpc)
ysigma = minstars / (np.pi * rkpc * rkpc * 1e8)
return xsigma, ysigma
density for the entire galaxy based on the half mass cold gas radius.
**Usage:**
import pynbody.plot as pp
pp.oneschmidtlawpoint(h[1])
*pretime* (default='50 Myr'): age of stars to consider for SFR
*diskheight* (default='3 kpc'): height of gas and stars above
and below disk considered for SF and gas densities.
*rmax* (default='20 kpc'): radius of disk considered
'''
if center:
angmom.faceon(sim)
cg = h[1].gas[filt.LowPass('temp', 1e5)]
cgd = cg[filt.Disc('30 kpc', '3 kpc')]
cgs = np.sort(cgd['rxy'].in_units('kpc'))
rhgas = cgs[len(cgs) / 2]
instars = h[1].star[filt.Disc(str(rhgas) + ' kpc', '3 kpc')]
minstars = np.sum(
instars[filt.LowPass('age', '100 Myr')]['mass'].in_units('Msol'))
ingasm = np.sum(
cg[filt.Disc(str(rhgas) + ' kpc', '3 kpc')]['mass'].in_units('Msol'))
rpc = rhgas * 1000.0
rkpc = rhgas
xsigma = ingasm / (np.pi * rpc * rpc)
ysigma = minstars / (np.pi * rkpc * rkpc * 1e8)
return xsigma, ysigma
def faceon_image(sim, *args, **kwargs):
"""
Rotate the simulation so that the disc of the passed halo is
face-on, then make an SPH image by passing the parameters into
the function image
For a description of keyword arguments see :func:`~pynbody.plot.sph.image`.
"""
from ..analysis import angmom
with angmom.faceon(sim):
return image(sim, *args, **kwargs)
*center(True)*: Automatically align face on and center?
*axes(False)*: In which axes (subplot) should it be plotted?
*filename* (None): name of file to which to save output
**needs a description of all keywords**
By default, sbprof will use the formation mass of the star.
In tipsy, this will be taken from the starlog file.
'''
if center:
logger.info("Centering...")
angmom.faceon(sim)
logger.info("Selecting disk stars")
diskstars = sim.star[filt.Disc(rmax, diskheight)]
logger.info("Creating profile")
ps = profile.Profile(diskstars, type=binning)
logger.info("Plotting")
r = ps['rbins'].in_units('kpc')
if axes:
plt = axes
else:
import matplotlib.pyplot as plt
if clear:
plt.clf()
plt.plot(r, ps['sb,' + band], linewidth=2, **kwargs)