<commit_before>"""Class for reading and writing uvfits files."""
from astropy import constants as const
import astropy
from astropy.time import Time
from astropy.io import fits
import numpy as np
import warnings
from uvdata import UVData
import parameter as uvp


class UVFITS(UVData):
    """
    Defines a uvfits-specific subclass of UVData for reading and writing uvfits files.
    This class should not be interacted with directly, instead use the read_uvfits
    and write_uvfits methods on the UVData class.

    Attributes:
        uvfits_required_extra: Names of optional UVParameters that are required
            for uvfits.
    """

    uvfits_required_extra = ['antenna_positions', 'gst0', 'rdate',
                             'earth_omega', 'dut1', 'timesys']

    def _gethduaxis(self, D, axis):
        ax = str(axis)
        N = D.header['NAXIS' + ax]
        X0 = D.header['CRVAL' + ax]
        dX = D.header['CDELT' + ax]
        Xi0 = D.header['CRPIX' + ax] - 1
        return np.arange(X0 - dX * Xi0, X0 - dX * Xi0 + N * dX, dX)

    def _indexhdus(self, hdulist):<commit_msg>Fixed rounding problem when reading uvfits files<commit_after>"""Class for reading and writing uvfits files."""
from astropy import constants as const
import astropy
from astropy.time import Time
from astropy.io import fits
import numpy as np
import warnings
from uvdata import UVData
import parameter as uvp


class UVFITS(UVData):
    """
    Defines a uvfits-specific subclass of UVData for reading and writing uvfits files.
    This class should not be interacted with directly, instead use the read_uvfits
    and write_uvfits methods on the UVData class.

    Attributes:
        uvfits_required_extra: Names of optional UVParameters that are required
            for uvfits.
    """

    uvfits_required_extra = ['antenna_positions', 'gst0', 'rdate',
                             'earth_omega', 'dut1', 'timesys']

    def _gethduaxis(self, D, axis):
        ax = str(axis)
        N = D.header['NAXIS' + ax]
        X0 = D.header['CRVAL' + ax]
        dX = D.header['CDELT' + ax]
        Xi0 = D.header['CRPIX' + ax] - 1
        return dX * (np.arange(N) - Xi0) + X0

    def _indexhdus(self, hdulist):
{'fraction_non_alphanumeric': 0.08926144086995923, 'fraction_numerical': 0.007249660172179429, 'mean_word_length': 2.7938144329896906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7417223', 'n_tokens_mistral': 722, 'n_tokens_neox': 676, 'n_words': 240}