Datasets:

repository
stringclasses
11 values
repo_id
stringlengths
1
3
target_module_path
stringlengths
16
72
prompt
stringlengths
298
21.7k
relavent_test_path
stringlengths
50
99
full_function
stringlengths
336
33.8k
function_name
stringlengths
2
51
content_class
stringclasses
3 values
external_dependencies
stringclasses
2 values
astropy
8
astropy/coordinates/earth.py
def get_itrs(self, obstime=None, location=None): """ Generates an `~astropy.coordinates.ITRS` object with the location of this object at the requested ``obstime``, either geocentric, or topocentric relative to a given ``location``. Parameters ---------- obsti...
/usr/src/app/target_test_cases/failed_tests_EarthLocation.get_itrs.txt
def get_itrs(self, obstime=None, location=None): """ Generates an `~astropy.coordinates.ITRS` object with the location of this object at the requested ``obstime``, either geocentric, or topocentric relative to a given ``location``. Parameters ---------- obsti...
EarthLocation.get_itrs
repository-level
external
astropy
9
astropy/coordinates/earth.py
def gravitational_redshift( self, obstime, bodies=["sun", "jupiter", "moon"], masses={} ): """Return the gravitational redshift at this EarthLocation. Calculates the gravitational redshift, of order 3 m/s, due to the requested solar system bodies. Parameters ---...
/usr/src/app/target_test_cases/failed_tests_EarthLocation.gravitational_redshift.txt
def gravitational_redshift( self, obstime, bodies=["sun", "jupiter", "moon"], masses={} ): """Return the gravitational redshift at this EarthLocation. Calculates the gravitational redshift, of order 3 m/s, due to the requested solar system bodies. Parameters ---...
EarthLocation.gravitational_redshift
repository-level
non_external
astropy
10
astropy/io/fits/hdu/hdulist.py
def writeto( self, fileobj, output_verify="exception", overwrite=False, checksum=False ): """ Write the `HDUList` to a new file. Parameters ---------- fileobj : str, file-like or `pathlib.Path` File to write to. If a file object, must be opened in a ...
/usr/src/app/target_test_cases/failed_tests_HDUList.writeto.txt
def writeto( self, fileobj, output_verify="exception", overwrite=False, checksum=False ): """ Write the `HDUList` to a new file. Parameters ---------- fileobj : str, file-like or `pathlib.Path` File to write to. If a file object, must be opened in a ...
HDUList.writeto
repository-level
external
astropy
11
astropy/timeseries/periodograms/lombscargle/core.py
def autofrequency( self, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, return_freq_limits=False, ): """Determine a suitable frequency grid for data. Note that this assumes the peak width is driven by the obs...
/usr/src/app/target_test_cases/failed_tests_LombScargle.autofrequency.txt
def autofrequency( self, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, return_freq_limits=False, ): """Determine a suitable frequency grid for data. Note that this assumes the peak width is driven by the obs...
LombScargle.autofrequency
file-level
external
astropy
12
astropy/timeseries/periodograms/lombscargle/core.py
def autopower( self, method="auto", method_kwds=None, normalization=None, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, ): """Compute Lomb-Scargle power at automatically-determined frequencies. ...
/usr/src/app/target_test_cases/failed_tests_LombScargle.autopower.txt
def autopower( self, method="auto", method_kwds=None, normalization=None, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, ): """Compute Lomb-Scargle power at automatically-determined frequencies. ...
LombScargle.autopower
file-level
non_external
astropy
13
astropy/timeseries/periodograms/lombscargle/core.py
def false_alarm_level( self, false_alarm_probability, method="baluev", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, method_kwds=None, ): """Level of maximum at a given false alarm probability. ...
/usr/src/app/target_test_cases/failed_tests_LombScargle.false_alarm_level.txt
def false_alarm_level( self, false_alarm_probability, method="baluev", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, method_kwds=None, ): """Level of maximum at a given false alarm probability. ...
LombScargle.false_alarm_level
repository-level
non_external
astropy
14
astropy/timeseries/periodograms/lombscargle/core.py
def false_alarm_probability( self, power, method="baluev", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, method_kwds=None, ): """False alarm probability of periodogram maxima under the null hypothesis...
/usr/src/app/target_test_cases/failed_tests_LombScargle.false_alarm_probability.txt
def false_alarm_probability( self, power, method="baluev", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, method_kwds=None, ): """False alarm probability of periodogram maxima under the null hypothesis...
LombScargle.false_alarm_probability
repository-level
non_external
astropy
15
astropy/timeseries/periodograms/lombscargle/core.py
def model(self, t, frequency): """Compute the Lomb-Scargle model at the given frequency. The model at a particular frequency is a linear model: model = offset + dot(design_matrix, model_parameters) Parameters ---------- t : array-like or `~astropy.units.Quantity` ['...
/usr/src/app/target_test_cases/failed_tests_LombScargle.model.txt
def model(self, t, frequency): """Compute the Lomb-Scargle model at the given frequency. The model at a particular frequency is a linear model: model = offset + dot(design_matrix, model_parameters) Parameters ---------- t : array-like or `~astropy.units.Quantity` ['...
LombScargle.model
repository-level
non_external
astropy
16
astropy/timeseries/periodograms/lombscargle/core.py
def power( self, frequency, normalization=None, method="auto", assume_regular_frequency=False, method_kwds=None, ): """Compute the Lomb-Scargle power at the given frequencies. Parameters ---------- frequency : array-like or `~astro...
/usr/src/app/target_test_cases/failed_tests_LombScargle.power.txt
def power( self, frequency, normalization=None, method="auto", assume_regular_frequency=False, method_kwds=None, ): """Compute the Lomb-Scargle power at the given frequencies. Parameters ---------- frequency : array-like or `~astro...
LombScargle.power
repository-level
non_external
astropy
17
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def autofrequency( self, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, return_freq_limits=False, ): """Determine a suitable frequency grid for data. Note that this assumes the peak width is driven by the obse...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.autofrequency.txt
def autofrequency( self, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, return_freq_limits=False, ): """Determine a suitable frequency grid for data. Note that this assumes the peak width is driven by the obse...
LombScargleMultiband.autofrequency
repository-level
external
astropy
18
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def autopower( self, method="flexible", sb_method="auto", normalization="standard", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, ): """Compute Lomb-Scargle power at automatically-determined frequenci...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.autopower.txt
def autopower( self, method="flexible", sb_method="auto", normalization="standard", samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None, ): """Compute Lomb-Scargle power at automatically-determined frequenci...
LombScargleMultiband.autopower
file-level
non_external
astropy
19
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def design_matrix(self, frequency, t_fit=None, bands_fit=None): """Compute the design matrix for a given frequency Parameters ---------- frequency : float the frequency for the model t_fit : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.design_matrix.txt
def design_matrix(self, frequency, t_fit=None, bands_fit=None): """Compute the design matrix for a given frequency Parameters ---------- frequency : float the frequency for the model t_fit : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional...
LombScargleMultiband.design_matrix
repository-level
external
astropy
20
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def model(self, t, frequency, bands_fit=None): """Compute the Lomb-Scargle model at the given frequency. The model at a particular frequency is a linear model: model = offset + dot(design_matrix, model_parameters) Parameters ---------- t : array-like or `~astropy.un...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.model.txt
def model(self, t, frequency, bands_fit=None): """Compute the Lomb-Scargle model at the given frequency. The model at a particular frequency is a linear model: model = offset + dot(design_matrix, model_parameters) Parameters ---------- t : array-like or `~astropy.un...
LombScargleMultiband.model
repository-level
external
astropy
21
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def offset(self, t_fit=None, bands_fit=None): """Return the offset array of the model The offset array of the model is the (weighted) mean of the y values in each band. Note that if self.center_data is False, the offset is 0 by definition. Parameters ---------- t_fi...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.offset.txt
def offset(self, t_fit=None, bands_fit=None): """Return the offset array of the model The offset array of the model is the (weighted) mean of the y values in each band. Note that if self.center_data is False, the offset is 0 by definition. Parameters ---------- t_fi...
LombScargleMultiband.offset
file-level
external
astropy
22
astropy/timeseries/periodograms/lombscargle_multiband/core.py
def power( self, frequency, method="flexible", sb_method="auto", normalization="standard" ): """Compute the Lomb-Scargle power at the given frequencies. Parameters ---------- frequency : array-like or `~astropy.units.Quantity` ['frequency'] frequencies (not a...
/usr/src/app/target_test_cases/failed_tests_LombScargleMultiband.power.txt
def power( self, frequency, method="flexible", sb_method="auto", normalization="standard" ): """Compute the Lomb-Scargle power at the given frequencies. Parameters ---------- frequency : array-like or `~astropy.units.Quantity` ['frequency'] frequencies (not a...
LombScargleMultiband.power
repository-level
external
astropy
23
astropy/nddata/compat.py
def convert_unit_to(self, unit, equivalencies=[]): """ Returns a new `NDData` object whose values have been converted to a new unit. Parameters ---------- unit : `astropy.units.UnitBase` instance or str The unit to convert to. equivalencies : lis...
/usr/src/app/target_test_cases/failed_tests_NDDataArray.convert_unit_to.txt
def convert_unit_to(self, unit, equivalencies=[]): """ Returns a new `NDData` object whose values have been converted to a new unit. Parameters ---------- unit : `astropy.units.UnitBase` instance or str The unit to convert to. equivalencies : lis...
NDDataArray.convert_unit_to
file-level
non_external
astropy
24
astropy/coordinates/sky_coordinate.py
def apply_space_motion(self, new_obstime=None, dt=None): """Compute the position to a new time using the velocities. Compute the position of the source represented by this coordinate object to a new time using the velocities stored in this object and assuming linear space motion (in...
/usr/src/app/target_test_cases/failed_tests_SkyCoord.apply_space_motion.txt
def apply_space_motion(self, new_obstime=None, dt=None): """Compute the position to a new time using the velocities. Compute the position of the source represented by this coordinate object to a new time using the velocities stored in this object and assuming linear space motion (in...
SkyCoord.apply_space_motion
repository-level
non_external
astropy
25
astropy/coordinates/spectral_coordinate.py
def replicate( self, value=None, unit=None, observer=None, target=None, radial_velocity=None, redshift=None, doppler_convention=None, doppler_rest=None, copy=False, ): """ Return a replica of the `SpectralCoord`, opt...
/usr/src/app/target_test_cases/failed_tests_SpectralCoord.replicate.txt
def replicate( self, value=None, unit=None, observer=None, target=None, radial_velocity=None, redshift=None, doppler_convention=None, doppler_rest=None, copy=False, ): """ Return a replica of the `SpectralCoord`, opt...
SpectralCoord.replicate
repository-level
external
astropy
26
astropy/coordinates/spectral_coordinate.py
def with_observer_stationary_relative_to( self, frame, velocity=None, preserve_observer_frame=False ): """ A new `SpectralCoord` with the velocity of the observer altered, but not the position. If a coordinate frame is specified, the observer velocities will be ...
/usr/src/app/target_test_cases/failed_tests_SpectralCoord.with_observer_stationary_relative_to.txt
def with_observer_stationary_relative_to( self, frame, velocity=None, preserve_observer_frame=False ): """ A new `SpectralCoord` with the velocity of the observer altered, but not the position. If a coordinate frame is specified, the observer velocities will be ...
SpectralCoord.with_observer_stationary_relative_to
repository-level
non_external
astropy
27
astropy/coordinates/spectral_coordinate.py
def with_radial_velocity_shift(self, target_shift=None, observer_shift=None): """ Apply a velocity shift to this spectral coordinate. The shift can be provided as a redshift (float value) or radial velocity (`~astropy.units.Quantity` with physical type of 'speed'). Paramete...
/usr/src/app/target_test_cases/failed_tests_SpectralCoord.with_radial_velocity_shift.txt
def with_radial_velocity_shift(self, target_shift=None, observer_shift=None): """ Apply a velocity shift to this spectral coordinate. The shift can be provided as a redshift (float value) or radial velocity (`~astropy.units.Quantity` with physical type of 'speed'). Paramete...
SpectralCoord.with_radial_velocity_shift
repository-level
non_external
astropy
28
astropy/coordinates/spectral_quantity.py
def to(self, unit, equivalencies=[], doppler_rest=None, doppler_convention=None): """ Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit. By default, the ``spectral`` equivalency will be enabled, as well as one of the Doppler equivalencies if convert...
/usr/src/app/target_test_cases/failed_tests_SpectralQuantity.to.txt
def to(self, unit, equivalencies=[], doppler_rest=None, doppler_convention=None): """ Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit. By default, the ``spectral`` equivalency will be enabled, as well as one of the Doppler equivalencies if convert...
SpectralQuantity.to
repository-level
non_external
astropy
29
astropy/table/table.py
def add_index(self, colnames, engine=None, unique=False): """ Insert a new index among one or more columns. If there are no indices, make this index the primary table index. Parameters ---------- colnames : str or list List of column names (or a s...
/usr/src/app/target_test_cases/failed_tests_Table.add_index.txt
def add_index(self, colnames, engine=None, unique=False): """ Insert a new index among one or more columns. If there are no indices, make this index the primary table index. Parameters ---------- colnames : str or list List of column names (or a s...
Table.add_index
repository-level
non_external
astropy
30
astropy/table/table.py
def argsort(self, keys=None, kind=None, reverse=False): """ Return the indices which would sort the table according to one or more key columns. This simply calls the `numpy.argsort` function on the table with the ``order`` parameter set to ``keys``. Parameters -----...
/usr/src/app/target_test_cases/failed_tests_Table.argsort.txt
def argsort(self, keys=None, kind=None, reverse=False): """ Return the indices which would sort the table according to one or more key columns. This simply calls the `numpy.argsort` function on the table with the ``order`` parameter set to ``keys``. Parameters -----...
Table.argsort
repository-level
external
astropy
31
astropy/table/table.py
def reverse(self): """ Reverse the row order of table rows. The table is reversed in place and there are no function arguments. Examples -------- Create a table with three columns:: >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'], ...
/usr/src/app/target_test_cases/failed_tests_Table.reverse.txt
def reverse(self): """ Reverse the row order of table rows. The table is reversed in place and there are no function arguments. Examples -------- Create a table with three columns:: >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'], ...
Table.reverse
file-level
non_external
astropy
32
astropy/table/table.py
def round(self, decimals=0): """ Round numeric columns in-place to the specified number of decimals. Non-numeric columns will be ignored. Examples -------- Create three columns with different types: >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85], ...
/usr/src/app/target_test_cases/failed_tests_Table.round.txt
def round(self, decimals=0): """ Round numeric columns in-place to the specified number of decimals. Non-numeric columns will be ignored. Examples -------- Create three columns with different types: >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85], ...
Table.round
file-level
external
astropy
33
astropy/table/table.py
def sort(self, keys=None, *, kind=None, reverse=False): """ Sort the table according to one or more keys. This operates on the existing table and does not return a new table. Parameters ---------- keys : str or list of str The key(s) to order the table by...
/usr/src/app/target_test_cases/failed_tests_Table.sort.txt
def sort(self, keys=None, *, kind=None, reverse=False): """ Sort the table according to one or more keys. This operates on the existing table and does not return a new table. Parameters ---------- keys : str or list of str The key(s) to order the table by...
Table.sort
file-level
non_external
astropy
34
astropy/time/core.py
def earth_rotation_angle(self, longitude=None): """Calculate local Earth rotation angle. Parameters ---------- longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional The longitude on the Earth at which to compute the Earth rot...
/usr/src/app/target_test_cases/failed_tests_Time.earth_rotation_angle.txt
def earth_rotation_angle(self, longitude=None): """Calculate local Earth rotation angle. Parameters ---------- longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional The longitude on the Earth at which to compute the Earth rot...
Time.earth_rotation_angle
file-level
non_external
astropy
35
astropy/time/core.py
def sidereal_time(self, kind, longitude=None, model=None): """Calculate sidereal time. Parameters ---------- kind : str ``'mean'`` or ``'apparent'``, i.e., accounting for precession only, or also for nutation. longitude : `~astropy.units.Quantity`, `~...
/usr/src/app/target_test_cases/failed_tests_Time.sidereal_time.txt
def sidereal_time(self, kind, longitude=None, model=None): """Calculate sidereal time. Parameters ---------- kind : str ``'mean'`` or ``'apparent'``, i.e., accounting for precession only, or also for nutation. longitude : `~astropy.units.Quantity`, `~...
Time.sidereal_time
file-level
non_external
astropy
36
astropy/timeseries/sampled.py
def fold( self, period=None, epoch_time=None, epoch_phase=0, wrap_phase=None, normalize_phase=False, ): """ Return a new `~astropy.timeseries.TimeSeries` folded with a period and epoch. Parameters ---------- period ...
/usr/src/app/target_test_cases/failed_tests_TimeSeries.fold.txt
def fold( self, period=None, epoch_time=None, epoch_phase=0, wrap_phase=None, normalize_phase=False, ): """ Return a new `~astropy.timeseries.TimeSeries` folded with a period and epoch. Parameters ---------- period ...
TimeSeries.fold
repository-level
non_external
astropy
37
astropy/wcs/wcs.py
def slice(self, view, numpy_order=True): """ Slice a WCS instance using a Numpy slice. The order of the slice should be reversed (as for the data) compared to the natural WCS order. Parameters ---------- view : tuple A tuple containing the same number of ...
/usr/src/app/target_test_cases/failed_tests_WCS.slice.txt
def slice(self, view, numpy_order=True): """ Slice a WCS instance using a Numpy slice. The order of the slice should be reversed (as for the data) compared to the natural WCS order. Parameters ---------- view : tuple A tuple containing the same number of ...
WCS.slice
repository-level
external
astropy
38
astropy/io/fits/column.py
def _parse_tdisp_format(tdisp): """ Parse the ``TDISPn`` keywords for ASCII and binary tables into a ``(format, width, precision, exponential)`` tuple (the TDISP values for ASCII and binary are identical except for 'Lw', which is only present in BINTABLE extensions. Parameters ---------- ...
/usr/src/app/target_test_cases/failed_tests__parse_tdisp_format.txt
def _parse_tdisp_format(tdisp): """ Parse the ``TDISPn`` keywords for ASCII and binary tables into a ``(format, width, precision, exponential)`` tuple (the TDISP values for ASCII and binary are identical except for 'Lw', which is only present in BINTABLE extensions. Parameters ---------- ...
_parse_tdisp_format
repository-level
non_external
astropy
39
astropy/io/ascii/qdp.py
def _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None): """Read a table from a QDP file. Parameters ---------- qdp_file : str Input QDP file name Other Parameters ---------------- names : list of str Name of data columns (defaults to ['col1', 'col2', ...])...
/usr/src/app/target_test_cases/failed_tests__read_table_qdp.txt
def _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None): """Read a table from a QDP file. Parameters ---------- qdp_file : str Input QDP file name Other Parameters ---------------- names : list of str Name of data columns (defaults to ['col1', 'col2', ...])...
_read_table_qdp
repository-level
external
astropy
40
astropy/timeseries/downsample.py
def aggregate_downsample( time_series, *, time_bin_size=None, time_bin_start=None, time_bin_end=None, n_bins=None, aggregate_func=None, ): """ Downsample a time series by binning values into bins with a fixed size or custom sizes, using a single function to combine the values in ...
/usr/src/app/target_test_cases/failed_tests_aggregate_downsample.txt
def aggregate_downsample( time_series, *, time_bin_size=None, time_bin_start=None, time_bin_end=None, n_bins=None, aggregate_func=None, ): """ Downsample a time series by binning values into bins with a fixed size or custom sizes, using a single function to combine the values in ...
aggregate_downsample
repository-level
external
astropy
41
astropy/coordinates/builtin_frames/utils.py
def aticq(srepr, astrom): """ A slightly modified version of the ERFA function ``eraAticq``. ``eraAticq`` performs the transformations between two coordinate systems, with the details of the transformation being encoded into the ``astrom`` array. There are two issues with the version of aticq in E...
/usr/src/app/target_test_cases/failed_tests_aticq.txt
def aticq(srepr, astrom): """ A slightly modified version of the ERFA function ``eraAticq``. ``eraAticq`` performs the transformations between two coordinate systems, with the details of the transformation being encoded into the ``astrom`` array. There are two issues with the version of aticq in E...
aticq
repository-level
external
astropy
42
astropy/modeling/core.py
def bind_compound_bounding_box( modelinstance, bounding_boxes, selector_args, create_selector=None, ignored=None, order="C", ): """ Add a validated compound bounding box to a model instance. Parameters ---------- modelinstance : `~astropy.modeling.Model` instance Thi...
/usr/src/app/target_test_cases/failed_tests_bind_compound_bounding_box.txt
def bind_compound_bounding_box( modelinstance, bounding_boxes, selector_args, create_selector=None, ignored=None, order="C", ): """ Add a validated compound bounding box to a model instance. Parameters ---------- modelinstance : `~astropy.modeling.Model` instance Thi...
bind_compound_bounding_box
repository-level
non_external
astropy
43
astropy/wcs/utils.py
def celestial_frame_to_wcs(frame, projection="TAN"): """ For a given coordinate frame, return the corresponding WCS object. Note that the returned WCS object has only the elements corresponding to coordinate frames set (e.g. ctype, equinox, radesys). Parameters ---------- frame : :class:`~...
/usr/src/app/target_test_cases/failed_tests_celestial_frame_to_wcs.txt
def celestial_frame_to_wcs(frame, projection="TAN"): """ For a given coordinate frame, return the corresponding WCS object. Note that the returned WCS object has only the elements corresponding to coordinate frames set (e.g. ctype, equinox, radesys). Parameters ---------- frame : :class:`~...
celestial_frame_to_wcs
file-level
non_external
astropy
44
astropy/io/fits/hdu/compressed/_tiled_compression.py
def compress_image_data( image_data, compression_type, compressed_header, compressed_coldefs, ): """ Compress the data in a `~astropy.io.fits.CompImageHDU`. The input HDU is expected to have a uncompressed numpy array as it's ``.data`` attribute. Parameters ---------- image...
/usr/src/app/target_test_cases/failed_tests_compress_image_data.txt
def compress_image_data( image_data, compression_type, compressed_header, compressed_coldefs, ): """ Compress the data in a `~astropy.io.fits.CompImageHDU`. The input HDU is expected to have a uncompressed numpy array as it's ``.data`` attribute. Parameters ---------- image...
compress_image_data
repository-level
external
astropy
45
astropy/timeseries/periodograms/lombscargle/utils.py
def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True): """Compute the reference chi-square for a particular dataset. Note: this is not valid center_data=False and fit_mean=False. Parameters ---------- y : array-like data values dy : float, array, or None, optional d...
/usr/src/app/target_test_cases/failed_tests_compute_chi2_ref.txt
def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True): """Compute the reference chi-square for a particular dataset. Note: this is not valid center_data=False and fit_mean=False. Parameters ---------- y : array-like data values dy : float, array, or None, optional d...
compute_chi2_ref
self-contained
external
astropy
46
astropy/timeseries/periodograms/lombscargle/utils.py
def convert_normalization(Z, N, from_normalization, to_normalization, chi2_ref=None): """Convert power from one normalization to another. This currently only works for standard & floating-mean models. Parameters ---------- Z : array-like the periodogram output N : int the numbe...
/usr/src/app/target_test_cases/failed_tests_convert_normalization.txt
def convert_normalization(Z, N, from_normalization, to_normalization, chi2_ref=None): """Convert power from one normalization to another. This currently only works for standard & floating-mean models. Parameters ---------- Z : array-like the periodogram output N : int the numbe...
convert_normalization
file-level
external
astropy
47
astropy/convolution/convolve.py
def convolve_models(model, kernel, mode="convolve_fft", **kwargs): """ Convolve two models using `~astropy.convolution.convolve_fft`. Parameters ---------- model : `~astropy.modeling.core.Model` Functional model kernel : `~astropy.modeling.core.Model` Convolution kernel mode...
/usr/src/app/target_test_cases/failed_tests_convolve_models.txt
def convolve_models(model, kernel, mode="convolve_fft", **kwargs): """ Convolve two models using `~astropy.convolution.convolve_fft`. Parameters ---------- model : `~astropy.modeling.core.Model` Functional model kernel : `~astropy.modeling.core.Model` Convolution kernel mode...
convolve_models
repository-level
external
astropy
48
astropy/timeseries/periodograms/lombscargle/implementations/mle.py
def design_matrix(t, frequency, dy=None, bias=True, nterms=1): """Compute the Lomb-Scargle design matrix at the given frequency. This is the matrix X such that the periodic model at the given frequency can be expressed :math:`\\hat{y} = X \\theta`. Parameters ---------- t : array-like, shape=(...
/usr/src/app/target_test_cases/failed_tests_design_matrix.txt
def design_matrix(t, frequency, dy=None, bias=True, nterms=1): """Compute the Lomb-Scargle design matrix at the given frequency. This is the matrix X such that the periodic model at the given frequency can be expressed :math:`\\hat{y} = X \\theta`. Parameters ---------- t : array-like, shape=(...
design_matrix
self-contained
external
astropy
49
astropy/utils/data.py
def download_file( remote_url, cache=False, show_progress=True, timeout=None, sources=None, pkgname="astropy", http_headers=None, ssl_context=None, allow_insecure=False, ): """Downloads a URL and optionally caches the result. It returns the filename of a file containing the ...
/usr/src/app/target_test_cases/failed_tests_download_file.txt
def download_file( remote_url, cache=False, show_progress=True, timeout=None, sources=None, pkgname="astropy", http_headers=None, ssl_context=None, allow_insecure=False, ): """Downloads a URL and optionally caches the result. It returns the filename of a file containing the ...
download_file
file-level
external
astropy
50
astropy/utils/data_info.py
def dtype_info_name(dtype): """Return a human-oriented string name of the ``dtype`` arg. This can be use by astropy methods that present type information about a data object. The output is mostly equivalent to ``dtype.name`` which takes the form <type_name>[B] where <type_name> is like ``int`` or `...
/usr/src/app/target_test_cases/failed_tests_dtype_info_name.txt
def dtype_info_name(dtype): """Return a human-oriented string name of the ``dtype`` arg. This can be use by astropy methods that present type information about a data object. The output is mostly equivalent to ``dtype.name`` which takes the form <type_name>[B] where <type_name> is like ``int`` or `...
dtype_info_name
file-level
external
astropy
51
astropy/timeseries/periodograms/lombscargle/_statistics.py
def fap_single(z, N, normalization, dH=1, dK=3): """Single-frequency false alarm probability for the Lomb-Scargle periodogram. This is equal to 1 - cdf, where cdf is the cumulative distribution. The single-frequency false alarm probability should not be confused with the false alarm probability for the...
/usr/src/app/target_test_cases/failed_tests_fap_single.txt
def fap_single(z, N, normalization, dH=1, dK=3): """Single-frequency false alarm probability for the Lomb-Scargle periodogram. This is equal to 1 - cdf, where cdf is the cumulative distribution. The single-frequency false alarm probability should not be confused with the false alarm probability for the...
fap_single
self-contained
external
astropy
52
astropy/coordinates/funcs.py
def get_constellation(coord, short_name=False, constellation_list="iau"): """ Determines the constellation(s) a given coordinate object contains. Parameters ---------- coord : coordinate-like The object to determine the constellation of. short_name : bool If True, the returned n...
/usr/src/app/target_test_cases/failed_tests_get_constellation.txt
def get_constellation(coord, short_name=False, constellation_list="iau"): """ Determines the constellation(s) a given coordinate object contains. Parameters ---------- coord : coordinate-like The object to determine the constellation of. short_name : bool If True, the returned n...
get_constellation
repository-level
external
astropy
53
astropy/coordinates/name_resolve.py
def get_icrs_coordinates(name, parse=False, cache=False): """ Retrieve an ICRS object by using `Sesame <https://cds.unistra.fr/cgi-bin/Sesame>`_ to retrieve coordinates for the specified name. By default, this will search all available databases (SIMBAD, NED and VizieR) until a match is found. If yo...
/usr/src/app/target_test_cases/failed_tests_get_icrs_coordinates.txt
def get_icrs_coordinates(name, parse=False, cache=False): """ Retrieve an ICRS object by using `Sesame <https://cds.unistra.fr/cgi-bin/Sesame>`_ to retrieve coordinates for the specified name. By default, this will search all available databases (SIMBAD, NED and VizieR) until a match is found. If yo...
get_icrs_coordinates
repository-level
external
astropy
54
astropy/table/index.py
def get_index(table, table_copy=None, names=None): """ Inputs a table and some subset of its columns as table_copy. List or tuple containing names of columns as names,and returns an index corresponding to this subset or list or None if no such index exists. Parameters ---------- table : `Ta...
/usr/src/app/target_test_cases/failed_tests_get_index.txt
def get_index(table, table_copy=None, names=None): """ Inputs a table and some subset of its columns as table_copy. List or tuple containing names of columns as names,and returns an index corresponding to this subset or list or None if no such index exists. Parameters ---------- table : `Ta...
get_index
file-level
non_external
astropy
55
astropy/coordinates/builtin_frames/utils.py
def get_offset_sun_from_barycenter(time, include_velocity=False, reverse=False): """ Returns the offset of the Sun center from the solar-system barycenter (SSB). Parameters ---------- time : `~astropy.time.Time` Time at which to calculate the offset include_velocity : `bool` If ...
/usr/src/app/target_test_cases/failed_tests_get_offset_sun_from_barycenter.txt
def get_offset_sun_from_barycenter(time, include_velocity=False, reverse=False): """ Returns the offset of the Sun center from the solar-system barycenter (SSB). Parameters ---------- time : `~astropy.time.Time` Time at which to calculate the offset include_velocity : `bool` If ...
get_offset_sun_from_barycenter
repository-level
non_external
astropy
56
astropy/coordinates/funcs.py
def get_sun(time): """ Determines the location of the sun at a given time (or times, if the input is an array `~astropy.time.Time` object), in geocentric coordinates. Parameters ---------- time : `~astropy.time.Time` The time(s) at which to compute the location of the sun. Returns ...
/usr/src/app/target_test_cases/failed_tests_get_sun.txt
def get_sun(time): """ Determines the location of the sun at a given time (or times, if the input is an array `~astropy.time.Time` object), in geocentric coordinates. Parameters ---------- time : `~astropy.time.Time` The time(s) at which to compute the location of the sun. Returns ...
get_sun
repository-level
external
astropy
57
astropy/visualization/hist.py
def hist(x, bins=10, ax=None, max_bins=1e5, **kwargs): """Enhanced histogram function. This is a histogram function that enables the use of more sophisticated algorithms for determining bins. Aside from the ``bins`` argument allowing a string specified how bins are computed, the parameters are the sam...
/usr/src/app/target_test_cases/failed_tests_hist.txt
def hist(x, bins=10, ax=None, max_bins=1e5, **kwargs): """Enhanced histogram function. This is a histogram function that enables the use of more sophisticated algorithms for determining bins. Aside from the ``bins`` argument allowing a string specified how bins are computed, the parameters are the sam...
hist
repository-level
external
astropy
58
astropy/stats/histogram.py
def histogram( a: ArrayLike, bins: int | list[int | float] | Literal["blocks", "knuth", "scott", "freedman"] | None = 10, range: tuple[int | float, int | float] | None = None, weights: ArrayLike | None = None, **kwargs, ) -> tuple[NDArray, NDArray]: """Enhanced histogram function, pr...
/usr/src/app/target_test_cases/failed_tests_histogram.txt
def histogram( a: ArrayLike, bins: int | list[int | float] | Literal["blocks", "knuth", "scott", "freedman"] | None = 10, range: tuple[int | float, int | float] | None = None, weights: ArrayLike | None = None, **kwargs, ) -> tuple[NDArray, NDArray]: """Enhanced histogram function, pr...
histogram
file-level
external
astropy
59
astropy/timeseries/periodograms/lombscargle/_statistics.py
def inv_fap_single(fap, N, normalization, dH=1, dK=3): """Single-frequency inverse false alarm probability. This function computes the periodogram value associated with the specified single-frequency false alarm probability. This should not be confused with the false alarm level of the largest peak. ...
/usr/src/app/target_test_cases/failed_tests_inv_fap_single.txt
def inv_fap_single(fap, N, normalization, dH=1, dK=3): """Single-frequency inverse false alarm probability. This function computes the periodogram value associated with the specified single-frequency false alarm probability. This should not be confused with the false alarm level of the largest peak. ...
inv_fap_single
self-contained
external
astropy
60
astropy/coordinates/matrix_utilities.py
def is_O3(matrix, atol=None): """Check whether a matrix is in the length-preserving group O(3). Parameters ---------- matrix : (..., N, N) array-like Must have attribute ``.shape`` and method ``.swapaxes()`` and not error when using `~numpy.isclose`. atol : float, optional T...
/usr/src/app/target_test_cases/failed_tests_is_O3.txt
def is_O3(matrix, atol=None): """Check whether a matrix is in the length-preserving group O(3). Parameters ---------- matrix : (..., N, N) array-like Must have attribute ``.shape`` and method ``.swapaxes()`` and not error when using `~numpy.isclose`. atol : float, optional T...
is_O3
self-contained
external
astropy
61
astropy/coordinates/matrix_utilities.py
def is_rotation(matrix, allow_improper=False, atol=None): """Check whether a matrix is a rotation, proper or improper. Parameters ---------- matrix : (..., N, N) array-like Must have attribute ``.shape`` and method ``.swapaxes()`` and not error when using `~numpy.isclose` and `~numpy.li...
/usr/src/app/target_test_cases/failed_tests_is_rotation.txt
def is_rotation(matrix, allow_improper=False, atol=None): """Check whether a matrix is a rotation, proper or improper. Parameters ---------- matrix : (..., N, N) array-like Must have attribute ``.shape`` and method ``.swapaxes()`` and not error when using `~numpy.isclose` and `~numpy.li...
is_rotation
file-level
external
astropy
62
astropy/stats/jackknife.py
def jackknife_resampling(data: NDArray[DT]) -> NDArray[DT]: """Performs jackknife resampling on numpy arrays. Jackknife resampling is a technique to generate 'n' deterministic samples of size 'n-1' from a measured sample of size 'n'. Basically, the i-th sample, (1<=i<=n), is generated by means of remov...
/usr/src/app/target_test_cases/failed_tests_jackknife_resampling.txt
def jackknife_resampling(data: NDArray[DT]) -> NDArray[DT]: """Performs jackknife resampling on numpy arrays. Jackknife resampling is a technique to generate 'n' deterministic samples of size 'n-1' from a measured sample of size 'n'. Basically, the i-th sample, (1<=i<=n), is generated by means of remov...
jackknife_resampling
file-level
external
astropy
63
astropy/stats/jackknife.py
def jackknife_stats( data: NDArray, statistic: Callable, confidence_level: float | None = 0.95, ) -> tuple[float | NDArray, float | NDArray, float | NDArray, NDArray]: """Performs jackknife estimation on the basis of jackknife resamples. This function requires `SciPy <https://www.scipy.org/>`_ to b...
/usr/src/app/target_test_cases/failed_tests_jackknife_stats.txt
def jackknife_stats( data: NDArray, statistic: Callable, confidence_level: float | None = 0.95, ) -> tuple[float | NDArray, float | NDArray, float | NDArray, NDArray]: """Performs jackknife estimation on the basis of jackknife resamples. This function requires `SciPy <https://www.scipy.org/>`_ to b...
jackknife_stats
file-level
external
astropy
64
astropy/table/operations.py
def join( left, right, keys=None, join_type="inner", *, keys_left=None, keys_right=None, keep_order=False, uniq_col_name="{col_name}_{table_name}", table_names=["1", "2"], metadata_conflicts="warn", join_funcs=None, ): """ Perform a join of the left table with the...
/usr/src/app/target_test_cases/failed_tests_join.txt
def join( left, right, keys=None, join_type="inner", *, keys_left=None, keys_right=None, keep_order=False, uniq_col_name="{col_name}_{table_name}", table_names=["1", "2"], metadata_conflicts="warn", join_funcs=None, ): """ Perform a join of the left table with the...
join
repository-level
external
astropy
65
astropy/modeling/statistic.py
def leastsquare(measured_vals, updated_model, weights, *x): """Least square statistic, with optional weights, in N-dimensions. Parameters ---------- measured_vals : ndarray or sequence Measured data values. Will be cast to array whose shape must match the array-cast of the evaluated mod...
/usr/src/app/target_test_cases/failed_tests_leastsquare.txt
def leastsquare(measured_vals, updated_model, weights, *x): """Least square statistic, with optional weights, in N-dimensions. Parameters ---------- measured_vals : ndarray or sequence Measured data values. Will be cast to array whose shape must match the array-cast of the evaluated mod...
leastsquare
self-contained
external
astropy
66
astropy/wcs/utils.py
def obsgeo_to_frame(obsgeo, obstime): """ Convert a WCS obsgeo property into an ITRS coordinate frame. Parameters ---------- obsgeo : array-like A shape ``(6, )`` array representing ``OBSGEO-[XYZ], OBSGEO-[BLH]`` as returned by ``WCS.wcs.obsgeo``. obstime : time-like Th...
/usr/src/app/target_test_cases/failed_tests_obsgeo_to_frame.txt
def obsgeo_to_frame(obsgeo, obstime): """ Convert a WCS obsgeo property into an ITRS coordinate frame. Parameters ---------- obsgeo : array-like A shape ``(6, )`` array representing ``OBSGEO-[XYZ], OBSGEO-[BLH]`` as returned by ``WCS.wcs.obsgeo``. obstime : time-like Th...
obsgeo_to_frame
repository-level
external
astropy
67
astropy/nddata/utils.py
def overlap_slices(large_array_shape, small_array_shape, position, mode="partial"): """ Get slices for the overlapping part of a small and a large array. Given a certain position of the center of the small array, with respect to the large array, tuples of slices are returned which can be used to ex...
/usr/src/app/target_test_cases/failed_tests_overlap_slices.txt
def overlap_slices(large_array_shape, small_array_shape, position, mode="partial"): """ Get slices for the overlapping part of a small and a large array. Given a certain position of the center of the small array, with respect to the large array, tuples of slices are returned which can be used to ex...
overlap_slices
file-level
external
astropy
68
astropy/io/votable/table.py
def parse( source, columns=None, invalid="exception", verify=None, chunk_size=tree.DEFAULT_CHUNK_SIZE, table_number=None, table_id=None, filename=None, unit_format=None, datatype_mapping=None, _debug_python_based_parser=False, ): """ Parses a VOTABLE_ xml file (or fil...
/usr/src/app/target_test_cases/failed_tests_parse.txt
def parse( source, columns=None, invalid="exception", verify=None, chunk_size=tree.DEFAULT_CHUNK_SIZE, table_number=None, table_id=None, filename=None, unit_format=None, datatype_mapping=None, _debug_python_based_parser=False, ): """ Parses a VOTABLE_ xml file (or fil...
parse
repository-level
external
astropy
69
astropy/timeseries/periodograms/lombscargle/implementations/mle.py
def periodic_fit(t, y, dy, frequency, t_fit, center_data=True, fit_mean=True, nterms=1): """Compute the Lomb-Scargle model fit at a given frequency. Parameters ---------- t, y, dy : float or array-like The times, observations, and uncertainties to fit frequency : float The frequency...
/usr/src/app/target_test_cases/failed_tests_periodic_fit.txt
def periodic_fit(t, y, dy, frequency, t_fit, center_data=True, fit_mean=True, nterms=1): """Compute the Lomb-Scargle model fit at a given frequency. Parameters ---------- t, y, dy : float or array-like The times, observations, and uncertainties to fit frequency : float The frequency...
periodic_fit
file-level
external
astropy
70
astropy/wcs/utils.py
def pixel_to_pixel(wcs_in, wcs_out, *inputs): """ Transform pixel coordinates in a dataset with a WCS to pixel coordinates in another dataset with a different WCS. This function is designed to efficiently deal with input pixel arrays that are broadcasted views of smaller arrays, and is compatible w...
/usr/src/app/target_test_cases/failed_tests_pixel_to_pixel.txt
def pixel_to_pixel(wcs_in, wcs_out, *inputs): """ Transform pixel coordinates in a dataset with a WCS to pixel coordinates in another dataset with a different WCS. This function is designed to efficiently deal with input pixel arrays that are broadcasted views of smaller arrays, and is compatible w...
pixel_to_pixel
repository-level
external
astropy
71
astropy/wcs/utils.py
def pixel_to_skycoord(xp, yp, wcs, origin=0, mode="all", cls=None): """ Convert a set of pixel coordinates into a `~astropy.coordinates.SkyCoord` coordinate. Parameters ---------- xp, yp : float or ndarray The coordinates to convert. wcs : `~astropy.wcs.WCS` The WCS transfor...
/usr/src/app/target_test_cases/failed_tests_pixel_to_skycoord.txt
def pixel_to_skycoord(xp, yp, wcs, origin=0, mode="all", cls=None): """ Convert a set of pixel coordinates into a `~astropy.coordinates.SkyCoord` coordinate. Parameters ---------- xp, yp : float or ndarray The coordinates to convert. wcs : `~astropy.wcs.WCS` The WCS transfor...
pixel_to_skycoord
repository-level
non_external
astropy
72
astropy/io/fits/convenience.py
def printdiff(inputa, inputb, *args, **kwargs): """ Compare two parts of a FITS file, including entire FITS files, FITS `HDUList` objects and FITS ``HDU`` objects. Parameters ---------- inputa : str, `HDUList` object, or ``HDU`` object The filename of a FITS file, `HDUList`, or ``HDU`` ...
/usr/src/app/target_test_cases/failed_tests_printdiff.txt
def printdiff(inputa, inputb, *args, **kwargs): """ Compare two parts of a FITS file, including entire FITS files, FITS `HDUList` objects and FITS ``HDU`` objects. Parameters ---------- inputa : str, `HDUList` object, or ``HDU`` object The filename of a FITS file, `HDUList`, or ``HDU`` ...
printdiff
repository-level
non_external
astropy
73
astropy/io/fits/column.py
def python_to_tdisp(format_string, logical_dtype=False): """ Turn the Python format string to a TDISP FITS compliant format string. Not all formats convert. these will cause a Warning and return None. Parameters ---------- format_string : str TDISPn FITS Header keyword. Used to specify...
/usr/src/app/target_test_cases/failed_tests_python_to_tdisp.txt
def python_to_tdisp(format_string, logical_dtype=False): """ Turn the Python format string to a TDISP FITS compliant format string. Not all formats convert. these will cause a Warning and return None. Parameters ---------- format_string : str TDISPn FITS Header keyword. Used to specify...
python_to_tdisp
repository-level
external
astropy
74
astropy/stats/sigma_clipping.py
def sigma_clipped_stats( data: ArrayLike, mask: NDArray | None = None, mask_value: float | None = None, sigma: float | None = 3.0, sigma_lower: float | None = None, sigma_upper: float | None = None, maxiters: int | None = 5, cenfunc: Literal["median", "mean"] | Callable | None = "median"...
/usr/src/app/target_test_cases/failed_tests_sigma_clipped_stats.txt
def sigma_clipped_stats( data: ArrayLike, mask: NDArray | None = None, mask_value: float | None = None, sigma: float | None = 3.0, sigma_lower: float | None = None, sigma_upper: float | None = None, maxiters: int | None = 5, cenfunc: Literal["median", "mean"] | Callable | None = "median"...
sigma_clipped_stats
repository-level
external
astropy
75
astropy/utils/shapes.py
def simplify_basic_index( basic_index: int | slice | Sequence[int | slice | EllipsisType | None], *, shape: Sequence[int], ) -> tuple[int | slice, ...]: """ Given a Numpy basic index, return a tuple of integers and slice objects with no default values (`None`) if possible. If one of the dim...
/usr/src/app/target_test_cases/failed_tests_simplify_basic_index.txt
def simplify_basic_index( basic_index: int | slice | Sequence[int | slice | EllipsisType | None], *, shape: Sequence[int], ) -> tuple[int | slice, ...]: """ Given a Numpy basic index, return a tuple of integers and slice objects with no default values (`None`) if possible. If one of the dim...
simplify_basic_index
self-contained
external
astropy
76
astropy/wcs/utils.py
def skycoord_to_pixel(coords, wcs, origin=0, mode="all"): """ Convert a set of SkyCoord coordinates into pixels. Parameters ---------- coords : `~astropy.coordinates.SkyCoord` The coordinates to convert. wcs : `~astropy.wcs.WCS` The WCS transformation to use. origin : int ...
/usr/src/app/target_test_cases/failed_tests_skycoord_to_pixel.txt
def skycoord_to_pixel(coords, wcs, origin=0, mode="all"): """ Convert a set of SkyCoord coordinates into pixels. Parameters ---------- coords : `~astropy.coordinates.SkyCoord` The coordinates to convert. wcs : `~astropy.wcs.WCS` The WCS transformation to use. origin : int ...
skycoord_to_pixel
repository-level
non_external
astropy
77
astropy/io/fits/convenience.py
def table_to_hdu(table, character_as_bytes=False): """ Convert an `~astropy.table.Table` object to a FITS `~astropy.io.fits.BinTableHDU`. Parameters ---------- table : astropy.table.Table The table to convert. character_as_bytes : bool Whether to return bytes for string colu...
/usr/src/app/target_test_cases/failed_tests_table_to_hdu.txt
def table_to_hdu(table, character_as_bytes=False): """ Convert an `~astropy.table.Table` object to a FITS `~astropy.io.fits.BinTableHDU`. Parameters ---------- table : astropy.table.Table The table to convert. character_as_bytes : bool Whether to return bytes for string colu...
table_to_hdu
repository-level
external
astropy
78
astropy/io/fits/fitstime.py
def time_to_fits(table): """ Replace Time columns in a Table with non-mixin columns containing each element as a vector of two doubles (jd1, jd2) and return a FITS header with appropriate time coordinate keywords. jd = jd1 + jd2 represents time in the Julian Date format with high-precision. ...
/usr/src/app/target_test_cases/failed_tests_time_to_fits.txt
def time_to_fits(table): """ Replace Time columns in a Table with non-mixin columns containing each element as a vector of two doubles (jd1, jd2) and return a FITS header with appropriate time coordinate keywords. jd = jd1 + jd2 represents time in the Julian Date format with high-precision. ...
time_to_fits
repository-level
external
astropy
79
astropy/timeseries/periodograms/lombscargle/implementations/utils.py
def trig_sum(t, h, df, N, f0=0, freq_factor=1, oversampling=5, use_fft=True, Mfft=4): """Compute (approximate) trigonometric sums for a number of frequencies. This routine computes weighted sine and cosine sums:: S_j = sum_i { h_i * sin(2 pi * f_j * t_i) } C_j = sum_i { h_i * cos(2 pi * f_j * ...
/usr/src/app/target_test_cases/failed_tests_trig_sum.txt
def trig_sum(t, h, df, N, f0=0, freq_factor=1, oversampling=5, use_fft=True, Mfft=4): """Compute (approximate) trigonometric sums for a number of frequencies. This routine computes weighted sine and cosine sums:: S_j = sum_i { h_i * sin(2 pi * f_j * t_i) } C_j = sum_i { h_i * cos(2 pi * f_j * ...
trig_sum
file-level
external
astropy
80
astropy/time/core.py
def update_leap_seconds(files=None): """If the current ERFA leap second table is out of date, try to update it. Uses `astropy.utils.iers.LeapSeconds.auto_open` to try to find an up-to-date table. See that routine for the definition of "out of date". In order to make it safe to call this any time, all...
/usr/src/app/target_test_cases/failed_tests_update_leap_seconds.txt
def update_leap_seconds(files=None): """If the current ERFA leap second table is out of date, try to update it. Uses `astropy.utils.iers.LeapSeconds.auto_open` to try to find an up-to-date table. See that routine for the definition of "out of date". In order to make it safe to call this any time, all...
update_leap_seconds
repository-level
non_external
astropy
81
astropy/io/votable/table.py
def validate(source, output=sys.stdout, xmllint=False, filename=None): """ Prints a validation report for the given file. Parameters ---------- source : path-like or file-like Path to a VOTABLE_ xml file or `~pathlib.Path` object having Path to a VOTABLE_ xml file. If file-l...
/usr/src/app/target_test_cases/failed_tests_validate.txt
def validate(source, output=sys.stdout, xmllint=False, filename=None): """ Prints a validation report for the given file. Parameters ---------- source : path-like or file-like Path to a VOTABLE_ xml file or `~pathlib.Path` object having Path to a VOTABLE_ xml file. If file-l...
validate
repository-level
external
astropy
82
astropy/wcs/utils.py
def wcs_to_celestial_frame(wcs): """ For a given WCS, return the coordinate frame that matches the celestial component of the WCS. Parameters ---------- wcs : :class:`~astropy.wcs.WCS` instance The WCS to find the frame for Returns ------- frame : :class:`~astropy.coordinat...
/usr/src/app/target_test_cases/failed_tests_wcs_to_celestial_frame.txt
def wcs_to_celestial_frame(wcs): """ For a given WCS, return the coordinate frame that matches the celestial component of the WCS. Parameters ---------- wcs : :class:`~astropy.wcs.WCS` instance The WCS to find the frame for Returns ------- frame : :class:`~astropy.coordinat...
wcs_to_celestial_frame
file-level
non_external
astropy
83
astropy/utils/diff.py
def where_not_allclose(a, b, rtol=1e-5, atol=1e-8): """ A version of :func:`numpy.allclose` that returns the indices where the two arrays differ, instead of just a boolean value. Parameters ---------- a, b : array-like Input arrays to compare. rtol, atol : float Relative an...
/usr/src/app/target_test_cases/failed_tests_where_not_allclose.txt
def where_not_allclose(a, b, rtol=1e-5, atol=1e-8): """ A version of :func:`numpy.allclose` that returns the indices where the two arrays differ, instead of just a boolean value. Parameters ---------- a, b : array-like Input arrays to compare. rtol, atol : float Relative an...
where_not_allclose
self-contained
external
astropy
84
astropy/io/votable/table.py
def writeto(table, file, tabledata_format=None): """ Writes a `~astropy.io.votable.tree.VOTableFile` to a VOTABLE_ xml file. Parameters ---------- table : `~astropy.io.votable.tree.VOTableFile` or `~astropy.table.Table` instance. file : str or :term:`file-like (writeable)` Path or file...
/usr/src/app/target_test_cases/failed_tests_writeto.txt
def writeto(table, file, tabledata_format=None): """ Writes a `~astropy.io.votable.tree.VOTableFile` to a VOTABLE_ xml file. Parameters ---------- table : `~astropy.io.votable.tree.VOTableFile` or `~astropy.table.Table` instance. file : str or :term:`file-like (writeable)` Path or file...
writeto
repository-level
non_external
flask
0
src/flask/sansio/app.py
def handle_url_build_error( self, error: BuildError, endpoint: str, values: dict[str, t.Any] ) -> str: """Called by :meth:`.url_for` if a :exc:`~werkzeug.routing.BuildError` was raised. If this returns a value, it will be returned by ``url_for``, otherwise the error will ...
/usr/src/app/target_test_cases/failed_tests_app.App.handle_url_build_error.txt
def handle_url_build_error( self, error: BuildError, endpoint: str, values: dict[str, t.Any] ) -> str: """Called by :meth:`.url_for` if a :exc:`~werkzeug.routing.BuildError` was raised. If this returns a value, it will be returned by ``url_for``, otherwise the error will ...
app.App.handle_url_build_error
file-level
external
flask
1
src/flask/sansio/app.py
def trap_http_exception(self, e: Exception) -> bool: """Checks if an HTTP exception should be trapped or not. By default this will return ``False`` for all exceptions except for a bad request key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to ``True``. It also returns ``True`` if `...
/usr/src/app/target_test_cases/failed_tests_app.App.trap_http_exception.txt
def trap_http_exception(self, e: Exception) -> bool: """Checks if an HTTP exception should be trapped or not. By default this will return ``False`` for all exceptions except for a bad request key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to ``True``. It also returns ``True`` if `...
app.App.trap_http_exception
file-level
non_external
flask
2
src/flask/app.py
def app_context(self) -> AppContext: """Create an :class:`~flask.ctx.AppContext`. Use as a ``with`` block to push the context, which will make :data:`current_app` point at this application. An application context is automatically pushed by :meth:`RequestContext.push() <flask...
/usr/src/app/target_test_cases/failed_tests_app.Flask.app_context.txt
def app_context(self) -> AppContext: """Create an :class:`~flask.ctx.AppContext`. Use as a ``with`` block to push the context, which will make :data:`current_app` point at this application. An application context is automatically pushed by :meth:`RequestContext.push() <flask...
app.Flask.app_context
repository-level
non_external
flask
3
src/flask/app.py
def create_url_adapter(self, request: Request | None) -> MapAdapter | None: """Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly. .. versionadded:: 0.6 .. versio...
/usr/src/app/target_test_cases/failed_tests_app.Flask.create_url_adapter.txt
def create_url_adapter(self, request: Request | None) -> MapAdapter | None: """Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly. .. versionadded:: 0.6 .. versio...
app.Flask.create_url_adapter
repository-level
non_external
flask
4
src/flask/app.py
def do_teardown_appcontext( self, exc: BaseException | None = _sentinel, # type: ignore[assignment] ) -> None: """Called right before the application context is popped. When handling a request, the application context is popped after the request context. See :meth:`do_t...
/usr/src/app/target_test_cases/failed_tests_app.Flask.do_teardown_appcontext.txt
def do_teardown_appcontext( self, exc: BaseException | None = _sentinel, # type: ignore[assignment] ) -> None: """Called right before the application context is popped. When handling a request, the application context is popped after the request context. See :meth:`do_t...
app.Flask.do_teardown_appcontext
repository-level
non_external
flask
5
src/flask/app.py
def do_teardown_request( self, exc: BaseException | None = _sentinel, # type: ignore[assignment] ) -> None: """Called after the request is dispatched and the response is returned, right before the request context is popped. This calls all functions decorated with ...
/usr/src/app/target_test_cases/failed_tests_app.Flask.do_teardown_request.txt
def do_teardown_request( self, exc: BaseException | None = _sentinel, # type: ignore[assignment] ) -> None: """Called after the request is dispatched and the response is returned, right before the request context is popped. This calls all functions decorated with ...
app.Flask.do_teardown_request
repository-level
non_external
flask
6
src/flask/app.py
def get_send_file_max_age(self, filename: str | None) -> int | None: """Used by :func:`send_file` to determine the ``max_age`` cache value for a given file path if it wasn't passed. By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from the configuration of :data:`~flask.cu...
/usr/src/app/target_test_cases/failed_tests_app.Flask.get_send_file_max_age.txt
def get_send_file_max_age(self, filename: str | None) -> int | None: """Used by :func:`send_file` to determine the ``max_age`` cache value for a given file path if it wasn't passed. By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from the configuration of :data:`~flask.cu...
app.Flask.get_send_file_max_age
repository-level
external
flask
7
src/flask/app.py
def make_response(self, rv: ft.ResponseReturnValue) -> Response: """Convert the return value from a view function to an instance of :attr:`response_class`. :param rv: the return value from the view function. The view function must return a response. Returning ``None``, or the vi...
/usr/src/app/target_test_cases/failed_tests_app.Flask.make_response.txt
def make_response(self, rv: ft.ResponseReturnValue) -> Response: """Convert the return value from a view function to an instance of :attr:`response_class`. :param rv: the return value from the view function. The view function must return a response. Returning ``None``, or the vi...
app.Flask.make_response
repository-level
external
flask
8
src/flask/app.py
def open_resource( self, resource: str, mode: str = "rb", encoding: str | None = None ) -> t.IO[t.AnyStr]: """Open a resource file relative to :attr:`root_path` for reading. For example, if the file ``schema.sql`` is next to the file ``app.py`` where the ``Flask`` app is defined...
/usr/src/app/target_test_cases/failed_tests_app.Flask.open_resource.txt
def open_resource( self, resource: str, mode: str = "rb", encoding: str | None = None ) -> t.IO[t.AnyStr]: """Open a resource file relative to :attr:`root_path` for reading. For example, if the file ``schema.sql`` is next to the file ``app.py`` where the ``Flask`` app is defined...
app.Flask.open_resource
file-level
external
flask
9
src/flask/app.py
def request_context(self, environ: WSGIEnvironment) -> RequestContext: """Create a :class:`~flask.ctx.RequestContext` representing a WSGI environment. Use a ``with`` block to push the context, which will make :data:`request` point at this request. See :doc:`/reqcontext`. Ty...
/usr/src/app/target_test_cases/failed_tests_app.Flask.request_context.txt
def request_context(self, environ: WSGIEnvironment) -> RequestContext: """Create a :class:`~flask.ctx.RequestContext` representing a WSGI environment. Use a ``with`` block to push the context, which will make :data:`request` point at this request. See :doc:`/reqcontext`. Ty...
app.Flask.request_context
repository-level
non_external
flask
10
src/flask/app.py
def run( self, host: str | None = None, port: int | None = None, debug: bool | None = None, load_dotenv: bool = True, **options: t.Any, ) -> None: """Runs the application on a local development server. Do not use ``run()`` in a production setting....
/usr/src/app/target_test_cases/failed_tests_app.Flask.run.txt
def run( self, host: str | None = None, port: int | None = None, debug: bool | None = None, load_dotenv: bool = True, **options: t.Any, ) -> None: """Runs the application on a local development server. Do not use ``run()`` in a production setting....
app.Flask.run
repository-level
external
flask
11
src/flask/app.py
def test_client(self, use_cookies: bool = True, **kwargs: t.Any) -> FlaskClient: """Creates a test client for this application. For information about unit testing head over to :doc:`/testing`. Note that if you are testing for assertions or exceptions in your application code, you m...
/usr/src/app/target_test_cases/failed_tests_app.Flask.test_client.txt
def test_client(self, use_cookies: bool = True, **kwargs: t.Any) -> FlaskClient: """Creates a test client for this application. For information about unit testing head over to :doc:`/testing`. Note that if you are testing for assertions or exceptions in your application code, you m...
app.Flask.test_client
repository-level
external
flask
12
src/flask/app.py
def test_request_context(self, *args: t.Any, **kwargs: t.Any) -> RequestContext: """Create a :class:`~flask.ctx.RequestContext` for a WSGI environment created from the given values. This is mostly useful during testing, where you may want to run a function that uses request data with...
/usr/src/app/target_test_cases/failed_tests_app.Flask.test_request_context.txt
def test_request_context(self, *args: t.Any, **kwargs: t.Any) -> RequestContext: """Create a :class:`~flask.ctx.RequestContext` for a WSGI environment created from the given values. This is mostly useful during testing, where you may want to run a function that uses request data with...
app.Flask.test_request_context
repository-level
external
flask
13
src/flask/app.py
def url_for( self, /, endpoint: str, *, _anchor: str | None = None, _method: str | None = None, _scheme: str | None = None, _external: bool | None = None, **values: t.Any, ) -> str: """Generate a URL to the given endpoint with the g...
/usr/src/app/target_test_cases/failed_tests_app.Flask.url_for.txt
def url_for( self, /, endpoint: str, *, _anchor: str | None = None, _method: str | None = None, _scheme: str | None = None, _external: bool | None = None, **values: t.Any, ) -> str: """Generate a URL to the given endpoint with the g...
app.Flask.url_for
repository-level
external
flask
14
src/flask/app.py
def wsgi_app( self, environ: WSGIEnvironment, start_response: StartResponse ) -> cabc.Iterable[bytes]: """The actual WSGI application. This is not implemented in :meth:`__call__` so that middlewares can be applied without losing a reference to the app object. Instead of doing thi...
/usr/src/app/target_test_cases/failed_tests_app.Flask.wsgi_app.txt
def wsgi_app( self, environ: WSGIEnvironment, start_response: StartResponse ) -> cabc.Iterable[bytes]: """The actual WSGI application. This is not implemented in :meth:`__call__` so that middlewares can be applied without losing a reference to the app object. Instead of doing thi...
app.Flask.wsgi_app
repository-level
external
flask
15
src/flask/sansio/app.py
def logger(self) -> logging.Logger: """A standard Python :class:`~logging.Logger` for the app, with the same name as :attr:`name`. In debug mode, the logger's :attr:`~logging.Logger.level` will be set to :data:`~logging.DEBUG`. If there are no handlers configured, a default...
/usr/src/app/target_test_cases/failed_tests_app.logger.txt
def logger(self) -> logging.Logger: """A standard Python :class:`~logging.Logger` for the app, with the same name as :attr:`name`. In debug mode, the logger's :attr:`~logging.Logger.level` will be set to :data:`~logging.DEBUG`. If there are no handlers configured, a default...
app.logger
repository-level
external
flask
16
src/flask/sansio/app.py
def register_blueprint(self, blueprint: Blueprint, **options: t.Any) -> None: """Register a :class:`~flask.Blueprint` on the application. Keyword arguments passed to this method will override the defaults set on the blueprint. Calls the blueprint's :meth:`~flask.Blueprint.register` ...
/usr/src/app/target_test_cases/failed_tests_app.register_blueprint.txt
def register_blueprint(self, blueprint: Blueprint, **options: t.Any) -> None: """Register a :class:`~flask.Blueprint` on the application. Keyword arguments passed to this method will override the defaults set on the blueprint. Calls the blueprint's :meth:`~flask.Blueprint.register` ...
app.register_blueprint
repository-level
external
flask
17
src/flask/sansio/app.py
def teardown_appcontext(self, f: T_teardown) -> T_teardown: """Registers a function to be called when the application context is popped. The application context is typically popped after the request context for each request, at the end of CLI commands, or after a manually pushed cont...
/usr/src/app/target_test_cases/failed_tests_app.teardown_appcontext.txt
def teardown_appcontext(self, f: T_teardown) -> T_teardown: """Registers a function to be called when the application context is popped. The application context is typically popped after the request context for each request, at the end of CLI commands, or after a manually pushed cont...
app.teardown_appcontext
repository-level
non_external
flask
18
src/flask/sansio/app.py
def template_global( self, name: str | None = None ) -> t.Callable[[T_template_global], T_template_global]: """A decorator that is used to register a custom template global function. You can specify a name for the global function, otherwise the function name will be used. Example...
/usr/src/app/target_test_cases/failed_tests_app.template_global.txt
def template_global( self, name: str | None = None ) -> t.Callable[[T_template_global], T_template_global]: """A decorator that is used to register a custom template global function. You can specify a name for the global function, otherwise the function name will be used. Example...
app.template_global
repository-level
external
flask
19
src/flask/sansio/app.py
def template_test( self, name: str | None = None ) -> t.Callable[[T_template_test], T_template_test]: """A decorator that is used to register custom template test. You can specify a name for the test, otherwise the function name will be used. Example:: @app.template_te...
/usr/src/app/target_test_cases/failed_tests_app.template_test.txt
def template_test( self, name: str | None = None ) -> t.Callable[[T_template_test], T_template_test]: """A decorator that is used to register custom template test. You can specify a name for the test, otherwise the function name will be used. Example:: @app.template_te...
app.template_test
repository-level
external
flask
20
src/flask/sansio/blueprints.py
def register(self, app: App, options: dict[str, t.Any]) -> None: """Called by :meth:`Flask.register_blueprint` to register all views and callbacks registered on the blueprint with the application. Creates a :class:`.BlueprintSetupState` and calls each :meth:`record` callback with it....
/usr/src/app/target_test_cases/failed_tests_blueprints.Blueprint.register.txt
def register(self, app: App, options: dict[str, t.Any]) -> None: """Called by :meth:`Flask.register_blueprint` to register all views and callbacks registered on the blueprint with the application. Creates a :class:`.BlueprintSetupState` and calls each :meth:`record` callback with it....
blueprints.Blueprint.register
repository-level
external
flask
21
src/flask/sansio/blueprints.py
def register_blueprint(self, blueprint: Blueprint, **options: t.Any) -> None: """Register a :class:`~flask.Blueprint` on this blueprint. Keyword arguments passed to this method will override the defaults set on the blueprint. .. versionchanged:: 2.0.1 The ``name`` option...
/usr/src/app/target_test_cases/failed_tests_blueprints.register_blueprint.txt
def register_blueprint(self, blueprint: Blueprint, **options: t.Any) -> None: """Register a :class:`~flask.Blueprint` on this blueprint. Keyword arguments passed to this method will override the defaults set on the blueprint. .. versionchanged:: 2.0.1 The ``name`` option...
blueprints.register_blueprint
repository-level
external
flask
22
src/flask/cli.py
def load_dotenv(path: str | os.PathLike[str] | None = None) -> bool: """Load "dotenv" files in order of precedence to set environment variables. If an env var is already set it is not overwritten, so earlier files in the list are preferred over later files. This is a no-op if `python-dotenv`_ is not i...
/usr/src/app/target_test_cases/failed_tests_cli.load_dotenv.txt
def load_dotenv(path: str | os.PathLike[str] | None = None) -> bool: """Load "dotenv" files in order of precedence to set environment variables. If an env var is already set it is not overwritten, so earlier files in the list are preferred over later files. This is a no-op if `python-dotenv`_ is not i...
cli.load_dotenv
self-contained
external