Skip to content

Allow for passing the target coordinates to extract_source_position #1321

Open
@morcuended

Description

def extract_source_position(
data, observed_source_name, equivalent_focal_length=28 * u.m
):
"""
Extract source position from data
Parameters
----------
pandas.DataFrame data: input data
str observed_source_name: Name of the observed source
astropy.units.m equivalent_focal_length: Equivalent focal length of a telescope
Returns
-------
2D array of coordinates of the source in form [(x),(y)] in astropy.units.m
"""
observed_source = SkyCoord.from_name(observed_source_name)
obstime = pd.to_datetime(data["dragon_time"], unit="s")
pointing_alt = u.Quantity(data["alt_tel"], u.rad, copy=False)
pointing_az = u.Quantity(data["az_tel"], u.rad, copy=False)
source_pos_camera = radec_to_camera(
observed_source,
obstime,
pointing_alt,
pointing_az,
focal=equivalent_focal_length,
)
source_position = [source_pos_camera.x, source_pos_camera.y]
return source_position

For cases in which the name solver of astropy does not work (e.g. GRBs, GW, neutrino alerts) one needs to pass the coordinates directly to make this function work. Used in the explore DL2 notebook (theta2 distribution calculation)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions