Skip to content

Commit

Permalink
remove reimplemented func
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffjennings committed Oct 19, 2023
1 parent 446530e commit 1c5629c
Showing 1 changed file with 1 addition and 75 deletions.
76 changes: 1 addition & 75 deletions src/mpol/onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,78 +157,4 @@ def radialV(V, coords, geom, rescale_flux, bins=None):

bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2

return bin_centers, Vs


def get_1d_image_profile(image, coords, geom, bins=None, rescale_flux=True):
r"""
Obtain a 1D (radial) brightness profile I(r) from an image.
Parameters
----------
image : array
2D image array
coords : `mpol.coordinates.GridCoords` object
Instance of the `mpol.coordinates.GridCoords` class
geom : dict
Dictionary of source geometry. Keys:
"incl" : float, unit=[deg]
Inclination
"Omega" : float, unit=[deg]
Position angle of the ascending node
"omega" : float, unit=[deg]
Argument of periastron
"dRA" : float, unit=[arcsec]
Phase center offset in right ascension. Positive is west of north.
"dDec" : float, unit=[arcsec]
Phase center offset in declination.
rescale_flux : bool, default=True
If True, the brightness values are rescaled to account for the
difference between the inclined (observed) brightness and the
assumed face-on brightness, assuming the emission is optically thick.
The source's integrated (2D) flux is assumed to be:
:math:`F = \cos(i) \int_r^{r=R}{I(r) 2 \pi r dr}`.
No rescaling would be appropriate in the optically thin limit.
bins : array, default=None, unit=[arcsec]
Radial bin edges to use in calculating I(r). If None, bins will span
the full image, with widths equal to the hypotenuse of the pixels
Returns
-------
bin_centers : array, unit=[arcsec]
Radial coordinates of image at center of `bins`
Is : array, unit=[Jy / arcsec^2] (if `image` has these units)
Azimuthally averaged pixel brightness at `rs`
"""

# Cartesian pixel coordinates [arcsec]
xx, yy = coords.sky_x_centers_2D, coords.sky_y_centers_2D
# shift image center
xshift, yshift = xx - geom["dRA"], yy - geom["dDec"]

# deproject and rotate image
xdep, ydep = observer_to_flat(xshift, yshift,
omega=geom["omega"] * np.pi / 180,
incl=geom["incl"] * np.pi / 180,
Omega=geom["Omega"] * np.pi / 180,
)

# radial pixel coordinates
rr = np.ravel(np.hypot(xdep, ydep))

if bins is None:
step = np.hypot(coords.cell_size, coords.cell_size)
bins = np.arange(0.0, max(rr), step)

# number of points in radial bins
bin_counts, bin_edges = np.histogram(a=rr, bins=bins, weights=None)
# brightness in radial bins
Is, _ = np.histogram(a=rr, bins=bins, weights=np.ravel(image))
Is /= bin_counts

if rescale_flux: # TODO
Is *= np.cos(geom["incl"] * np.pi / 180)

bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2

return bin_centers, Is
return bin_centers, Vs

0 comments on commit 1c5629c

Please sign in to comment.