RadioAstronomySoftwareGroup / pyuvdata

A pythonic interface for radio astronomy interferometry data (uvfits, miriad, others)
https://pyuvdata.readthedocs.io/en/latest/index.html
BSD 2-Clause "Simplified" License
83 stars 27 forks source link

Telescope.from_known_telescopes breaks if the known telescope doesn't have enough info #1460

Open steven-murray opened 2 months ago

steven-murray commented 2 months ago

Currently there's no nice way to supply extra info when calling Telescope.from_known_telescopes(). For example, if I do Telescope.from_known_telescopes('PAPER'), it errors, because PAPER doesn't have the antenna position info. The easiest way to solve this would be to allow a **kwargs that can set the extra attributes.

bhazelton commented 2 months ago

I think you can prevent it from erroring if you set run_check=False.

I think you can pretty naturally achieve what you want using Telescope.new() (which accepts all the attributes you might want to pass in) and setting the location parameter of that method using the known_telescope_location function.

steven-murray commented 2 months ago

@bhazelton are you suggesting doing something like:

tel = Telescope.from_known_telescopes("PAPER", run_check=False)
tel.antenna_positions = np.array([...])

and/or:

tel = Telescope.new(
    telescope_positions=np.array([..]),
    run_check=False,
    **other_params
)
tel.upddate_from_known_telescopes('PAPER')

?

If so, I guess that works, but it seems mightily clunky compared to

tel = Telescope.from_known_telescopes('PAPER', antenna_positions=np.array([...]))
bhazelton commented 2 months ago

I was thinking something like:

tel = Telescope.new(
    location=telescope.known_telescope_location("PAPER"),
    run_check=False,
    **other_params
)
steven-murray commented 2 months ago

Note that this doesn't work because it's not only the location that I need. I think just allowing **kwargs into .from_known_telescopes should be the preferred method.