Skip to content

Commit

Permalink
Merge branch 'main' of github.com:tomasstolker/diskmap
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed Sep 20, 2023
2 parents 100533c + 919a436 commit 78e2af5
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions diskmap/diskmap.py
Expand Up @@ -5,7 +5,7 @@
import math
import warnings

from typing import List, Optional, Tuple, Union
from typing import List, Optional, Tuple, Union, Callable

import numpy as np
import numpy.ma as ma
Expand Down Expand Up @@ -146,6 +146,7 @@ def map_disk(
power_law: Tuple[float, float, float],
radius: Tuple[float, float, int] = (1.0, 500.0, 100),
surface: str = "power-law",
height_func: Optional[Callable[[np.ndarray],np.ndarray]] = None,
filename: Optional[str] = None,
) -> None:
"""
Expand Down Expand Up @@ -173,7 +174,11 @@ def map_disk(
present, have a look at the `_radius.fits` output.
surface : str
Parameterization type for the disk surface ('power-law' or
'file').
'function' or 'file').
height_func : callable, None
Function that returns the height of the scattering surface
as a function of radius. The radii and returned height must
be in au. Only used if surface='function'.
filename : str, None
Filename which contains the radius in au (first column) and
the height of the disk surface in au (second column).
Expand Down Expand Up @@ -205,6 +210,20 @@ def power_law_height(

# opening angle (rad)
disk_opening = np.arctan2(disk_height, disk_radius)

elif surface == "function":

if height_func is None:
raise ValueError("If using surface=='function', you must specify height_func")

# midplane radius (au)
disk_radius = np.linspace(radius[0], radius[1], radius[2])

# disk height (au)
disk_height = height_func(disk_radius)

# opening angle (rad)
disk_opening = np.arctan2(disk_height, disk_radius)

elif surface == "file":

Expand Down

0 comments on commit 78e2af5

Please sign in to comment.