sersic_xy¶
- artpop.space.sersic_xy(num_stars, distance, xy_dim, pixel_scale, r_eff=<Quantity 500. pc>, n=1.0, theta=<Quantity 45. deg>, ellip=0.3, num_r_eff=10, dx=0, dy=0, drop_outside=False, random_state=None)[source]¶
Sample xy positions from a two-dimensional Sersic distribution.
Note
To sample the Sersic distribution,
xy_from_grid
is used. This means that large sources (and/or largenum_r_eff
) eat up a lot of memory.- Parameters
- num_starsint
Number of stars (i.e., positions) to sample.
- distancefloat or
Quantity
Distance to source. If float is given, the units are assumed to be
Mpc
.- xy_dimlist-like
Dimensions of the mock image in xy coordinates. If int is given, will make the x and y dimensions the same.
- pixel_scalefloat or
Quantity
The pixel scale of the mock image. If a float is given, the units will be assumed to be
arcsec
perpixels
.- r_efffloat or
Quantity
, optional Effective radius of the source. If a float is given, the units are assumed to be
kpc
. Must be greater than zero.- nfloat, optional
Sersic index. Must be greater than zero.
- thetafloat or
Quantity
, optional Rotation angle, counterclockwise from the positive x-axis. If a float is given, the units are assumed to be
degree
.- ellipfloat, optional
Ellipticity defined as
1 - b/a
, whereb
is the semi-minor axis anda
is the semi-major axis.- num_r_efffloat, optional
Number of r_eff to sample positions within. This parameter is needed because the current Sersic sampling function samples from within a discrete grid. Default is 10.
- dxfloat, optional
Shift from center of image in pixels in the x direction.
- dyfloat, optional
Shift from center of image in pixels in the y direction.
- drop_outsidebool, optional
If True, drop all stars that fall outside of the image. In this case, the returned
ndarray
will not be masked.- random_state
None
, int, list of ints, orRandomState
If
None
, return theRandomState
singleton used bynumpy.random
. Ifint
, return a newRandomState
instance seeded with theint
. IfRandomState
, return it. Otherwise raiseValueError
.
- Returns
- xy
MaskedArray
Masked numpy array of xy positions. Positions that fall outside the mock image are masked.
- xy