xy_from_grid¶
- artpop.space.xy_from_grid(num_stars, model, xy_dim, sample_dim=None, dx=0, dy=0, drop_outside=False, random_state=None)[source]¶
Sample xy positions from a discrete grid weighted by an arbitrary model.
- Parameters
- num_starsint
Number of stars (i.e., positions) to sample.
- model
Fittable2DModel A two-dimensional
astropymodel or a callable object that takes x and y grid positions arguments:model(xx, yy).- xy_dimint or list-like
Dimensions of the mock image in xy coordinates. If int is given, will make the x and y dimensions the same.
- sample_dimint or None, optional
Square dimension to sample within. This is useful if the mock image size is small compared to the scale of the model. To be useful,
sample_dimshould be larger thanxy_dim.- 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
ndarraywill not be masked.- random_state
None, int, list of ints, orRandomState If
None, return theRandomStatesingleton used bynumpy.random. Ifint, return a newRandomStateinstance seeded with theint. IfRandomState, return it. Otherwise raiseValueError.
- Returns
- xy
MaskedArrayorndarray Masked numpy array of xy positions. Positions that fall outside the mock image are masked. If
drop_outside == True, then the stars that fall outside of the image will be dropped and the returned array will not be masked.
- xy