Spatial API

class soxs.spatial.AnnulusModel(ra0, dec0, r_in, r_out, theta=0.0, ellipticity=1.0)[source]

A model for positions of photons within an annulus shape with uniform surface brightness.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the annulus in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the annulus in degrees.

  • r_in (float, (value, unit) tuple, or Quantity) – The inner radius of the annulus in arcseconds.

  • r_out (float, (value, unit) tuple, or Quantity) – The outer radius of the annulus in arcseconds.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.BetaModel(ra0, dec0, r_c, beta, theta=0.0, ellipticity=1.0)[source]

A model for positions of photons with a beta-model shape.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the beta model in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the beta model in degrees.

  • r_c (float, (value, unit) tuple, or Quantity) – The core radius of the profile in arcseconds.

  • beta (float) – The “beta” parameter of the profile.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.DoubleBetaModel(ra0, dec0, r_c1, beta1, r_c2, beta2, sb_ratio, theta=0.0, ellipticity=1.0)[source]

A model for positions of photons with a double beta-model shape.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the beta model in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the beta model in degrees.

  • r_c1 (float, (value, unit) tuple, or Quantity) – The inner core radius of the profile in arcseconds.

  • beta1 (float) – The inner “beta” parameter of the profile.

  • r_c2 (float, (value, unit) tuple, or Quantity) – The outer core radius of the profile in arcseconds.

  • beta2 (float) – The outer “beta” parameter of the profile.

  • sb_ratio (float) – The ratio of the outer to the inner SB peak value

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.FillFOVModel(ra0, dec0, fov)[source]

A model for positions of photons which span a field of view.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the field of view in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the field of view in degrees.

  • fov (float, (value, unit) tuple, or Quantity) – The width of the field of view in arcminutes.

class soxs.spatial.PointSourceModel(ra0, dec0)[source]

A model for positions of photons emanating from a point source.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The RA of the source in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The Dec of the source in degrees.

class soxs.spatial.RadialArrayModel(ra0, dec0, r, S_r, theta=0.0, ellipticity=1.0)[source]

Create positions for photons using a table of radii and surface brightness contained in two arrays.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the source in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the source in degrees.

  • r (NumPy array) – The array of radii for the profile in arcseconds.

  • S_r (NumPy array) – The array of the surface brightness of the profile.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.RadialFileModel(ra0, dec0, radfile, theta=0.0, ellipticity=1.0)[source]

A model for positions of photons using a table of radii and surface brightness contained in a file.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the source in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the source in degrees.

  • radfile (string) – The file containing the table of radii and surface brightness. It must be an ASCII table with only two columns.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.RadialFunctionModel(ra0, dec0, func, theta=0.0, ellipticity=1.0)[source]

A model for positions of photons using a generic surface brightness profile as a function of radius.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the source in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the source in degrees.

  • func (function or function-like, something callable.) – A function that takes an array of radii and generates a radial surface brightness profile.

  • num_events (integer) – The number of events to generate.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the beta model in degrees. Only makes sense if ellipticity is added. Default: 0.0

  • ellipticity (float, optional) – The ellipticity of the radial profile, expressed as the ratio between the length scales of the x and y coordinates. The value of this parameter will shrink or expand the profile in the direction of the “y” coordinate, so you may need to rotate to get the shape you want. Default: 1.0

class soxs.spatial.RectangleModel(ra0, dec0, width, height, theta=0.0)[source]

A model for positions of photons within a rectangle or line shape.

Parameters:
  • ra0 (float, (value, unit) tuple, or Quantity) – The center RA of the rectangle in degrees.

  • dec0 (float, (value, unit) tuple, or Quantity) – The center Dec of the rectangle in degrees.

  • width (float, (value, unit) tuple, or Quantity) – The width of the rectangle in arcseconds.

  • height (float, (value, unit) tuple, or Quantity) – The height of the rectangle in arcseconds.

  • theta (float, (value, unit) tuple, or Quantity, optional) – The angle through which to rotate the rectangle in degrees. Default: 0.0

class soxs.spatial.SpatialModel(ra0, dec0)[source]
generate_coords(num_events, prng=None)[source]

Generate a sample of photon positions from this spatial model.

Parameters:
  • num_events (integer) – The number of events to generate.

  • prng (RandomState object, integer, or None) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is None, which sets the seed based on the system time.

generate_image(width, nx)[source]

Generate an ImageHDU from the SpatialModel.

Parameters:
  • width (float, (value, unit) tuple, or Quantity) – The width of the image in arcminutes.

  • nx (integer) – The resolution of the image, e.g. the number of pixels on a side.

soxs.spatial.gen_img_coords(width, nx, theta)[source]