Skip to content

structure

Functions for generating structure. This includes both cluster profiles and substructure.

a10(dx, dy, dz, theta, P0, c500, m500, gamma, alpha, beta, z, xyz)

gNFW pressure profile in 3d based on Arnaud2010. Compared to the function gnfw, this function fixes r1/r2/r3 to r500. This function does not include smoothing or declination stretch which should be applied at the end.

See the docstring for gnfw for more details.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
P0 float

Amplitude of the pressure profile Units: unitless

required
c500 float

Concentration parameter at a density contrast of 500 Units: unitless

required
m500 float

Mass at a density contrast of 500 Units: M_solar

required
gamma float

The central slope Units: unitless

required
alpha float

The intermediate slope Units: unitless

required
beta float

The outer slope Units: unitless

required
z float

Redshift of cluster Units: redshift

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The gnfw model evaluated on the grid.

Source code in witch/structure.py
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
@jax.jit
def a10(
    dx: float,
    dy: float,
    dz: float,
    theta: float,
    P0: float,
    c500: float,
    m500: float,
    gamma: float,
    alpha: float,
    beta: float,
    z: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    gNFW pressure profile in 3d based on [Arnaud2010](https://ui.adsabs.harvard.edu/abs/2010A%26A...517A..92A/).
    Compared to the function gnfw, this function fixes r1/r2/r3 to r500.
    This function does not include smoothing or declination stretch
    which should be applied at the end.

    See the docstring for `gnfw` for more details.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    P0 : float
        Amplitude of the pressure profile
        Units: unitless
    c500 : float
        Concentration parameter at a density contrast of 500
        Units: unitless
    m500 : float
        Mass at a density contrast of 500
        Units: M_solar
    gamma : float
        The central slope
        Units: unitless
    alpha : float
        The intermediate slope
        Units: unitless
    beta : float
        The outer slope
        Units: unitless
    z : float
        Redshift of cluster
        Units: redshift
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The gnfw model evaluated on the grid.
    """

    nz = get_nz(z)
    hz = get_hz(z)
    da = get_da(z)  # TODO pass these arguments rather than recompute them everytime???

    r500 = (m500 / (4.00 * jnp.pi / 3.00) / 5.00e02 / nz) ** (1.00 / 3.00)
    r_1, r_2, r_3 = r500 / da, r500 / da, r500 / da

    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    r = c500 * jnp.sqrt(x**2 + y**2 + z**2)
    denominator = (r**gamma) * (1 + r**alpha) ** ((beta - gamma) / alpha)

    P500 = (
        1.65e-03
        * (m500 / (3.00e14 / h70)) ** (2.00 / 3.00 + ap)
        * hz ** (8.00 / 3.00)
        * h70**2
    )

    return P500 * P0 / denominator

add_exponential(pressure, xyz, dx, dy, dz, r_1, r_2, r_3, theta, amp, xk, x0, yk, y0, zk, z0)

Add ellipsoid with exponential structure to 3d pressure profile.

After transforming the grid the region where \(\sqrt{x^2 + y^2 + z^2} \leq 1\) will be multiplied by a factor of \(1 + P_{0} e^{x_k(x-x_0) + y_k(y-y_0) + z_k(z-z_0)}\) where \(P_{0}\) is amp.

Parameters:

Name Type Description Default
pressure Array

The pressure profile to modify with this ellipsoid. Should be evaluated on the same grid as xyz.

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. The absolute value of these is degenerate with sigma. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
amp float

Factor by which pressure is enhanced at the peak of ellipsoid. Units: unitless

required
xk float

Power of exponential in RA direction Units: unitless

required
x0 float

RA offset of exponential. Note that this is in transformed coordinates so x0=1 is at xs + sr_1. Units: arcsec

required
yk float

Power of exponential in Dec direction Units: unitless

required
y0 float

Dec offset of exponential. Note that this is in transformed coordinates so y0=1 is at ys + sr_2. Units: arcsec

required
zk float

Power of exponential along the line of sight Units: unitless

required
z0 float

Line of sight offset of exponential. Note that this is in transformed coordinates so z0=1 is at zs + sr_3. Units: arcsec

required

Returns:

Name Type Description
new_pressure Array

Pressure profile with ellipsoid added.

Source code in witch/structure.py
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
@jax.jit
def add_exponential(
    pressure: jax.Array,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    amp: float,
    xk: float,
    x0: float,
    yk: float,
    y0: float,
    zk: float,
    z0: float,
) -> jax.Array:
    r"""
    Add ellipsoid with exponential structure to 3d pressure profile.

    After transforming the grid the region where $\sqrt{x^2 + y^2 + z^2} \leq 1$
    will be multiplied by a factor of $1 + P_{0} e^{x_k(x-x_0) + y_k(y-y_0) + z_k(z-z_0)}$
    where $P_{0}$ is `amp`.

    Parameters
    ----------
    pressure : jax.Array
        The pressure profile to modify with this ellipsoid.
        Should be evaluated on the same grid as `xyz`.
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis. The absolute value of these is degenerate with sigma.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    amp : float
        Factor by which pressure is enhanced at the peak of ellipsoid.
        Units: unitless
    xk : float
        Power of exponential in RA direction
        Units: unitless
    x0 : float
        RA offset of exponential.
        Note that this is in transformed coordinates so x0=1 is at xs + sr_1.
        Units: arcsec
    yk : float
        Power of exponential in Dec direction
        Units: unitless
    y0 : float
        Dec offset of exponential.
        Note that this is in transformed coordinates so y0=1 is at ys + sr_2.
        Units: arcsec
    zk : float
        Power of exponential along the line of sight
        Units: unitless
    z0 : float
        Line of sight offset of exponential.
        Note that this is in transformed coordinates so z0=1 is at zs + sr_3.
        Units: arcsec

    Returns
    -------
    new_pressure : Array
        Pressure profile with ellipsoid added.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    exponential = amp * jnp.exp(((x - x0) * xk) + ((y - y0) * yk) + ((z - z0) * zk))

    new_pressure = jnp.where(
        jnp.sqrt(x**2 + y**2 + z**2) > 1, pressure, (1 + exponential) * pressure
    )
    return new_pressure

add_powerlaw(pressure, xyz, dx, dy, dz, r_1, r_2, r_3, theta, amp, phi0, k_r, k_phi)

Add ellipsoid with power law structure to 3d pressure profile.

After transforming the grid the region where \(\sqrt{x^2 + y^2 + z^2} \leq 1\) will be multiplied by a factor of \(1 + P_{0}(1 - {1 + r}^{-k_r})(1 - {1 + \phi}^{-k_{\phi}})\). Where \(r\) and \(\phi\) are the usual polar coordinates and \(P_{0}\) is amp.

Parameters:

Name Type Description Default
pressure Array

The pressure profile to modify with this ellipsoid. Should be evaluated on the same grid as xyz.

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. The absolute value of these is degenerate with sigma. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
amp float

Factor by which pressure is enhanced within the ellipsoid. Units: unitless

required
phi0 float

Polar angle of nose of power law. This is CCW from the x-axis, after the grid rotation. See arctan2 documentation Units: radians

required
k_r float

Slope of power law in radial direction. Units: unitless

required
k_phi float

Slope of power law in polar direction. Units: unitless

required

Returns:

Name Type Description
new_pressure Array

Pressure profile with ellipsoid added.

Source code in witch/structure.py
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
@jax.jit
def add_powerlaw(
    pressure: jax.Array,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    amp: float,
    phi0: float,
    k_r: float,
    k_phi: float,
) -> jax.Array:
    r"""
    Add ellipsoid with power law structure to 3d pressure profile.

    After transforming the grid the region where $\sqrt{x^2 + y^2 + z^2} \leq 1$
    will be multiplied by a factor of $1 + P_{0}(1 - {1 + r}^{-k_r})(1 - {1 + \phi}^{-k_{\phi}})$.
    Where $r$ and $\phi$ are the usual polar coordinates and $P_{0}$ is `amp`.

    Parameters
    ----------
    pressure : jax.Array
        The pressure profile to modify with this ellipsoid.
        Should be evaluated on the same grid as `xyz`.
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis. The absolute value of these is degenerate with sigma.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    amp : float
        Factor by which pressure is enhanced within the ellipsoid.
        Units: unitless
    phi0 : float
        Polar angle of nose of power law. This is CCW from the x-axis,
        after the grid rotation. See arctan2 documentation
        Units: radians
    k_r : float
        Slope of power law in radial direction.
        Units: unitless
    k_phi : float
        Slope of power law in polar direction.
        Units: unitless

    Returns
    -------
    new_pressure : Array
        Pressure profile with ellipsoid added.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)
    r = jnp.sqrt(x**2 + y**2 + z**2)
    phi = abs((jnp.arctan2(y, x) - phi0) % (2 * jnp.pi) - jnp.pi) / jnp.pi

    powerlaw = (
        amp
        * (1 - jnp.float_power(1 + r, -1.0 * k_r))
        * (1 - jnp.float_power(1 + phi, -1 * k_phi))
    )
    new_pressure = jnp.where(r > 1, pressure, (1 + powerlaw) * pressure)
    return new_pressure

add_powerlaw_cos(pressure, xyz, dx, dy, dz, r_1, r_2, r_3, theta, amp, phi0, k_r, omega)

Add ellipsoid with radial power law and angular cosine dependant structure to 3d pressure profile.

After transforming the grid the region where \(\sqrt{x^2 + y^2 + z^2} \leq 1\) will be multiplied by a factor of \(1 + P_{0} ({1 + r}^{-k_r}) \left| cos(\omega\phi) \right|\). Where \(r\) and \(\phi\) are the usual polar coordinates and \(P_{0}\) is amp.

Parameters:

Name Type Description Default
pressure Array

The pressure profile to modify with this ellipsoid. Should be evaluated on the same grid as xyz.

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. The absolute value of these is degenerate with sigma. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: unitless

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: unitless

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
amp float

Factor by which pressure is enhanced within the ellipsoid. Units: unitless

required
phi0 float

Polar angle of nose of power law. This is CCW from the x-axis, after the grid rotation. See arctan2 documentation Units: radians

required
k_r float

Slope of power law in radial direction. Units: unitless

required
omega float

Angular freqency of the cosine term. Units: unitless

required

Returns:

Name Type Description
new_pressure Array

Pressure profile with ellipsoid added.

Source code in witch/structure.py
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
@jax.jit
def add_powerlaw_cos(
    pressure: jax.Array,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    amp: float,
    phi0: float,
    k_r: float,
    omega: float,
) -> jax.Array:
    r"""
    Add ellipsoid with radial power law and angular cosine dependant structure to 3d pressure profile.

    After transforming the grid the region where $\sqrt{x^2 + y^2 + z^2} \leq 1$
    will be multiplied by a factor of $1 + P_{0} ({1 + r}^{-k_r}) \left| cos(\omega\phi) \right|$.
    Where $r$ and $\phi$ are the usual polar coordinates and $P_{0}$ is `amp`.

    Parameters
    ----------
    pressure : jax.Array
        The pressure profile to modify with this ellipsoid.
        Should be evaluated on the same grid as `xyz`.
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis. The absolute value of these is degenerate with sigma.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: unitless
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: unitless
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    amp : float
        Factor by which pressure is enhanced within the ellipsoid.
        Units: unitless
    phi0 : float
         Polar angle of nose of power law. This is CCW from the x-axis,
         after the grid rotation. See arctan2 documentation
         Units: radians
    k_r : float
        Slope of power law in radial direction.
        Units: unitless
    omega : float
        Angular freqency of the cosine term.
        Units: unitless

    Returns
    -------
    new_pressure : Array
        Pressure profile with ellipsoid added.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)
    r = jnp.sqrt(x**2 + y**2 + z**2)
    phi = (jnp.arctan2(y, x) - phi0) % (2 * jnp.pi)

    powerlaw = amp * jnp.abs(jnp.cos(omega * phi)) * jnp.float_power(r, k_r)
    new_pressure = jnp.where(r > 1, pressure, (1 + powerlaw) * pressure)
    return new_pressure

add_uniform(pressure, xyz, dx, dy, dz, r_1, r_2, r_3, theta, amp)

Add ellipsoid with uniform structure to 3d pressure profile.

After transforming the grid the region where \(\sqrt{x^2 + y^2 + z^2} \leq 1\) will be multiplied by a factor of \(1 + P_{0}\) where \(P_{0}\) is amp.

Parameters:

Name Type Description Default
pressure Array

The pressure profile to modify with this ellipsoid. Should be evaluated on the same grid as xyz.

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. The absolute value of these is degenerate with sigma. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
amp float

Factor by which pressure is enhanced within the ellipsoid. Units: unitless

required

Returns:

Name Type Description
new_pressure Array

Pressure profile with ellipsoid added.

Source code in witch/structure.py
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
@jax.jit
def add_uniform(
    pressure: jax.Array,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    amp: float,
) -> jax.Array:
    r"""
    Add ellipsoid with uniform structure to 3d pressure profile.

    After transforming the grid the region where $\sqrt{x^2 + y^2 + z^2} \leq 1$
    will be multiplied by a factor of $1 + P_{0}$ where $P_{0}$ is `amp`.

    Parameters
    ----------
    pressure : jax.Array
        The pressure profile to modify with this ellipsoid.
        Should be evaluated on the same grid as `xyz`.
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis. The absolute value of these is degenerate with sigma.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    amp : float
        Factor by which pressure is enhanced within the ellipsoid.
        Units: unitless

    Returns
    -------
    new_pressure : Array
        Pressure profile with ellipsoid added.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    new_pressure = jnp.where(
        jnp.sqrt(x**2 + y**2 + z**2) > 1, pressure, (1 + amp) * pressure
    )
    return new_pressure

cylindrical_beta(dx, dy, dz, L, theta, P0, r_c, beta, xyz)

This function does not include smoothing or declination stretch which should be applied at the end.

Once the grid is transformed the profile is computed as:

\[ P_{0}\left( 1 + \frac{y^2 + z^2}{{r_c}^2} \right)^{-1.5\beta} \]

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
L float

Length of the cylinder. Aligned with the x-axis. Note that we consider anything where \(\left| x \right| \\leq L\) to be in the profile, so the actual length is \(2L\). Units: arcsec

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
P0 float

Amplitude of the pressure profile. Units: unitless

required
r_c float

The critical radius of the cylindrical profile. Units: arcsec

required
beta float

Beta value of isobeta model. Units: unitless

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The cylindrical beta model evaluated on the grid.

Source code in witch/structure.py
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
@jax.jit
def cylindrical_beta(
    dx: float,
    dy: float,
    dz: float,
    L: float,
    theta: float,
    P0: float,
    r_c: float,
    beta: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""

    This function does not include smoothing or declination stretch
    which should be applied at the end.

    Once the grid is transformed the profile is computed as:

    $$
    P_{0}\left( 1 + \frac{y^2 + z^2}{{r_c}^2} \right)^{-1.5\beta}
    $$

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    L : float
        Length of the cylinder.
        Aligned with the x-axis.
        Note that we consider anything where $\left| x \right| \\leq L$
        to be in the profile, so the actual length is $2L$.
        Units: arcsec
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    P0 : float
        Amplitude of the pressure profile.
        Units: unitless
    r_c : float
        The critical radius of the cylindrical profile.
        Units: arcsec
    beta : float
        Beta value of isobeta model.
        Units: unitless
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The cylindrical beta model evaluated on the grid.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, 1.0, 1.0, 1.0, theta, xyz)
    r = jnp.sqrt(y**2 + z**2)
    powerlaw = P0 / (1.0 + (r / r_c) ** 2) ** (3.0 / 2.0 * beta)

    pressure = jnp.where(jnp.abs(x) >= L / 2.0, 0, powerlaw)

    return pressure

cylindrical_beta_2d(dx, dy, dz, L, theta, phi, P0, r_c, beta, xyz)

Same as cylindrical_beta but compute 2D profile analytically. Should be faster than 3D integration. Useful when you are not modifying the 3D grid. Also includes the LoS angle phi.

Once the grid is transformed the profile is computed as:

\[ y(R) = \frac{\sqrt{\pi} \Gamma (3\beta/2 - 1/2)}{\Gamma(3\beta /2)} \sec{\phi} P_0 r_c [1+\frac{R}{r_c}^2]^{-3\beta /2 + 1/2} \]

Note the missing factor of

\[ \frac{\sigma_T}{m_e c^2} \]

is provided by the unit conversion functionality.

Derivation from Craig Sarazin

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
L float

Length of the cylinder. Aligned with the x-axis. Note that we consider anything where \(\left| x \right| \\leq L\) to be in the profile, so the actual length is \(2L\). Units: arcsec

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
phi float

Angle to rotate in xz-plane Units: radians

required
P0 float

Amplitude of the pressure profile. Units: unitless

required
r_c float

The critical radius of the cylindrical profile. Units: arcsec

required
beta float

Beta value of isobeta model. Units: unitless

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The cylindrical beta model evaluated on the grid.

Source code in witch/structure.py
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
@jax.jit
def cylindrical_beta_2d(
    dx: float,
    dy: float,
    dz: float,
    L: float,
    theta: float,
    phi: float,
    P0: float,
    r_c: float,
    beta: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""

    Same as cylindrical_beta but compute 2D profile analytically.
    Should be faster than 3D integration. Useful when you are
    not modifying the 3D grid. Also includes the LoS angle phi.

    Once the grid is transformed the profile is computed as:

    $$
    y(R) = \frac{\sqrt{\pi} \Gamma (3\beta/2 - 1/2)}{\Gamma(3\beta /2)} \sec{\phi} P_0 r_c [1+\frac{R}{r_c}^2]^{-3\beta /2 + 1/2}
    $$

    Note the missing factor of

    $$
    \frac{\sigma_T}{m_e c^2}
    $$

    is provided by the unit conversion functionality.

    Derivation from Craig Sarazin
    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    L : float
        Length of the cylinder.
        Aligned with the x-axis.
        Note that we consider anything where $\left| x \right| \\leq L$
        to be in the profile, so the actual length is $2L$.
        Units: arcsec
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    phi : float
        Angle to rotate in xz-plane
        Units: radians
    P0 : float
        Amplitude of the pressure profile.
        Units: unitless
    r_c : float
        The critical radius of the cylindrical profile.
        Units: arcsec
    beta : float
        Beta value of isobeta model.
        Units: unitless
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The cylindrical beta model evaluated on the grid.
    """
    x, y, *_ = transform_grid(dx, dy, dz, 1.0, 1.0, 1.0, theta, xyz)
    rr = x[..., 0] ** 2 + y[..., 0] ** 2

    gamma_term = (
        jnp.sqrt(jnp.pi) * jax.scipy.special.gamma(3 * beta / 2 - 1 / 2)
    ) / jax.scipy.special.gamma(3 * beta / 2)

    r_term = (1 + (rr / r_c) ** 2) ** (-3 * beta / 2 + 1 / 2)

    return gamma_term * 1 / jnp.cos(phi) * (P0 * r_c) * r_term

ea10(dx, dy, dz, r_1, r_2, r_3, theta, P0, c500, m500, gamma, alpha, beta, z, xyz)

Eliptical gNFW pressure profile in 3d based on Arnaud2010. r_ell is computed in the usual way for an a10 profile, then the axes are scaled according to r_1, r_2, r_3, with a normalization applied. This function does not include smoothing or declination stretch which should be applied at the end.

See the docstring for gnfw for more details.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
P0 float

Amplitude of the pressure profile Units: unitless

required
c500 float

Concentration parameter at a density contrast of 500 Units: unitless

required
m500 float

Mass at a density contrast of 500 Units: M_solar

required
gamma float

The central slope Units: unitless

required
alpha float

The intermediate slope Units: unitless

required
beta float

The outer slope Units: unitless

required
z float

Redshift of cluster Units: redshift

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The gnfw model evaluated on the grid.

Source code in witch/structure.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
@jax.jit
def ea10(
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    P0: float,
    c500: float,
    m500: float,
    gamma: float,
    alpha: float,
    beta: float,
    z: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    Eliptical gNFW pressure profile in 3d based on Arnaud2010.
    r_ell is computed in the usual way for an a10 profile, then the axes are
    scaled according to r_1, r_2, r_3, with a normalization applied.
    This function does not include smoothing or declination stretch
    which should be applied at the end.

    See the docstring for `gnfw` for more details.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    P0 : float
        Amplitude of the pressure profile
        Units: unitless
    c500 : float
        Concentration parameter at a density contrast of 500
        Units: unitless
    m500 : float
        Mass at a density contrast of 500
        Units: M_solar
    gamma : float
        The central slope
        Units: unitless
    alpha : float
        The intermediate slope
        Units: unitless
    beta : float
        The outer slope
        Units: unitless
    z : float
        Redshift of cluster
        Units: redshift
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The gnfw model evaluated on the grid.
    """
    nz = get_nz(z)
    hz = get_hz(z)
    da = get_da(z)  # TODO pass these arguments rather than recompute them everytime???

    r500 = (m500 / (4.00 * jnp.pi / 3.00) / 5.00e02 / nz) ** (1.00 / 3.00)
    r_ell = r500 / da
    r_norm = (r_1 * r_2 * r_3) ** (1 / 3)

    r_1 *= r_ell / r_norm
    r_2 *= r_ell / r_norm
    r_3 *= r_ell / r_norm

    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    r = c500 * jnp.sqrt(x**2 + y**2 + z**2)
    denominator = (r**gamma) * (1 + r**alpha) ** ((beta - gamma) / alpha)

    P500 = (
        1.65e-03
        * (m500 / (3.00e14 / h70)) ** (2.00 / 3.00 + ap)
        * hz ** (8.00 / 3.00)
        * h70**2
    )

    return P500 * P0 / denominator

egaussian(dx, dy, dz, r_1, r_2, r_3, theta, sigma, amp, xyz)

Elliptical gaussian profile in 3d. This function does not include smoothing or declination stretch which should be applied at the end.

Once the grid is transformed the profile is computed as:

\[ P_{0} e^{-\frac{x^2 + y^2 + z^2}{2\sigma^2}} \]

where \(P_{0}\) is amp.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. The absolute value of these is degenerate with sigma. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
sigma float

Sigma value of gaussian model. Units: arcsec

required
amp float

Amplitude of gaussian model. Units: Jy

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The gaussain model evaluated on the grid.

Source code in witch/structure.py
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
@jax.jit
def egaussian(
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    sigma: float,
    amp: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    Elliptical gaussian profile in 3d.
    This function does not include smoothing or declination stretch
    which should be applied at the end.

    Once the grid is transformed the profile is computed as:

    $$
    P_{0} e^{-\frac{x^2 + y^2 + z^2}{2\sigma^2}}
    $$

    where $P_{0}$ is `amp`.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis. The absolute value of these is degenerate with sigma.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    sigma : float
        Sigma value of gaussian model.
        Units: arcsec
    amp : float
        Amplitude of gaussian model.
        Units: Jy
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The gaussain model evaluated on the grid.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    rr = x**2 + y**2 + z**2
    power = -1 * rr / (2 * sigma**2)

    return amp * jnp.exp(power)

gaussian(dx, dy, sigma, amp, xyz)

Standard gaussian profile in 2d. This function does not include smoothing or declination stretch which should be applied at the end. The transform_grid call is awkward and can probably be removed/worked around. Function exists to match existing guassian interfaces.

Once the grid is transformed the profile is computed as:

\[ P_{0} e^{-\frac{x^2 + y^2}{2\sigma^2}} \]

where \(P_{0}\) is amp.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
sigma float

Sigma value of gaussian model. Units: arcsec

required
amp float

Amplitude of gaussian model. Units: Jy

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. We only care about x and y here. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The gaussian model evaluated on only the 2d xy grid.

Source code in witch/structure.py
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
@jax.jit
def gaussian(
    dx: float,
    dy: float,
    sigma: float,
    amp: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    Standard gaussian profile in 2d.
    This function does not include smoothing or declination stretch
    which should be applied at the end. The transform_grid call is
    awkward and can probably be removed/worked around. Function exists
    to match existing guassian interfaces.

    Once the grid is transformed the profile is computed as:

    $$
    P_{0} e^{-\frac{x^2 + y^2}{2\sigma^2}}
    $$

    where $P_{0}$ is `amp`.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    sigma : float
        Sigma value of gaussian model.
        Units: arcsec
    amp : float
        Amplitude of gaussian model.
        Units: Jy
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        We only care about x and y here.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The gaussian model evaluated on only the 2d xy grid.
    """
    x, y, *_ = transform_grid(dx, dy, 0, 1, 1, 1, 0, xyz)
    rr = x[..., 0] ** 2 + y[..., 0] ** 2
    power = -1 * rr / (2 * sigma**2)

    return amp * jnp.exp(power)

gnfw(dx, dy, dz, r_1, r_2, r_3, theta, P0, c500, m500, gamma, alpha, beta, z, xyz)

Elliptical gNFW pressure profile in 3d. This function does not include smoothing or declination stretch which should be applied at the end. TODO: Add units to add parameters!

Once the grid is transformed the profile is computed as:

\[ \dfrac{P_{500} * P_{0}}{{\left( r^{\gamma}\left( 1 + r^{\alpha} \right) \right)}^{\dfrac{\beta - \gamma}{\alpha}}} \]

where:

\[ r = c_{500} \sqrt{x^2 + y^2 + z^2} {\frac{3m_{500}}{2000 \pi n_z}}^{-\frac{1}{3}} \]
\[ P_{500} = 1.65 \times 10^{-3} {\frac{m_{500}*h_{70}}{3 \times 10^{14}}}^{\frac{2}{3} + ap}{h_z}^{\frac{8}{3}}{h_{70}}^2 \]

\(n_z\) is the critical density at the cluster redshift and \(h_z\) is the Hubble constant at the cluster redshift.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid.

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid.

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
P0 float

Amplitude of the pressure profile. Units: unitless

required
c500 float

Concentration parameter at a density contrast of 500. Units: unitless

required
m500 float

Mass at a density contrast of 500. Units: M_solar

required
gamma float

The central slope. Units: unitless

required
alpha float

The intermediate slope. Units: unitless

required
beta float

The outer slope. Units: unitless

required
z float

Redshift of cluster. Units: redshift

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The gnfw model evaluated on the grid.

Source code in witch/structure.py
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@jax.jit
def gnfw(
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    P0: float,
    c500: float,
    m500: float,
    gamma: float,
    alpha: float,
    beta: float,
    z: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    Elliptical gNFW pressure profile in 3d.
    This function does not include smoothing or declination stretch
    which should be applied at the end.
    TODO: Add units to add parameters!

    Once the grid is transformed the profile is computed as:

    $$
    \dfrac{P_{500} * P_{0}}{{\left( r^{\gamma}\left( 1 + r^{\alpha} \right) \right)}^{\dfrac{\beta - \gamma}{\alpha}}}
    $$

    where:

    $$
    r = c_{500} \sqrt{x^2 + y^2 + z^2} {\frac{3m_{500}}{2000 \pi n_z}}^{-\frac{1}{3}}
    $$

    $$
    P_{500} = 1.65 \times 10^{-3} {\frac{m_{500}*h_{70}}{3 \times 10^{14}}}^{\frac{2}{3} + ap}{h_z}^{\frac{8}{3}}{h_{70}}^2
    $$

    $n_z$ is the critical density at the cluster redshift and $h_z$ is the Hubble constant at the cluster redshift.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    P0 : float
        Amplitude of the pressure profile.
        Units: unitless
    c500 : float
        Concentration parameter at a density contrast of 500.
        Units: unitless
    m500 : float
        Mass at a density contrast of 500.
        Units: M_solar
    gamma : float
        The central slope.
        Units: unitless
    alpha : float
        The intermediate slope.
        Units: unitless
    beta : float
        The outer slope.
        Units: unitless
    z : float
        Redshift of cluster.
        Units: redshift
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : jax.Array
        The gnfw model evaluated on the grid.
    """
    nz = get_nz(z)
    hz = get_hz(z)

    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    r500 = (m500 / (4.00 * jnp.pi / 3.00) / 5.00e02 / nz) ** (1.00 / 3.00)

    r = c500 * jnp.sqrt(x**2 + y**2 + z**2) / r500
    denominator = (r**gamma) * (1 + r**alpha) ** ((beta - gamma) / alpha)

    P500 = (
        1.65e-03
        * (m500 / (3.00e14 / h70)) ** (2.00 / 3.00 + ap)
        * hz ** (8.00 / 3.00)
        * h70**2
    )

    return P500 * P0 / denominator

isobeta(dx, dy, dz, r_1, r_2, r_3, theta, beta, amp, xyz)

Elliptical isobeta pressure profile in 3d. This function does not include smoothing or declination stretch which should be applied at the end.

Once the grid is transformed the profile is computed as:

\[ P_{0}\left( 1 + x**2 + y**2 + z**2 \right)^{-1.5\beta} \]

where \(P_{0}\) is amp.

Parameters:

Name Type Description Default
dx float

RA of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dy float

Dec of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
dz float

Line of sight offset of cluster center relative to grid origin. Passed to grid.transform_grid. Units: arcsec

required
r_1 float

Amount to scale along x-axis. Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters Passed to grid.transform_grid. Units: arbitrary

required
r_2 float

Amount to scale along y-axis. Passed to grid.transform_grid. Units: arbitrary

required
r_3 float

Amount to scale along z-axis. Passed to grid.transform_grid. Units: arbitrary

required
theta float

Angle to rotate in xy-plane. Passed to grid.transform_grid. Units: radians

required
beta float

Beta value of isobeta model. Units: unitless

required
amp float

Amplitude of isobeta model. Units: Matches unit conversion implicitly.

required
xyz tuple[Array, Array, Array, float, float]

Coordinte grid to calculate model on. See containers.Model.xyz for details.

required

Returns:

Name Type Description
model Array

The jax.isobeta model evaluated on the grid.

Source code in witch/structure.py
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
@jax.jit
def isobeta(
    dx: float,
    dy: float,
    dz: float,
    r_1: float,
    r_2: float,
    r_3: float,
    theta: float,
    beta: float,
    amp: float,
    xyz: tuple[jax.Array, jax.Array, jax.Array, float, float],
) -> jax.Array:
    r"""
    Elliptical isobeta pressure profile in 3d.
    This function does not include smoothing or declination stretch
    which should be applied at the end.

    Once the grid is transformed the profile is computed as:

    $$
    P_{0}\left( 1 + x**2 + y**2 + z**2 \right)^{-1.5\beta}
    $$

    where $P_{0}$ is `amp`.

    Parameters
    ----------
    dx : float
        RA of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dy : float
        Dec of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    dz : float
        Line of sight offset of cluster center relative to grid origin.
        Passed to `grid.transform_grid`.
        Units: arcsec
    r_1 : float
        Amount to scale along x-axis.
        Units are arbitrary, only ratio of r_1/r_2, r_1/r_3, r_2/r_3 matters
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_2 : float
        Amount to scale along y-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    r_3 : float
        Amount to scale along z-axis.
        Passed to `grid.transform_grid`.
        Units: arbitrary
    theta : float
        Angle to rotate in xy-plane.
        Passed to `grid.transform_grid`.
        Units: radians
    beta : float
        Beta value of isobeta model.
        Units: unitless
    amp : float
        Amplitude of isobeta model.
        Units: Matches unit conversion implicitly.
    xyz : tuple[jax.Array, jax.Array, jax.Array, float, float]
        Coordinte grid to calculate model on.
        See `containers.Model.xyz` for details.

    Returns
    -------
    model : Array
        The jax.isobeta model evaluated on the grid.
    """
    x, y, z, *_ = transform_grid(dx, dy, dz, r_1, r_2, r_3, theta, xyz)

    rr = 1 + x**2 + y**2 + z**2
    power = -1.5 * beta
    rrpow = rr**power

    return amp * rrpow