Skip to content

compatibility with arrays and lists as arguments #21

@MicheleRonchi

Description

@MicheleRonchi

Hi,

I'm trying to compute the DM values given the distance and the sky position for a lot of objects.
I have saved the distances and the sky positions in galactic coordinates in numpy.arrays and I was wondering if there is a way to directly pass numpy.arrays as arguments to the methods pygedm.dist_to_dm.

At the moment if I run the following example:

l_gal = np.array([20, 30])
b_gal = np.array([-10, 30])
dist = np.array([1000, 2000])

dm, _ = pygedm.dist_to_dm(l_gal, b_gal, dist, method='ymw16')

The following error comes out:

TypeError: dmdtau(): incompatible function arguments. The following argument types are supported:
    1. (gl: float, gb: float, dordm: float, DM_Host: float, ndir: int, np: int, vbs: int, dirname: str, text: str) -> Dict[str, float]

Looping on the values is a solution but it is also slow for many objects and I'm trying to optimize the script I'm working on.

Thank you very much for the help,

Michele

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions