Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bls param not being parsed correctly #41

Open
jburba opened this issue Sep 17, 2020 · 0 comments
Open

bls param not being parsed correctly #41

jburba opened this issue Sep 17, 2020 · 0 comments

Comments

@jburba
Copy link

jburba commented Sep 17, 2020

The bls param, under telescope params, is supposed to be parsable as a list of tuples of baseline antenna pairs according to healvis.simulator.setup_uvdata. The current implementation checks to see if bls is a single string of the format '(ant1, ant2)' which is fine if you only want a single baseline in your sim (starting on line 444). This doesn't work if bls is a list of tuples which gets read in as a list of strings via yaml.safe_load. Additionally, I don't know if this is desirable behavior, but because of the chosen antenna ordering, i.e. ant1 < ant2 in constructing _bls which is a reference list containing all possible baseline antenna pairs subject to this criterion, if you pass bls : (3, 2) that baseline will not be included in the dataset since _bls will only contain the antenna pair (2, 3).

I made a new branch for these fixes with the intention of submitting a pull request and then realized I don't have permissions to push to rasg-affiliates. But the code fix is simple and the following should work:

_bls = [(a1, a2) for a1 in anums for a2 in anums if a1 <= a2] # line 443 in healvis.simulator.setup_uvdata
if bls is not None:
    if isinstance(bls, (str, np.str)):
        bls = ast.literal_eval(bls)
    elif isinstance(bls[0], (str, np.str)): # check if bls is a list of strings
        bls = [ast.literal_eval(bl) for bl in bls] # convert each str to tuple
    bls = [bl for bl in _bls if bl in bls or bl[::-1] in bls] # checks if either (ant1, ant2) or (ant2, ant1) is in _bls
else:
    bls = _bls
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant