Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision d745e74710ab581d489e815095d0dd4ee91e9c35 authored by Bryna Hazelton on 15 September 2025, 18:00:43 UTC, committed by Jonathan Pober on 15 September 2025, 18:31:58 UTC
remove macos-13 from our CI matrix because it is deprecated
1 parent ea19da5
  • Files
  • Changes
  • 0617af3
  • /
  • tests
  • /
  • utils
  • /
  • test_bls_numba.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:d745e74710ab581d489e815095d0dd4ee91e9c35
directory badge
swh:1:dir:44d91f34b75d4752e8467339185a98db104ff524
content badge
swh:1:cnt:5480376753b77aefecb862f0d8b4d641c9d8dfdd

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
test_bls_numba.py
# Copyright (c) 2025 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Tests for numba-enhanced baseline number utility functions."""

import numpy as np
import pytest

import pyuvdata.utils.bls_numba as bl_utils


@pytest.mark.parametrize("ant1mod", [0, 6, 10])
@pytest.mark.parametrize("ant2mod", [0, 3, 20])
def test_minmax_ants(ant1mod, ant2mod):
    ant1 = np.array([1, 2, 3], dtype="uint64")
    ant2 = np.array([4, 5, 6], dtype="uint64")
    ant1 += ant1mod
    ant2 += ant2mod
    assert max(3 + ant1mod, 6 + ant2mod) == bl_utils._max_ant(ant1, ant2)
    assert min(1 + ant1mod, 4 + ant2mod) == bl_utils._min_ant(ant1, ant2)


@pytest.mark.parametrize("use_miriad_convention", [True, False])
@pytest.mark.parametrize("use2048", [True, False])
@pytest.mark.parametrize("use256", [True, False])
def test_antnums_to_baseline_roundtip_numba(use_miriad_convention, use2048, use256):
    if not use2048:
        ant1_gold = np.array([1, 2, 3, 1, 1, 1, 255, 2049], dtype="uint64")
        ant2_gold = np.array([1, 2, 3, 254, 255, 2049, 1, 2], dtype="uint64")
    else:
        ant1_gold = np.array([1, 2, 3, 1, 1, 1, 255, 256], dtype="uint64")
        ant2_gold = np.array([1, 2, 3, 254, 255, 256, 1, 2], dtype="uint64")

    bl_gold = np.zeros_like(ant1_gold)
    if use_miriad_convention or use256:
        bl_gold[:] = [257, 514, 771, 510, 511, 67840, 65281, 65538]
        if not use2048:
            bl_gold[-3:] = [2151745537, 65281, 524546]
    else:
        if use2048:
            bl_gold[:] = [67585, 69634, 71683, 67838, 67839, 67840, 587777, 589826]
        else:
            bl_gold[:] = [
                2151743489,
                4299227138,
                6446710787,
                2151743742,
                2151743743,
                2151745537,
                547612590081,
                4400198254594,
            ]

    if use256:
        ant1_gold = ant1_gold[:-3]
        ant2_gold = ant2_gold[:-3]
        bl_gold = bl_gold[:-3]

    bl = bl_utils._antnums_to_baseline(
        ant1_gold,
        ant2_gold,
        use_miriad_convention=use_miriad_convention,
        use2048=use2048,
        use256=use256,
    )

    np.testing.assert_array_equal(bl, bl_gold)

    ant1, ant2 = bl_utils._baseline_to_antnums(
        bl, np.max(bl), use_miriad_convention=use_miriad_convention
    )

    np.testing.assert_array_equal(ant1_gold, ant1)
    np.testing.assert_array_equal(ant2_gold, ant2)


def test_antnums_to_baseline_vec():
    ant1 = np.array([1, 2, 3, 1, 1, 1, 255, 256], dtype="uint64")
    ant2 = np.array([1, 2, 3, 254, 255, 256, 1, 2], dtype="uint64")
    bl_gold = np.array(
        [67585, 69634, 71683, 67838, 67839, 67840, 587777, 589826], dtype="uint64"
    )

    offset = np.uint64(65536)
    modulus = np.uint64(2048)
    bl = bl_utils._antnums_to_baseline_vec(ant1, ant2, offset, modulus)
    np.testing.assert_array_equal(bl, bl_gold)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API