Changelog History
Page 1
-
v5.1 Changes
May 23, 2022🆕 New Features
astropy.coordinates
The ephemeris used in
astropy.coordinatescan now be set to any version of the JPL ephemeris available from https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/. [#12541]Angle.to_string()now accepts the'latex_inline'unit format. [#13056]
astropy.cosmology
📜 Cosmology instance can be parsed from or converted to a YAML string using the new "yaml" format in Cosmology's
to/from_formatI/O. [#12279]Register "astropy.row" into Cosmology's to/from format I/O, allowing a Cosmology instance to be parse from or converted to an Astropy Table Row. [#12313]
👯 A method
clonehas been added toParameterto quickly deep copy the object and change any constructor argument. A supporting equality method is added, andrepris enhanced to be able to roundtrip --eval(repr(Parameter()))-- if the Parameter's arguments can similarly roundtrip. Parameter's arguments are made keyword-only. [#12479]➕ Add methods
OtotandOtot0to FLRW cosmologies to calculate the total energy density of the Universe. [#12590]➕ Add property
is_flatto cosmologies to calculate the curvature of the Universe.Cosmologyis now an abstract class and subclasses must override the abstract propertyis_flat. [#12606]For converting a cosmology to a mapping, two new boolean keyword arguments are added:
cosmology_as_strfor turning the class reference to a string, instead of the class object itself, andmove_from_metato merge the metadata with the rest of the returned mapping instead of adding it as a nested dictionary. [#12710]Register format "astropy.cosmology" with Cosmology I/O. [#12736]
Cosmological equivalency (
Cosmology.is_equivalent) can now be extended to any Python object that can be converted to a Cosmology, using the new keyword argumentformat. This allows e.g. a properly formatted Table to be equivalent to a Cosmology. [#12740]✅ The new module
cosmology/tests/helper.pyhas been added to provide tools for testing the cosmology module and related extensions. [#12966]A new property
nonflathas been added to flat cosmologies (FlatCosmologyMixinsubclasses) to get an equivalent cosmology, but of the corresponding non-flat class. [#13076]👯
clonehas been enhanced to allow for flat cosmologies to clone on the equivalent non-flat cosmology. [#13099]cosmologyfile I/O uses the Unified Table I/O interface, which has added support for reading and writing file paths of the form~/file.ecsvor~<username>/file.ecsv, referring to the home directory of the current user or the specified user, respectively. [#13129]
astropy.io.ascii ^
Simplify the way that the
convertersargument ofio.ascii.readis provided. Previously this required wrapping each data type as the tuple returned by theio.ascii.convert_numpy()function and ensuring that the value is alist. With this update you can writeconverters={'col1': bool}to force conversion as aboolinstead of the previous syntaxconverters={'col1': [io.ascii.convert_numpy(bool)]}. Note that this update is back-compatible with the old behavior. [#13073]➕ Added support in
io.asciifor reading and writing file paths of the form~/file.csvor~<username>/file.csv, referring to the home directory of the current user or the specified user, respectively. [#13130]
astropy.io.fits ^
📜 Add option
unit_parse_stricttoastropy.io.fits.connect.read_table_fitsto enable warnings or errors about invalid FITS units when usingastropy.table.Table.read. The default for this new option is"warn", which means warnings are now raised for columns with invalid units. [#11843]🔄 Changes default FITS behavior to use buffered I/O rather than unbuffered I/O for performance reasons. [#12081]
astropy.io.fits.Headernow has a method to calculate the size (in bytes) of the data portion (with or without padding) following that header. [#12110]
astropy.io.misc ^
👍 Allow serialization of model unit equivalencies. [#10198]
Built-in Cosmology subclasses can now be converted to/from YAML with the functions
dumpandloadinastropy.io.misc.yaml. [#12279]➕ Add asdf support for
Cosine1D,Tangent1D,ArcSine1D,ArcCosine1D, andArcTangent1Dmodels. [#12895]➕ Add asdf support for
Spline1Dmodels. [#12897]
astropy.io.registry
- ➕ Added support to the Unified Table I/O interface for reading and writing file
paths of the form
~/file.csvor~<username>/file.csv, referring to the home directory of the current user or the specified user, respectively. [#13129]
astropy.modeling ^
➕ Add new fitters based on
scipy.optimize.least_squaresmethod of non-linear least-squares optimization: [#12051]TRFLSQFitterusing the Trust Region Reflective algorithm.LMLSQFitterusing the Levenberg-Marquardt algorithm (implemented byscipy.optimize.least_squares).DogBoxLSQFitterusing the dogleg algorithm.
Enable direct use of the
ignoredfeature ofModelBoundingBoxby users in addition to its use as part of enablingCompoundBoundingBox. [#12384]Switch
modeling.projectionsto useastropy.wcs.Prjprmwrapper internally and provide access to theastropy.wcs.Prjprmstructure. [#12558]➕ Add error to non-finite inputs to the
LevMarLSQFitter, to protect against soft scipy failure. [#12811]👍 Allow the
Ellipse2DandSersic2Dtheta parameter to be input as an angular quantity. [#13030]➕ Added
Schechter1Dmodel. [#13116]
astropy.nddata ^
➕ Add support for converting between uncertainty types. This uncertainty conversion system uses a similar flow to the coordinate subsystem, where Cartesian is used as the common system. In this case, variance is used as the common system. [#12057]
The
as_image_hduoption is now available forCCDData.to_hduandCCDData.write. This option allows the user to get anImageHDUas the first item of the returnedHDUList, instead of the defaultPrimaryHDU. [#12962]File I/O through
nddata.CCDDatauses the Unified I/O interface, which has added support for reading and writing file paths of the form~/file.csvor~<username>/file.csv, referring to the home directory of the current user or the specified user, respectively. [#13129]
astropy.table ^
A new keyword-only argument
kindwas added to theTable.sortmethod to specify the sort algorithm. [#12637]👍 Columns which are
numpystructured arrays are now fully supported, effectively allowing tables within tables. This applies toColumn,MaskedColumn, andQuantitycolumns. These structured data columns can be stored in ECSV, FITS, and HDF5 formats. [#12644]👌 Improve the performance of
np.searchsortedby a factor of 1000 for a bytes-typeColumnwhen the search value isstror an array ofstr. This happens commonly for string data stored in FITS or HDF5 format files. [#12680]➕ Add support for using mixin columns in group aggregation operations when the mixin supports the specified operation (e.g.
np.sumworks forQuantitybut notTime). In cases where the operation is not supported the code now issues a warning and drops the column instead of raising an exception. [#12825]➕ Added support to the Unified Table I/O interface for reading and writing file paths of the form
~/file.csvor~<username>/file.csv, referring to the home directory of the current user or the specified user, respectively. [#13129]
astropy.time ^
- ➕ Add support for calling
numpy.linspace()with twoTimeinstances to generate a or multiple linearly spaced set(s) of times. [#13132]
astropy.units ^
structured_to_unstructuredandunstructured_to_structuredinnumpy.lib.recfunctionsnow work with Quantity. [#12486]Implement multiplication and division of LogQuantities and numbers [#12566]
🆕 New
doppler_redshiftequivalency to convert between Doppler redshift and radial velocity. [#12709]➕ Added the
wherekeyword argument to themean(),var(),std()andnansum()methods ofastropy.units.Quantity. Also added theintialkeyword argument toastropy.units.Quantity.nansum(). [#12891]➕ Added "Maxwell" as a unit for magnetic flux to the CGS module. [#12975]
Quantity.to_string()andFunctionUnitBase.to_string()now accept the'latex_inline'unit format. The output ofStructuredUnit.to_string()when called withformat='latex_inline'is now more consistent with the output when called withformat='latex'. [#13056]
astropy.utils ^
➕ Added the
wherekeyword argument to themean(),var(),std(),any(), andall()methods ofastropy.utils.masked.MaskedNDArray. [#12891]👌 Improve handling of unavailable IERS-A (predictive future Earth rotation) data in two ways. First, allow conversions with degraded accuracy if the IERS-A data are missing or do not cover the required time span. This is done with a new config item
conf.iers_degraded_accuracywhich specifies the behavior when times are outside the range of IERS table. The options are 'error' (raise anIERSRangeError, default), 'warn' (issue aIERSDegradedAccuracyWarning) or 'ignore' (ignore the problem). Second, the logic for auto-downloads was changed to guarantee that no matter what happens with the IERS download operations, only warnings will be issued. [#13052]
astropy.wcs ^
astropy.wcs.Celprmandastropy.wcs.Prjprmhave been added to allow access to lower level WCSLIB functionality and to allow direct access to thecelandprjmembers ofWcsprm. [#12514]➕ Add
temporalproperties for convenient access of/selection of/testing for theTIMEaxis introduced in WCSLIB version 7.8. [#13094]
API Changes
astropy.coordinates
- The
dms_to_degreesandhms_to_hoursfunctions (and implicitly tuple-based initialization ofAngle) is now deprecated, as it was difficult to be sure about the intent of the user for signed values of the degrees/hours, minutes, and seconds. [#13162]
astropy.cosmology
The already deprecated
Planck18_arXiv_v2has been removed. UsePlanck18instead [#12354]default_cosmology.get_cosmology_from_stringis deprecated and will be removed in two minor versions. Usegetattr(astropy.cosmology, <str>)instead. [#12375]🚚 In I/O, conversions of Parameters move more relevant information from the Parameter to the Column. The default Parameter
format_specis changed from".3g"to"". [#12612]📇 Units of redshift are added to
z_reionin built-in realizations' metadata. [#12624]Cosmology realizations (e.g.
Planck18) and parameter dictionaries are now lazily loaded from source files. [#12746]The Cosmology Parameter argument "fmt" for specifying a format spec has been deprecated in favor of using the built-in string representation from the Parameter's value's dtype. [#13072]
astropy.io.ascii ^
- When reading an ECSV file, changed the type checking
to issue an
InvalidEcsvDatatypeWarninginstead of raising aValueErrorexception if thedatatypeof a column is not recognized in the ECSV standard. This also applies to older versions of ECSV files which used to silently proceed but now warn first. [#12841]
astropy.io.fits ^
✂ Removed deprecated
clobberargument from functions inastropy.io.fits. [#12258]➕ Add
-s/--sortargument tofitsheaderto sort the fitsort-mode output. [#13106]
astropy.io.misc ^
- 📦 Deprecate asdf in astropy core in favor of the asdf-astropy package. [#12903, #12930]
astropy.modeling ^
- Made
astropy.modeling.fitting._fitter_to_model_paramsandastropy.modeling.fitting._model_to_fit_paramspublic methods. [#12585]
astropy.table ^
🔄 Change the repr of the Table object to replace embedded newlines and tabs with
r'\n'andr'\t'respectively. This improves the display of such tables. [#12631]A new keyword-only argument
kindwas added to theTable.sortmethod to specify the sort algorithm. The signature ofTable.sortwas modified so that thereverseargument is now keyword-only. Previouslyreversecould be specified as the second positional argument. [#12637]🔄 Changed behavior when a structured
numpy.ndarrayis added as a column to aTable. Previously this was converted to aNdarrayMixinsubclass ofndarrayand added as a mixin column. This was because saving as a file (e.g. HDF5, FITS, ECSV) was not supported for structured array columns. Now a structurednumpy.ndarrayis added to the table as a nativeColumnand saving to file is supported. [#13236]
✅ astropy.tests ^
✅ Backward-compatible import of
astropy.tests.disable_internethas been removed; usepytest_remotedata.disable_internetfrompytest-remotedatainstead. [#12633]✅ Backward-compatible import of
astropy.tests.helper.remote_datahas been removed; usepytest.mark.remote_datafrompytest-remotedatainstead. [#12633]🚀 The following are deprecated and will be removed in a future release. Use
pytestwarning and exception handling instead: [#12633]astropy.io.ascii.tests.common.raisesastropy.tests.helper.catch_warningsastropy.tests.helper.ignore_warningsastropy.tests.helper.raisesastropy.tests.helper.enable_deprecations_as_exceptionsastropy.tests.helper.treat_deprecations_as_exceptions
✅ Backward-compatible plugin
astropy.tests.plugins.displayhas been removed; usepytest-astropy-headerinstead. [#12633]
astropy.time ^
- Creating an
~astropy.time.TimeDeltaobject with numerical inputs that do not have a unit and without specifying an explicit format, for exampleTimeDelta(5), now results in a~astropy.time.TimeDeltaMissingUnitWarning. This also affects statements likeTime("2020-01-01") + 5orTime("2020-01-05") - Time("2020-01-03") < 5, which implicitly transform the right-hand side into an~astropy.time.TimeDeltainstance. [#12888]
🐛 Bug Fixes
astropy.coordinates
- The machinery that makes observatory locations available as
EarthLocationobjects is now smarter about processing observatory names from its data files. More names are available for use and the empty string is no longer considered to be a valid name. [#12721]
astropy.io.ascii ^
🛠 Fixed
io.asciiread and write functions for most formats to correctly handle data fields with embedded newlines for both the fast and pure-Python readers and writers. [#12631]🛠 Fix an issue when writing
Timetable columns to a file when the timeformatis one ofdatetime,datetime64, orymdhms. Previously, writing aTimecolumn with one of these formats could result in an exception or else an incorrect output file that cannot be read back in. [#12842]
astropy.io.fits ^
➕ Add a
mask_invalidoption toTable.readto allow deactivating the masking of NaNs in float columns and empty strings in string columns. This option is necessary to allow effective use of memory-mapped reading withmemmap=True. [#12544]🛠 Fix
CompImageHeader.clear(). [#13102]
astropy.modeling ^
- 🛠 Bugfix for
ignorefunctionality failing inModelBoundingBoxwhen usingignoreoption alongside passing bounding box data as tuples. [#13032]
astropy.table ^
Fixed a bug in
Table.show_in_browserusing thejsviewer=Trueoption to display the table with sortable columns. Previously the sort direction arrows were not being shown due to missing image files for the arrows. [#12716]🛠 Fix an issue when writing
Timetable columns to a file when the timeformatis one ofdatetime,datetime64, orymdhms. Previously, writing aTimecolumn with one of these formats could result in an exception or else an incorrect output file that cannot be read back in. [#12842]🛠 Fixed a bug where it is not possible to set the
.info.formatproperty of a table structured column and get formatted output. [#13233]🛠 Fixed a bug when adding a masked structured array to a table. Previously this was auto-converted to a
NdarrayMixinwhich loses the mask. With this fix the data are added to the table as aMaskedColumnand the mask is preserved. [#13236]
astropy.time ^
- 🛠 Fix an issue when writing
Timetable columns to a file when the timeformatis one ofdatetime,datetime64, orymdhms. Previously, writing aTimecolumn with one of these formats could result in an exception or else an incorrect output file that cannot be read back in. [#12842]
astropy.utils ^
🛠 Fixed a bug which caused
numpy.interpto produce incorrect results whenMaskedarrays were passed. [#12978]🛠 Fixed HAS_YAML not working as intended. [#13066]
astropy.wcs ^
Convert
NoConvergenceerrors to warnings inworld_to_pixel_valuesso that callers can work at least with the non converged solution. [#11693]🔦 Expose the ability to select TIME axis introduced in WCSLIB version 7.8. [#13062]
Do not call
wcstabonwcscopyand copywtbmembers from the original WCS. [#13063]⚡️ Updated bundled WCSLIB version to 7.11. This update together with 7.10 includes bug fixes to
tabini()andtabcpy()as well as several print formatting enhancements. For a full list of changes - see http://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES [#13171]Fixed error that occurred in
WCS.world_to_pixelforWCSobjects with a spectral axis and observer location information when passing aSpectralCoordthat had missing observer or target information. [#13228]
-
v5.0.4 Changes
March 31, 2022🐛 Bug Fixes
astropy.modeling ^
- 🛠 Fixed the
Gaussian2Dbounding_boxwhenthetais an angularQuantity. [#13021]
astropy.utils ^
- Reverted
astropy.utils.iers.iers.IERS_A_URLtomaia.usno.navy.mildomain instead of NASA FTP to work around server issues. [#13004]
Other Changes and Additions
- 🛠 Updated bundled WCSLIB to version 7.9 with several bugfixes and added
support for time coordinate axes in
wcsset()andwcssub(). The four-digit type code for the time axis will have the first digit set to 4, i.e., four digit code will be 4xxx where x is a digit 0-9. For a full list of bug fixes see https://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES [#12994]
- 🛠 Fixed the
-
v5.0.3 Changes
March 25, 2022🐛 Bug Fixes
astropy.convolution
- 🛠 Bugfix in
astropy.convolution.utils.discretize_modelwhich allows the function to handle aCompoundModel. Before this fix,discretize_modelwas confusingCompoundModelwith a callable function. [#12959]
astropy.io.fits ^
- 🛠 Fix write and read FITS tables with multidimensional items, using
from_columnswithout previousely definedColDefsstructure. [#12863]
astropy.io.votable
- 🛠 Fix VOTable linting to avoid use of shell option. [#12985]
astropy.utils ^
- 🛠 Fix XML linting to avoid use of shell option. [#12985]
Other Changes and Additions
- ⚡️ Updated the bundled CFITSIO library to 4.1.0. [#12967]
- 🛠 Bugfix in
-
v5.0.2 Changes
March 10, 2022🐛 Bug Fixes
astropy.io.ascii ^
- 🛠 Bugfix to add backwards compatibility for reading ECSV version 0.9 files with
non-standard column datatypes (such as
object,str,datetime64, etc.), which would raise a ValueError in ECSV version 1.0. [#12880]
astropy.io.misc ^
- 🛠 Bugfix for
units_mappingschema's property name conflicts. Changes:inputstounit_inputsoutputstounit_outputs[#12800]
astropy.io.votable
- 🛠 Fixed a bug where
astropy.io.votable.validatewas printing output tosys.stdoutwhen theoutputparamter was set toNone.validatenow returns a string whenoutputis set toNone, as documented. [#12604]
astropy.modeling ^
🛠 Fix handling of units on
scaleparameter in BlackBody model. [#12318]Indexing on models can now be used with all types of integers (like
numpy.int64) instead of justint. [#12561]🛠 Fix computation of the separability of a
CompoundModelwhere anotherCompoundModelis on the right hand side of the&operator. [#12907]Provide a hook (
Model._calculate_separability_matrix) to allow subclasses ofModelto define how to compute their separability matrix. [#12900]
astropy.stats ^
- Fixed a bug in which running
kuiper_false_positive_probability(D,N)on distributions with many data points could produce NaN values for the false positive probability of the Kuiper statistic. [#12896]
astropy.wcs ^
- 🛠 Fixed a bug due to which
naxis,pixel_shape, andpixel_boundsattributes ofastropy.wcs.WCSwere not restored when anastropy.wcs.WCSobject was unpickled. This fix also eliminatesFITSFixedWarningwarning issued during unpiclikng of the WCS objects related to the number of axes. This fix also eliminates errors when unpickling WCS objects originally created using non-default values forkey,colsel, andkeyselparameters. [#12844]
- 🛠 Bugfix to add backwards compatibility for reading ECSV version 0.9 files with
non-standard column datatypes (such as
-
v5.0.1 Changes
January 26, 2022🐛 Bug Fixes
astropy.coordinates
Trying to create an instance of
astropy.coordinates.Distanceby providing bothzandparallaxnow raises the expectedValueError. [#12531]🛠 Fixed a bug where changing the wrap angle of the longitude component of a representation could raise a warning or error in certain situations. [#12556]
astropy.coordinates.Distanceconstructor no longer ignores theunitkeyword whenparallaxis provided. [#12569]
astropy.cosmology
astropy.cosmology.utils.aszarrcan now convertColumnobjects. [#12525]Reading a cosmology from an ECSV will load redshift and Hubble parameter units from the cosmology units module. [#12636]
astropy.io.fits ^
- Fix formatting issue in
_dump_coldefsand add tests fortabledumpandtableloadconvenience functions. [#12526]
astropy.io.misc ^
- YAML can now also represent quantities and arrays with structured dtype,
as well as structured scalars based on
np.void. [#12509]
astropy.modeling ^
🛠 Fixes error when fitting multiplication or division based compound models where the sub-models have different output units. [#12475]
🛠 Bugfix for incorrectly initialized and filled
parametersdata forSpline1Dmodel. [#12523]Bugfix for
keyerrorthrown byModel.input_units_equivalencieswhen used onfix_inputsmodels which have no set unit equivalencies. [#12597]
astropy.table ^
astropy.table.Table.keep_columns()andastropy.table.Table.remove_columns()now work with generators of column names. [#12529]Avoid duplicate storage of info in serialized columns if the column used to serialize already can hold that information. [#12607]
astropy.timeseries
- 🛠 Fixed edge case bugs which emerged when using
aggregate_downsamplewith custom bins. [#12527]
astropy.units ^
Structured units can be serialized to/from yaml. [#12492]
Fix bad typing problems by removing interaction with
NDArray.__class_getitem__. [#12511]Ensure that
Quantity.to_string(format='latex')properly typesets exponents also whenu.quantity.conf.latex_array_threshold = -1(i.e., when the threshold is taken from numpy). [#12573]Structured units can now be copied with
copy.copyandcopy.deepcopyand also pickled and unpicked also forprotocol>= 2. This does not work for big-endian architecture with oldernumpy<1.21.1. [#12583]
astropy.utils ^
Ensure that a
Maskedinstance can be used to initialize (or viewed as) anumpy.ma.Maskedarray. [#12482]Ensure
Maskedalso works with numpy >=1.22, which has a keyword argument name change fornp.quantile. [#12511]astropy.utils.iers.LeapSeconds.auto_open()no longer emits unnecessary warnings whenastropy.utils.iers.conf.auto_max_ageis set toNone. [#12713]
-
v5.0 Changes
November 15, 2021🆕 New Features
astropy.convolution
- ➕ Added dealiasing support to
convolve_fft. [#11495]
astropy.coordinates
➕ Added missing coordinate transformations where the starting and ending frames are the same (i.e., loopback transformations). [#10909]
👍 Allow negation, multiplication and division also of representations that include a differential (e.g.,
SphericalRepresentationwith aSphericalCosLatDifferential). For all operations, the outcome is equivalent to transforming the representation and differential to cartesian, then operating on those, and transforming back to the original representation (except forUnitSphericalRepresentation, which will return aSphericalRepresentationif there is a scale change). [#11470]RadialRepresentation.transformcan work with a multiplication matrix only. All other matrices still raise an exception. [#11576]transformmethods are added toBaseDifferentialandCartesianDifferential. All transform methods on Representations now delegate transforming differentials to the differential objects. [#11654]➕ Adds new
HADecbuilt-in frame with transformations to/fromICRSandCIRS. This frame complementsAltAzto give observed coordinates (hour angle and declination) in theITRSfor an equatorially mounted telescope. [#11676]SkyCoordobjects now have ato_table()method, which allows them to be converted to aQTable. [#11743]
astropy.cosmology
📇 Cosmologies now store metadata in a mutable parameter
meta. The initialization argumentsnameandmetaare keyword-only. [#11542]A new unit,
redshift, is defined. It is a dimensionless unit to distinguish redshift quantities from other non-redshift values. For compatibility with dimensionless quantities the equivalencydimensionless_redshiftis added. This equivalency is enabled by default. [#11786]➕ Add equality operator for comparing Cosmology instances. Comparison is done on all immutable fields (this excludes 'meta').
Now the following will work:
.. code-block:: python
>>> from astropy.cosmology import Planck13, Planck18 >>> Planck13 == Planck18 False >>> Planck18 == Planck18 True [#11813]➕ Added
read/writemethods to Cosmology using the Unified I/O registry. Now custom file format readers, writers, and format-identifier functions can be registered to read, write, and identify, respectively, Cosmology objects. Details are discussed in an addition to the docs. [#11948]Added
to_format/from_formatmethods to Cosmology using the Unified I/O registry. Now custom format converters and format-identifier functions can be registered to transform Cosmology objects. The transformation between Cosmology and dictionaries is pre-registered. Details are discussed in an addition to the docs. [#11998]➕ Added units module for defining and collecting cosmological units and equivalencies. [#12092]
Flat cosmologies are now set by a mixin class,
FlatCosmologyMixinand its FLRW-specific subclassFlatFLRWMixin. AllFlatCosmologyMixinare flat, but not all flat cosmologies are instances ofFlatCosmologyMixin. As example,LambdaCDMmay be flat (for the a specific set of parameter values), butFlatLambdaCDMwill be flat.
Cosmology parameters are now descriptors. When accessed from a class they transparently stores information, like the units and accepted equivalencies. On a cosmology instance, the descriptor will return the parameter value. Parameters can have custom
gettermethods.Cosmological equality is refactored to check Parameters (and the name) A new method,
is_equivalent, is added to check Cosmology equivalence, so aFlatLambdaCDMand flatLambdaCDMare equivalent. [#12136]Replaced
z = np.asarray(z)withz = u.Quantity(z, u.dimensionless_unscaled).valuein Cosmology methods. Input of values with incorrect units raises a UnitConversionError or TypeError. [#12145]Cosmology Parameters allow for custom value setters. Values can be set once, but will error if set a second time. If not specified, the default setter is used, which will assign units using the Parameters
unitsandequivalencies(if present). Alternate setters may be registered with Parameter to be specified by a str, not a decorator on the Cosmology. [#12190]Cosmology instance conversion to dict now accepts keyword argument
clsto determine dict type, e.g.OrderedDict. [#12209]A new equivalency is added between redshift and the Hubble parameter and values with units of little-h. This equivalency is also available in the catch-all equivalency
with_redshift. [#12211]A new equivalency is added between redshift and distance -- comoving, lookback, and luminosity. This equivalency is also available in the catch-all equivalency
with_redshift. [#12212]Register Astropy Table into Cosmology's
to/from_formatI/O, allowing a Cosmology instance to be parsed from or converted to a Table instance. Also adds the__astropy_table__method allowingTable(cosmology). [#12213]The WMAP1 and WMAP3 are accessible as builtin cosmologies. [#12248]
Register Astropy Model into Cosmology's
to/from_formatI/O, allowing a Cosmology instance to be parsed from or converted to a Model instance. [#12269]Register an ECSV reader and writer into Cosmology's I/O, allowing a Cosmology instance to be read from from or written to an ECSV file. [#12321]
astropy.io.ascii ^
➕ Added new way to specify the dtype for tables that are read:
converterscan specify column names with wildcards. [#11892]➕ Added a new
astropy.io.ascii.Mrtclass to write tables in the American Astronomical Society Machine-Readable Table format, including documentation and tests for the same. [#11897, #12301, #12302]🐎 When writing, the input data are no longer copied, improving performance. Metadata that might be changed, such as format and serialization information, is copied, hence users can continue to count on no changes being made to the input data. [#11919]
astropy.io.misc ^
- ➕ Add Parquet serialization of Tables with pyarrow, including metadata support and columnar access. [#12215]
astropy.modeling ^
➕ Added fittable spline models to
modeling. [#11634]🔨 Extensive refactor of
BoundingBoxfor better usability and maintainability. [#11930]➕ Added
CompoundBoundingBoxfeature to~astropy.modeling, which allows more flexibility in defining bounding boxes for models that are applied to images with many slices. [#11942]👌 Improved parameter support for
astropy.modeling.core.custom_modelcreated models. [#11984]➕ Added the following trigonometric models and linked them to their appropriate inverse models:
Cosine1D[#12158]Tangent1DArcSine1DArcCosine1DArcTangent1D[#12185]
astropy.table ^
➕ Added a new method
Table.update()which does a dictionary-style update of aTableby adding or replacing columns. [#11904]👍 Masked quantities are now fully supported in tables. This includes
QTableautomatically convertingMaskedColumninstances toMaskedQuantity, andTabledoing the reverse. [#11914]Added new keyword arguments
keys_leftandkeys_rightto the tablejoinfunction to support joining tables on key columns with different names. In addition the new keywords can accept a list of column-like objects which are used as the match keys. This allows joining on arbitrary data which are not part of the tables being joined. [#11954]Formatting of any numerical values in the output of
Table.info()andColumn.info()has been improved. [#12022]It is now possible to add dask arrays as columns in tables and have them remain as dask arrays rather than be converted to Numpy arrays. [#12219]
➕ Added a new registry for mixin handlers, which can be used to automatically convert array-like Python objects into mixin columns when assigned to a table column. [#12219]
astropy.time ^
- Adds a new method
earth_rotation_angleto calculate the Local Earth Rotation Angle. Also adjusts Local Sidereal Time for the Terrestrial Intermediate Origin (TIO) and adds a rigorous correction for polar motion. TheTIOadjustment is approximately 3 microseconds per century fromJ2000and the polar motion correction is at most about +/-50 nanoseconds. For modelsIAU1982andIAU1994, no such adjustments are made as they pre-date the TIO concept. [#11680]
astropy.timeseries
- A custom binning scheme is now available in
aggregate_downsample. It allowstime_bin_startandtime_bin_sizeto be arrays, and adds an optionaltime_bin_end. This scheme mirrors the API forBinnedTimeSeries. [#11266]
astropy.units ^
Quantitygains a__class_getitem__to create unit-aware annotations with the syntaxQuantity[unit or physical_type, shape, numpy.dtype]. If the python version is 3.9+ ortyping_extensionsis installed, these are valid static type annotations. [#10662]Each physical type is added to
astropy.units.physical(e.g.,physical.lengthorphysical.electrical_charge_ESU). The attribute-accessible names (underscored, without parenthesis) also work withastropy.units.physical.get_physical_type. [#11691]It is now possible to have quantities based on structured arrays in which the unit has matching structure, giving each field its own unit, using units constructed like
Unit('AU,AU/day'). [#11775]The milli- prefix has been added to
astropy.units.Angstrom. [#11788]➕ Added attributes
base,coords, andindexand methodcopy()toQuantityIteratorto matchnumpy.ndarray.flatiter. [#11796]➕ Added "angular frequency" and "angular velocity" as aliases for the "angular speed" physical type. [#11865]
➕ Add light-second to units of length [#12128]
astropy.utils ^
📇 The
astropy.utils.deprecated_renamed_argument()decorator now supports custom warning messages. [#12305]The NaN-aware numpy functions such as
np.nansumnow work on Masked arrays, with masked values being treated as NaN, but without raising warnings or exceptions. [#12454]
astropy.visualization
- ➕ Added a feature so that SphericalCircle will accept center parameter as a SkyCoord object. [#11790]
astropy.wcs ^
astropy.wcs.utils.obsgeo_to_framehas been added to convert the obsgeo coordinate array onastropy.wcs.WCSobjects to anITRScoordinate frame instance. [#11716]🛠 Updated bundled
WCSLIBto version 7.7 with several bugfixes. [#12034]
API Changes
astropy.config ^
- 0️⃣
update_default_configandConfigurationMissingWarningare deprecated. [#11502]
astropy.constants
- Removed deprecated
astropy.constants.set_enabled_constantscontext manager. [#12105]
astropy.coordinates
Positions for the Moon using the 'builtin' ephemeris now use the new
erfa.moon98function instead of our own implementation of the Meeus algorithm. As this also corrects a misunderstanding of the frame returned by the Meeus, this improves the agreement with the JPL ephemeris from about 30 to about 6 km rms. [#11753]✂ Removed deprecated
representationattribute fromastropy.coordinates.BaseCoordinateFrameclass. [#12257]SpectralQuantityandSpectralCoord.to_valuemethod can now be called withoutunitargument in order to maintain a consistent interface withQuantity.to_value[#12440]
astropy.cosmology
z_at_valuenow works with arrays for all arguments (exceptfunc,verbose, andmethod). Consequently,coordinates.Distance.zcan be used when Distance is an array. [#11778]✂ Remove deprecation warning and error remapping in
Cosmology.clone. Now unknown arguments will raise aTypeError, not anAttributeError. [#11785]The
read/writeandto/from_formatUnified I/O registries are separated and apply only toCosmology. [#12015]Cosmology parameters in
cosmology.parameters.pynow have units, where applicable. [#12116]🗄 The function
astropy.cosmology.utils.inf_like()is deprecated. [#12175]The function
astropy.cosmology.utils.vectorize_if_needed()is deprecated. A new functionastropy.cosmology.utils.vectorize_redshift_method()is added as replacement. [#12176]Cosmology base class constructor now only accepts arguments
nameandmeta. Subclasses should add relevant arguments and not pass them to the base class. [#12191]
astropy.io ^
- When
astropyraises anOSErrorbecause a file it was told to write already exists, the error message now always suggests the use of theoverwrite=Trueargument. The wording is now consistent for all I/O formats. [#12179]
astropy.io.ascii ^
- ✂ Removed deprecated
overwrite=Noneoption forastropy.io.ascii.ui.write(). Overwriting existing files now only happens ifoverwrite=True. [#12171]
astropy.io.fits ^
The internal class _CardAccessor is no longer registered as a subclass of the Sequence or Mapping ABCs. [#11923]
🚚 The deprecated
clobberargument will be removed from theastropy.io.fitsfunctions in version 5.1, and the deprecation warnings now announce that too. [#12311]
astropy.io.registry
The
writefunction now is allowed to return possible content results, which means that custom writers could, for example, create and return an instance of some container class rather than a file on disk. [#11916]🔨 The registry functions are refactored into a class-based system. New Read-only, write-only, and read/write registries can be created. All functions accept a new argument
registry, which if not specified, defaults to the global default registry. [#12015]
astropy.io.votable
- 🗄 Deprecated the
pedantickeyword argument in theastropy.io.votable.table.parsefunction and the corresponding configuration setting. It has been replaced by theverifyoption. [#12129]
astropy.modeling ^
🔨 Refactored how
astropy.modeling.Modelhandles model evaluation in order to better organize the code. [#11931]✂ Removed the following deprecated modeling features:
astropy.modeling.utils.ExpressionTreeclass,astropy.modeling.functional_models.MexicanHat1Dmodel,astropy.modeling.functional_models.MexicanHat2Dmodel,astropy.modeling.core.Model.inputssetting in model initialize,astropy.modeling.core.CompoundModel.inversesetting in model initialize, andastropy.modeling.core.CompoundModel.both_inverses_exist()method. [#11978]🗄 Deprecated the
AliasDictclass inmodeling.utils. [#12411]
astropy.nddata ^
- ⬇️ Removed
block_reduceandblock_replicatefunctions fromnddata.utils. These deprecated functions innddata.utilswere moved tonddata.blocks. [#12288]
astropy.stats ^
✂ Removed the following deprecated features from
astropy.stats:confargument forfuncs.binom_conf_interval()andfuncs.binned_binom_proportion(),conflevelargument forfuncs.poisson_conf_interval(), andconf_lvlargument forjackknife.jackknife_stats(). [#12200]
astropy.table ^
🖨 Printing a
Tablenow shows the qualified class name of mixin columns in the dtype header row instead of "object". This applies to all theTableformatted output methods whenevershow_dtype=Trueis selected. [#11660]The 'overwrite' argument has been added to the jsviewer table writer. Overwriting an existing file requires 'overwrite' to be True. [#11853]
The 'overwrite' argument has been added to the pandas table writers. Overwriting an existing file requires 'overwrite' to be True. [#11854]
The table
joinfunction now accepts only the first four argumentsleft,right,keys, andjoin_typeas positional arguments. All other arguments must be supplied as keyword arguments. [#11954]➕ Adding a dask array to a Table will no longer convert that dask to a Numpy array, so accessing t['dask_column'] will now return a dask array instead of a Numpy array. [#12219]
astropy.time ^
- Along with the new method
earth_rotation_angle,sidereal_timenow accepts anEarthLocationas thelongitudeargument. [#11680]
astropy.units ^
- 🚚 Unit
littlehand equivalencywith_H0have been moved to thecosmologymodule and are deprecated fromastropy.units. [#12092]
astropy.utils ^
astropy.utils.introspection.minversion()now usesimportlib.metadata.version(). Therefore, itsversion_pathkeyword is no longer used and deprecated. This keyword will be removed in a future release. [#11714]⚡️ Updated
utils.console.Spinnerto better resemble the API ofutils.console.ProgressBar, including anupdate()method and iterator support. [#11772]Removed deprecated
check_hashesincheck_download_cache(). The function also no longer returns anything. [#12293]Removed unused
download_cache_lock_attemptsconfiguration item inastropy.utils.data. Deprecation was not possible. [#12293]Removed deprecated
hexdigestkeyword fromimport_file_to_cache(). [#12293]🔧 Setting
remote_timeoutconfiguration item inastropy.utils.datato 0 will no longer disable download from the Internet; Setallow_internetconfiguration item toFalseinstead. [#12293]
astropy.visualization
- Removed deprecated
imshow_only_kwargskeyword fromimshow_norm. [#12290]
astropy.wcs ^
- Move complex logic from
HighLevelWCSMixin.pixel_to_worldandHighLevelWCSMixin.world_to_pixelinto the helper functionsastropy.wcs.wcsapi.high_level_api.high_level_objects_to_valuesandastropy.wcs.wcsapi.high_level_api.values_to_high_level_objectsto allow reuse in other places. [#11950]
🐛 Bug Fixes
astropy.config ^
generate_configno longer outputs wrong syntax for list type. [#12037]
astropy.constants
- 🛠 Fixed a bug where an older constants version cannot be set directly after astropy import. [#12084]
astropy.convolution
- Passing an
arrayargument for any Kernel1D or Kernel2D subclasses (with the exception of CustomKernel) will now raise aTypeError. [#11969]
astropy.coordinates
If a
Tablecontaining aSkyCoordobject as a column is written to a FITS, ECSV or HDF5 file then any velocity information that might be present will be retained. [#11750]The output of
SkyCoord.apply_space_motion()now always has the same differential type as theSkyCoorditself. [#11932]🛠 Fixed bug where Angle, Latitude and Longitude with NaN values could not be printed. [#11943]
🛠 Fixed a bug with the transformation from
PrecessedGeocentrictoGCRSwhere changes inobstime,obsgeoloc, orobsgeovelwere ignored. This bug would also affect loopback transformations from onePrecessedGeocentricframe to anotherPrecessedGeocentricframe. [#12152]🛠 Fixed a bug with the transformations between
TEMEandITRSor betweenTEMEand itself where a change inobstimewas ignored. [#12152]Avoid unnecessary transforms through CIRS for AltAz and HADec and use ICRS as intermediate frame for these transformations instead. [#12203]
🛠 Fixed a bug where instantiating a representation with a longitude component could mutate input provided for that component even when copying is specified. [#12307]
Wrapping an
Anglearray will now ignore NaN values instead of attempting to wrap them, which would produce unexpected warnings/errors when working with coordinates and representations due to internal broadcasting. [#12317]
astropy.cosmology
- Dictionaries for in-built cosmology realizations are not altered by creating the realization and are also made immutable. [#12278]
astropy.io.fits ^
Prevent zero-byte writes for FITS binary tables to speed up writes on the Lustre filesystem. [#11955]
Enable
json.dumpfor FITS_rec with variable length (VLF) arrays. [#11957]➕ Add support for reading and writing int8 images [#11996]
Ensure header passed to
astropy.io.fits.CompImageHDUdoes not need to contain standard cards that can be automatically generated, such asBITPIXandNAXIS. [#12061]Fixed a bug where
astropy.io.fits.HDUDiffwould ignore theignore_blank_cardskeyword argument. [#12122]Open uncompressed file even if extension says it's compressed [#12135]
🛠 Fix the computation of the DATASUM in a
CompImageHDUwhen the data is >1D. [#12138]Reading files where the SIMPLE card is present but with an invalid format now issues a warning instead of raising an exception [#12234]
Convert UNDEFINED to None when iterating over card values. [#12310]
astropy.io.misc ^
⚡️ Update ASDF tag versions in ExtensionType subclasses to match ASDF Standard 1.5.0. [#11986]
🛠 Fix ASDF serialization of model inputs and outputs and add relevant assertion to test helper. [#12381]
🛠 Fix bug preventing ASDF serialization of bounding box for models with only one input. [#12385]
astropy.io.votable
- Now accepting UCDs containing phot.color. [#11982]
astropy.modeling ^
➕ Added
Parameterdescriptions to the implemented models which were missing. [#11232]The
separableproperty is now correctly set on models constructed withastropy.modeling.custom_model. [#11744]🛠 Minor bugfixes and improvements to modeling including the following:
- Fixed typos and clarified several errors and their messages throughout modeling.
- Removed incorrect try/except blocks around scipy code in
convolution.pyandfunctional_models.py. - Fixed
Ring2Dmodel's init to properly accept all combinations ofr_in,r_out, andwidth. - Fixed bug in
tauvalidator for theLogarithmic1DandExponential1Dmodels when using them as model sets. - Fixed
copymethod forParameterin order to prevent an automaticKeyError, and fixedboolforParameterso that it functions with vector values. - Removed unreachable code from
Parameter, the_Tabularmodel, and theDrude1Dmodel. - Fixed validators in
Drude1Dmodel so that it functions in a model set. - Removed duplicated code from
polynomial.pyfor handing ofdomainandwindow. - Fixed the
Pix2Sky_HEALPixPolarandSky2Pix_HEALPixPolarmodes so that theirevaluateandinversemethods actually work without raising an error. [#12232]
astropy.nddata ^
- 📜 Ensure that the
wcs=argument toNDDatais always parsed into a high level WCS object. [#11985]
astropy.stats ^
🛠 Fixed a bug in sigma clipping where the bounds would not be returned for completely empty or masked data. [#11994]
Fixed a bug in
biweight_midvarianceandbiweight_scalewhere output data units would be dropped for constant data and where the result was a scalar NaN. [#12146]
astropy.table ^
Ensured that
MaskedColumn.infois propagated in all cases, so that when tables are sliced, writing will still be as requested oninfo.serialize_method. [#11917]⚠
table.conf.replace_warningsandtable.jsviewer.conf.css_urlsconfiguration items now have correct'string_list'type. [#12037]🛠 Fixed an issue where initializing from a list of dict-like rows (Mappings) did not work unless the row values were instances of
dict. Now any object that is an instance of the more generalcollections.abc.Mappingwill work. [#12417]
astropy.uncertainty
- Ensure that scalar
QuantityDistributionunit conversion in ufuncs works properly again. [#12471]
astropy.units ^
➕ Add quantity support for
scipy.specialdimensionless functions erfinv, erfcinv, gammaln and loggamma. [#10934]VOUnit.to_stringoutput is now compliant with IVOA VOUnits 1.0 standards. [#11565]Units initialization with unicode has been expanded to include strings such as 'M☉' and 'e⁻'. [#11827]
📜 Give a more informative
NotImplementedErrorwhen trying to parse a unit using an output-only format such as 'unicode' or 'latex'. [#11829]
astropy.utils ^
Fixed a bug in
get_readable_fileobjthat prevented the unified file read interface from closing ASCII files. [#11809]🗄 The function
astropy.utils.decorators.deprecated_attribute()no longer ignores itsmessage,alternative, andpendingarguments. [#12184]Ensure that when taking the minimum or maximum of a
Maskedarray, any masked NaN values are ignored. [#12454]
astropy.visualization
🚚 The tick labelling for radians has been fixed to remove a redundant
.0in the label for integer multiples of pi at 2pi and above. [#12221]🛠 Fix a bug where non-
astropy.wcs.WCSWCS instances were not accepted inWCSAxes.get_transform. [#12286]🛠 Fix compatibility with Matplotlib 3.5 when using the
grid_type='contours'mode for drawing grid lines. [#12447]
astropy.wcs ^
- Enabled
SlicedLowLevelWCS.pixel_to_world_valuesto handle slices including non-intintegers, e.g.numpy.int64. [#11980]
Other Changes and Additions
📄 In docstrings, Sphinx cross-reference targets now use intersphinx, even if the target is an internal link (
linkis now'astropy:link). When built in Astropy these links are interpreted as internal links. When built in affiliate packages, the link target is set by the key 'astropy' in the intersphinx mapping. [#11690]Made PyYaml >= 3.13 a strict runtime dependency. [#11903]
Minimum version of required Python is now 3.8. [#11934]
Minimum version of required Scipy is now 1.3. [#11934]
Minimum version of required Matplotlib is now 3.1. [#11934]
Minimum version of required Numpy is now 1.18. [#11935]
🛠 Fix deprecation warnings with Python 3.10 [#11962]
🔖 Speed up
minversion()in cases where a module with a__version__attribute is passed. [#12174]astropynow requirespackaging. [#12199]⚡️ Updated the bundled CFITSIO library to 4.0.0. When compiling with an external library, version 3.35 or later is required. [#12272]
- ➕ Added dealiasing support to
-
v4.3.1 Changes
August 11, 2021🐛 Bug Fixes
astropy.io.fits ^
In
fits.io.getdatado not fall back to first non-primary extension when user explicitly specifies an extension. [#11860]Ensure multidimensional masked columns round-trip properly to FITS. [#11911]
Ensure masked times round-trip to FITS, even if multi-dimensional. [#11913]
Raise
ValueErrorif annp.float32NaN/Inf value is assigned to a header keyword. [#11922]
astropy.modeling ^
- 🛠 Fixed bug in
fix_inputshandling of bounding boxes. [#11908]
astropy.table ^
- 🛠 Fix an error when converting to pandas any
Tablesubclass that automatically adds a table index when the table is created. An example is a binnedTimeSeriestable. [#12018]
astropy.units ^
Ensure that unpickling quantities and units in new sessions does not change hashes and thus cause problems with (de)composition such as getting different answers from the
.siattribute. [#11879]🛠 Fixed cannot import name imperial from astropy.units namespace. [#11977]
astropy.utils ^
- Ensure any
.infoonMaskedinstances is propagated correctly when viewing or slicing. As a consequence,MaskedQuantitycan now be correctly written to, e.g., ECSV format withserialize_method='data_mask'. [#11910]
-
v4.3 Changes
July 26, 2021🆕 New Features
astropy.convolution
- Change padding sizes for
fft_padinconvolve_fftfrom powers of 2 only to scipy-optimized numbers, applied separately to each dimension; yielding some performance gains and avoiding potential large memory impact for certain multi-dimensional inputs. [#11533]
astropy.coordinates
➕ Adds the ability to create topocentric
CIRSframes. Using these,AltAzcalculations are now accurate down to the milli-arcsecond level. [#10994]➕ Adds a direct transformation from
ICRStoAltAzframes. This provides a modest speedup of approximately 10 percent. [#11079]➕ Adds new
WGS84GeodeticRepresentation,WGS72GeodeticRepresentation, andGRS80GeodeticRepresentation. These are mostly for use insideEarthLocationbut can also be used to convert between geocentric (cartesian) and different geodetic representations directly. [#11086]SkyCoord.guess_from_tablenow also searches for differentials in the table. In addition, multiple regex matches can be resolved when they are exact component names, e.g. having both columns “dec” and “pm_dec” no longer errors and will be included in the SkyCoord. [#11417]All representations now have a
transformmethod, which allows them to be transformed by a 3x3 matrix in a Cartesian basis. By default, transformations are routed throughCartesianRepresentation.SphericalRepresentationandPhysicssphericalRepresentationoverride this for speed and to prevent NaN leakage from the distance to the angular components. Also, the functionsis_O3andis_rotationhave been added tomatrix_utitiesfor checking whether a matrix is in the O(3) group or is a rotation (proper or improper), respectively. [#11444]🚚 Moved angle formatting and parsing utilities to
astropy.coordinates.angle_formats. Added new functionality toastropy.coordinates.angle_utilitiesfor generating points on or in spherical surfaces, either randomly or on a grid. [#11628]Added a new method to
SkyCoord,spherical_offsets_by(), which is the conceptual inverse ofspherical_offsets_to(): Given angular offsets in longitude and latitude, this method returns a new coordinate with the offsets applied. [#11635]🔨 Refactor conversions between
GCRSandCIRS,TETEfor better accuracy and substantially improved speed. [#11069]🐎 Also refactor
EarthLocation.get_gcrsfor an increase in performance of an order of magnitude, which enters as well in getting observed positions of planets usingget_body. [#11073]🔨 Refactored the usage of metaclasses in
astropy.coordinatesto instead use__init_subclass__where possible. [#11090]Removed duplicate calls to
transform_tofrommatch_to_catalog_skyandmatch_to_catalog_3d, improving their performance. [#11449]The new DE440 and DE440s ephemerides are now available via shortcuts 'de440' and 'de440s'. The DE 440s ephemeris will probably become the default ephemeris when chosing 'jpl' in 5.0. [#11601]
astropy.cosmology
- Cosmology parameter dictionaries now also specify the Cosmology class to which
the parameters correspond. For example, the dictionary for
astropy.cosmology.parameters.Planck18has the added key-value pair ("cosmology", "FlatLambdaCDM"). [#11530]
astropy.io.ascii ^
➕ Added support for reading and writing ASCII tables in QDP (Quick and Dandy Plotter) format. [#11256]
➕ Added support for reading and writing multidimensional column data (masked and unmasked) to ECSV. Also added formal support for reading and writing object-type column data which can contain items consisting of lists, dicts, and basic scalar types. This can be used to store columns of variable-length arrays. Both of these features use JSON to convert the object to a string that is stored in the ECSV output. [#11569, #11662, #11720]
astropy.io.fits ^
➕ Added
appendkeyword to append table objects to an existing FITS file [#2632, #11149]Check that the SIMPLE card is present when opening a file, to ensure that the file is a valid FITS file and raise a better error when opening a non FITS one.
ignore_missing_simplecan be used to skip this verification. [#10895]🔦 Expose
Header.stripas a public method, to remove the most common structural keywords. [#11174]Enable the use of
os.PathLikeobjects when dealing with (mainly FITS) files. [#11580]
astropy.io.registry
- Readers and writers can now set a priority, to assist with resolving which format to use. [#11214]
astropy.io.votable
🔖 Version 1.4 VOTables now use the VOUnit format specification. [#11032]
When reading VOTables using the Unified File Read/Write Interface (i.e. using the
Table.read()orQTable.read()functions) it is now possible to specify all keyword arguments that are valid forastropy.io.votable.table.parse(). [#11643]
astropy.modeling ^
➕ Added a state attribute to models to allow preventing the synching of constraint values from the constituent models. This synching can greatly slow down fitting if there are large numbers of fit parameters. model.sync_constraints = True means check constituent model constraints for compound models every time the constraint is accessed, False, do not. Fitters that support constraints will set this to False on the model copy and then set back to True when the fit is complete before returning. [#11365]
The
convolve_models_fftfunction implements model convolution so that one insures that the convolution remains consistent across multiple different inputs. [#11456]
astropy.nddata ^
Prevent unnecessary copies of the data during
NDDataarithmetic when units need to be added. [#11107]NDData str representations now show units, if present. [#11553]
astropy.stats ^
➕ Added the ability to specify stdfunc='mad_std' when doing sigma clipping, which will use a built-in function and lead to significant performance improvements if cenfunc is 'mean' or 'median'. [#11664]
🐎 Significantly improved the performance of sigma clipping when cenfunc and stdfunc are passed as strings and the
growoption is not used. [#11219]👌 Improved performance of
bayesian_blocks()by removing onenp.log()call [#11356]
astropy.table ^
➕ Add table attributes to include or exclude columns from the output when printing a table. This functionality includes a context manager to include/exclude columns temporarily. [#11190]
👌 Improved the string representation of objects related to
Table.indicesso they now indicate the object type and relevant attributes. [#11333]
astropy.timeseries
- 👻 An exception is raised when
n_binsis passed as an argument while any of the parameterstime_bin_startortime_bin_sizeis not scalar. [#11463]
astropy.units ^
The
physical_typeattributes of each unit are now objects of the (new)astropy.units.physical.PhysicalTypeclass instead of strings and the functionastropy.units.physical.get_physical_typecan now translate strings to these objects. [#11204]The function
astropy.units.physical.def_physical_typewas created to either define entirely new physical types, or to add more physical type names to an existing physical types. [#11204]PhysicalType's can be operated on using operations multiplication, division, and exponentiation are to facilitate dimensional analysis. [#11204]It is now possible to define aliases for units using
astropy.units.set_enabled_aliases. This can be used when reading files that have misspelled units. [#11258]➕ Add a new "DN" unit,
units.dnorunits.DN, representing data number for a detector. [#11591]
astropy.utils ^
Added
ssl_contextandallow_insecureoptions todownload_file, as well as the ability to optionally use thecertifipackage to provide root CA certificates when downloading from sites secured with TLS/SSL. [#10434]astropy.utils.data.get_pkg_data_pathis publicly scoped (previously the private function_find_pkg_data_path) for obtaining file paths without checking if the file/directory exists, as long as the package and module do. [#11006]🗄 Deprecated
astropy.utils.OrderedDescriptorandastropy.utils.OrderedDescriptorContainer, as new features in Python 3 make their use less compelling. [#11094, #11099]astropy.utils.maskedprovides a newMaskedclass/factory that can be used to represent maskedndarrayand all its subclasses, includingQuantityand its subclasses. These classes can be used inside coordinates, but the mask is not yet exposed. Generally, the interface should be considered experimental. [#11127, #11792]➕ Add new
utils.parsingmodule to with helper wrappers aroundply. [#11227]🔄 Change the Time and IERS leap second handling so that the leap second table is updated only when a Time transform involving UTC is performed. Previously this update check was done the first time a
Timeobject was created, which in practice occured when importing common astropy subpackages likeastropy.coordinates. Now you can prevent querying internet resources (for instance on a cluster) by settingiers.conf.auto_download = False. This can be done after importing astropy but prior to performing anyTimescale transformations related to UTC. [#11638]➕ Added a new module at
astropy.utils.compat.optional_depsto consolidate the definition ofHAS_xoptional dependency flag variables, likeHAS_SCIPY. [#11490]
astropy.wcs ^
➕ Add IVOA UCD mappings for some FITS WCS keywords commonly used in solar physics. [#10965]
➕ Add
STOKESFITS WCS keyword to the IVOA UCD mapping. [#11236]⚡️ Updated bundled version of WCSLIB to version 7.6. See https://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES for a list of included changes. [#11549]
API Changes
astropy.coordinates
For input to representations, subclasses of the class required for a given attribute will now be allowed in. [#11113]
Except for
UnitSphericalRepresentation, shortcuts in representations now allow for attached differentials. [#11467]👍 Allow coordinate name strings as input to
SkyCoord.is_transformable_to. [#11552]
astropy.cosmology
Change
z_at_valueto usescipy.optimize.minimize_scalarwith default methodBrent(other optionsBoundedandGolden) and acceptbracketoption to set initial search region. [#11080]Clarified definition of inputs to
angular_diameter_distance_z1z2. The function now emitsAstropyUserWarningwhenz2is less thanz1. [#11197]Split cosmology realizations from core classes, moving the former to new file
realizations. [#11345]Since cosmologies are immutable, the initialization signature and values can be stored, greatly simplifying cloning logic and extending it to user-defined cosmology classes that do not have attributes with the same name as each initialization argument. [#11515]
Cloning a cosmology with changed parameter(s) now appends "(modified)" to the new instance's name, unless a name is explicitly passed to
clone. [#11536]👍 Allow
m_nuto be input as any quantity-like or array-like -- Quantity, array, float, str, etc. Input is passed to the Quantity constructor and converted to eV, still with the prior mass-energy equivalence enabled. [#11640]
astropy.io.fits ^
- For conversion between FITS tables and astropy
Table, the standard mask values ofNaNfor float and null string for string are now properly recognized, leading to aMaskedColumnwith appropriately set mask instead of aColumnwith those values exposed. Conversely, when writing an astropyTableto a FITS tables, masked values are now consistently converted to the standard FITS mask values ofNaNfor float and null string for string (i.e., not just for tables withmasked=True, which no longer is guaranteed to signal the presence ofMaskedColumn). [#11222]
astropy.io.votable
- 🗄 The use of
version='1.0'is now fully deprecated in constructing aastropy.io.votable.tree.VOTableFile. [#11659]
astropy.modeling ^
- ✂ Removed deprecated
astropy.modeling.blackbodymodule. [#10972]
astropy.table ^
➕ Added
Column.valueas an alias for the existingColumn.dataattribute. This makes accessing a column's underlying data array consistent with the.valueattribute available forTimeandQuantityobjects. [#10962]In reading from a FITS tables, the standard mask values of
NaNfor float and null string for string are properly recognized, leading to aMaskedColumnwith appropriately set mask. [#11222]🔄 Changed the implementation of the
table.index.Indexclass so instantiating from this class now returns anIndexobject as expected instead of aSlicedIndexobject. [#11333]
astropy.units ^
The
physical_typeattribute of units now returns an instance ofastropy.units.physical.PhysicalTypeinstead of a string. BecausePhysicalTypeinstances can be compared to strings, no code changes should be necessary when making comparisons. The string representations of different physical types will differ from previous releases. [#11204]Calling
Unit()with no argument now returns a dimensionless unit, as was documented but not implemented. [#11295]
astropy.utils ^
✂ Removed deprecated
utils.misc.InheritDocstringsandutils.timer. [#10281]✂ Removed usage of deprecated
ipythonstream inutils.console. [#10942]
astropy.wcs ^
- 🗄 Deprecate
accuracyargument inall_world2pixwhich was mistakenly documented, in the caseaccuracywas ever used. [#11055]
🐛 Bug Fixes
astropy.convolution
- 🛠 Fixes for
convolve_fftdocumentation examples. [#11510]
astropy.coordinates
👍 Allow
Distanceinstances with negative distance values as input forSphericalRepresentation. This was always noted as allowed in an exception message when a negativeQuantitywith length units was passed in, but was not actually possible to do. [#11113]👉 Makes the
Angle.to_stringmethod to follow the format described in the docstring with up to 8 significant decimals instead of 4. [#11153]Ensure that proper motions can be calculated when converting a
SkyCoordwith cartesian representation to unit-spherical, by fixing the conversion ofCartesianDifferentialtoUnitSphericalDifferential. [#11469]When re-representing coordinates from spherical to unit-spherical and vice versa, the type of differential will now be preserved. For instance, if only a radial velocity was present, that will remain the case (previously, a zero proper motion component was added). [#11482]
⚠ Ensure that wrapping of
Angledoes not raise a warning even ifnanare present. Also try to make sure that the result is within the wrapped range even in the presence of rounding errors. [#11568]Comparing a non-SkyCoord object to a
SkyCoordusing==no longer raises an error. [#11666]Different
SkyOffsetFrameclasses no longer interfere with each other, causing difficult to debug problems with theoriginattribute. Theoriginattribute now no longer is propagated, so while it remains available on aSkyCoordthat is an offset, it no longer is available once that coordinate is transformed to another frame. [#11730] [#11730]
astropy.cosmology
- Cosmology instance names are now immutable. [#11535]
astropy.io.ascii ^
🛠 Fixed bug where writing a table that has comments defined (via
tbl.meta['comments']) with the 'csv' format was failing. Since the formally defined CSV format does not support comments, the comments are now just ignored unlesscomment=<comment prefix>is supplied to thewrite()call. [#11475]🛠 Fixed the issue where the CDS reader failed to treat columns as nullable if the ReadMe file contains a limits specifier. [#11531]
Made sure that the CDS reader does not ignore an order specifier that may be present after the null specifier '?'. Also made sure that it checks null values only when an '=' symbol is present and reads description text even if there is no whitespace after '?'. [#11593]
astropy.io.fits ^
Fix
ColDefs.add_col/del_colto allow in-place addition or removal of a column. [#11338]🛠 Fix indexing of
fits.Headerwith Numpy integers. [#11387]0️⃣ Do not delete
EXTNAMEfor compressed image header if a default and non-defaultEXTNAMEare present. [#11396]⚠ Prevent warnings about
HIERARCHwithCompImageHeaderclass. [#11404]🛠 Fixed regression introduced in Astropy 4.0.5 and 4.2.1 with verification of FITS headers with HISTORY or COMMENT cards with long (> 72 characters) values. [#11487]
🛠 Fix reading variable-length arrays when there is a gap between the data and the heap. [#11688]
astropy.io.votable
NumericArrayconverter now properly broadcasts scalar mask to array. [#11157]VOTables are now written with the correct namespace and schema location attributes. [#11659]
astropy.modeling ^
🛠 Fixes the improper propagation of
bounding_boxfromastropy.modeling.modelsto their inverses. For cases in which the inversesbounding_boxcan be determined, the proper calculation has been implemented. [#11414]🛠 Bugfix to allow rotation models to accept arbitrarily-shaped inputs. [#11435]
🛠 Bugfixes for
astropy.modelingto allowfix_inputsto accept empty dictionaries and dictionaries withnumpyinteger keys. [#11443]🛠 Bugfix for how
SPECIAL_OPERATORSare handled. [#11512]🛠 Fixes
Modelcrashes when some inputs are scalars and during some types of output reshaping. [#11548]🛠 Fixed bug in
LevMarLSQFitterwhen using weights and vector inputs. [#11603]
astropy.stats ^
- 🛠 Fixed a bug with the
copy=Falseoption when carrying out sigma clipping - previously ifmasked=Falsethis still copied the data, but this will now change the array in-place. [#11219]
astropy.table ^
Ensure that adding a
Quantityor other mixin column to aTabledoes not have side effects, such as creating an associatedinfoinstance (which would lead to slow-down of, e.g., slicing afterwards). [#11077]When writing to a FITS tables, masked values are again always converted to the standard FITS mask values of
NaNfor float and null string for string, not just for table withmasked=True. [#11222]Using
Table.to_pandas()on an indexedTablewith masked integer values now correctly construct thepandas.DataFrame. [#11432]🛠 Fixed
TableHTML representation in Jupyter notebooks so that it is horizontally scrollable within Visual Studio Code. This was done by wrapping the<table>in a<div>element. [#11476]🛠 Fix a bug where a string-valued
Columnthat happened to have aunitattribute could not be added to aQTable. Such columns are now simply kept asColumninstances (with a warning). [#11585]🛠 Fix an issue in
Table.to_pandas(index=<colname>)where the index column name was not being set properly for theDataFrameindex. This was introduced by an API change in pandas version 1.3.0. Previously when creating aDataFramewith the index set to an astropyColumn, theDataFrameindex name was automatically set to the column name. [#11921]
astropy.time ^
🛠 Fix a thread-safety issue with initialization of the leap-second table (which is only an issue when ERFA's built-in table is out of date). [#11234]
🛠 Fixed converting a zero-length time object from UTC to UT1 when an empty array is passed. [#11516]
astropy.uncertainty
Distributioninstances can now be used as input toQuantityto initializeQuantityDistribution. Hence,distribution * unitanddistribution << unitwill work too. [#11210]
astropy.units ^
🚚 Move non-astronomy units from astrophys.py to a new misc.py file. [#11142]
The physical type of
astropy.units.mol / astropy.units.m ** 3is now defined as molar concentration. It was previously incorrectly defined as molar volume. [#11204]👉 Make ufunc helper lookup thread-safe. [#11226]
📜 Make
Unitstring parsing (as well asAngleparsing) thread-safe. [#11227]Decorator
astropy.units.decorators.quantity_inputnow only evaluates return type annotations based onUnitBaseorFunctionUnitBasetypes. Other annotations are skipped over and are not attempted to convert to the correct type. [#11506]
astropy.utils ^
- 👉 Make
lazypropertyandclassdecoratorthread-safe. This should fix a number of thread safety issues. [#11224]
astropy.visualization
🛠 Fixed a bug that resulted in some parts of grid lines being visible when they should have been hidden. [#11380]
🛠 Fixed a bug that resulted in
time_support()failing for intervals of a few months if one of the ticks was the month December. [#11615]
astropy.wcs ^
fit_wcs_from_pointsnow produces a WCS with integerNAXIXnvalues. [#10865]⚡️ Updated bundled version of
WCSLIBto v7.4, fixing a bug that caused the coefficients of the TPD distortion function to not be written to the header. [#11260]🛠 Fixed a bug in assigning type when converting
colseltonumpy.ndarray. [#11431]➕ Added
WCSCOMPARE_*constants to the list of WCSLIB constants available/exposed through theastropy.wcsmodule. [#11647]🛠 Fix a bug that caused APE 14 WCS transformations for FITS WCS with ZOPT, BETA, VELO, VOPT, or VRAD CTYPE to not work correctly. [#11781]
Other Changes and Additions
🔧 The configuration file is no longer created by default when importing astropy and its existence is no longer required. Affiliated packages should update their
__init__.pymodule to remove the block usingupdate_default_configandConfigurationDefaultMissingWarning. [#10877]📇 Replace
pkg_resources(from setuptools) withimportlib.metadatawhich comes from the stdlib, except for Python 3.7 where the backport package is added as a new dependency. [#11091]Turn on numpydoc's
numpydoc_xref_param_typeto create cross-references for the parameter types in the Parameters, Other Parameters, Returns and Yields sections of the docstrings. [#11118]📄 Docstrings across the package are standardized to enable references. Also added is an Astropy glossary-of-terms to define standard inputs, e.g.
quantity-likeindicates an input that can be interpreted byastropy.units.Quantity. [#11118]🐧 Binary wheels are now built to the manylinux2010 specification. These wheels should be supported on all versions of pip shipped with Python 3.7+. [#11377]
0️⃣ The name of the default branch for the astropy git repository has been renamed to
main, and the documentation and tooling has been updated accordingly. If you have made a local clone you may wish to update it following the instructions in the repository's README. [#11379]Sphinx cross-reference link targets are added for every
PhysicalType. Now in the parameter types in the Parameters, Other Parameters, Returns and Yields sections of the docstring, the physical type of a quantity can be annotated in square brackets. E.g.distance : `~astropy.units.Quantity` ['length'][#11595]👍 The minimum supported version of
ipythonis now 4.2. [#10942]👍 The minimum supported version of
pyerfais now 1.7.3. [#11637]
- Change padding sizes for
-
v4.2.1 Changes
April 01, 2021🐛 Bug Fixes
astropy.cosmology
- 🛠 Fixed an issue where specializations of the comoving distance calculation for certain cosmologies could not handle redshift arrays. [#10980]
astropy.io.fits ^
- 🛠 Fix bug where manual fixes to invalid header cards were not preserved when saving a FITS file. [#11108]
astropy.io.votable
NumericArrayconverter now properly broadcasts scalar mask to array. [#11157]
astropy.table ^
- 🛠 Fix bug when initializing a
Tablesubclass that usesTableAttribute's. If the data were an instance of the table then attributes provided in the table initialization call could be ignored. [#11217]
astropy.time ^
- 🔄 Change epoch of
TimeUnixTAI("unix_tai") from1970-01-01T00:00:00 UTCto1970-01-01T00:00:00 TAIto match the intended and documented behaviour. This essentially changes the resulting times by 8.000082 seconds, the initial offset between TAI and UTC. [#11249]
astropy.units ^
- 🛠 Fixed a bug with the
quantity_inputdecorator where allowing dimensionless inputs for an argument inadvertently disabled any checking of compatible units for that argument. [#11283]
astropy.utils ^
- 🛠 Fix a bug so that
np.shape,np.ndimandnp.sizeagain work on classes that useShapedLikeNDArray, like representations, frames, sky coordinates, and times. [#11133]
astropy.wcs ^
- Fix error when a user defined
proj_pointparameter is passed tofit_wcs_from_points. [#11139]
Other Changes and Additions
- 🔄 Change epoch of
TimeUnixTAI("unix_tai") from1970-01-01T00:00:00 UTCto1970-01-01T00:00:00 TAIto match the intended and documented behaviour. This essentially changes the resulting times by 8.000082 seconds, the initial offset between TAI and UTC. [#11249]
-
v4.2 Changes
November 24, 2020🆕 New Features
astropy.convolution
- Methods
convolveandconvolve_fftboth now return Quantity arrays if user input is given in one. [#10822]
astropy.coordinates
Numpy functions that broadcast, change shape, or index (like
np.broadcast_to,np.rot90, ornp.roll) now work on coordinates, frames, and representations. [#10337]Add a new science state
astropy.coordinates.erfa_astrom.erfa_astromand two classesErfaAstrom,ErfaAstromInterpolatoras wrappers to thepyerfaastrometric functions used in the coordinate transforms. UsingErfaAstromInterpolator, which interpolates astrometric properties forSkyCoordinstances with arrays of obstime, can dramatically speed up coordinate transformations while keeping microarcsecond resolution. Depending on needed precision and the obstime array in question, speed ups reach factors of 10x to >100x. [#10647]galactocentric_frame_defaultscan now also be used as a registry, with user-defined parameter values and metadata. [#10624]Method
.realize_framefrom coordinate frames now accepts**kwargs, includingrepresentation_type. [#10727]Avoid an unnecessary call to
erfa.epv00in transformations betweenCIRSandICRS, improving performance by 50 %. [#10814]A new equatorial coordinate frame, with RA and Dec measured w.r.t to the True Equator and Equinox (TETE). This frame is commonly known as "apparent place" and is the correct frame for coordinates returned from JPL Horizons. [#10867]
Added a context manager
impose_finite_difference_dtto theTransformGraphclass to override the finite-difference time step attribute (finite_difference_dt) for all transformations in the graph with that attribute. [#10341]👌 Improve performance of
SpectralCoordby refactoring internal implementation. [#10398]
astropy.cosmology
- The final version of the Planck 2018 cosmological parameters are included
as the
Planck18object, which is now the default cosmology. The parameters are identical to those of thePlanck18_arXiv_v2object, which is now deprecated and will be removed in a future release. [#10915]
astropy.modeling ^
➕ Added NFW profile and tests to modeling package [#10505]
➕ Added missing logic for evaluate to compound models [#10002]
Stop iteration in
FittingWithOutlierRemovalbefore reachingniterif the masked points are no longer changing. [#10642]Keep a (shallow) copy of
fit_infofrom the last iteration of the wrapped fitter inFittingWithOutlierRemovaland also record the actual number of iterations performed in it. [#10642]➕ Added attributes for fitting uncertainties (covariance matrix, standard deviations) to models. Parameter covariance matrix can be accessed via
model.cov_matrix, standard deviations bymodel.stdsor individually for each parameter byparameter.std. Currently implemented forLinearLSQFitterandLevMarLSQFitter. [#10552]N-dimensional least-squares statistic and specific 1,2,3-D methods [#10670]
astropy.stats ^
- ➕ Added
circstdfunction to obtain a circular standard deviation. [#10690]
astropy.table ^
- 👍 Allow initializing a
Tableusing a list ofnamesin conjunction with adtypefrom a numpy structured array. The list ofnamesoverrides the names specified in thedtype. [#10419]
astropy.time ^
➕ Add new
isclose()method toTimeandTimeDeltaclasses to allow comparison of time objects to within a specified tolerance. [#10646]👌 Improve initialization time by a factor of four when creating a scalar
Timeobject in a format likeunixorcxcsec(time delta from a reference epoch time). [#10406]👌 Improve initialization time by a factor of ~25 or more for large arrays of string times in ISO, ISOT or year day-of-year formats. This is done with a new C-based time parser that can be adapted for other fixed-format custom time formats. [#10360]
Numpy functions that broadcast, change shape, or index (like
np.broadcast_to,np.rot90, ornp.roll) now work on times. [#10337, #10502]
astropy.timeseries
- 👌 Improve memory and speed performance when iterating over the entire time
column of a
TimeSeriesobject. Previously this involved O(N2) operations and memory. [#10889]
astropy.units ^
Quantity.tohas gained acopyoption to allow copies to be avoided when the units do not change. [#10517]➕ Added the
spatunit of solid angle that represents the full sphere. [#10726]
astropy.utils ^
ShapedLikeNDArrayhas gained the capability to use numpy functions that broadcast, change shape, or index. [#10337]🆓
get_free_space_in_dirnow takes a newunitkeyword andcheck_free_space_in_dirtakessizedefined asQuantity. [#10627]🆕 New
astropy.utils.data.conf.allow_internetconfiguration item to control downloading data from the Internet. Settingallow_internet=Falseis the same asremote_timeout=0. Usingremote_timeout=0to control internet access will stop working in a future release. [#10632]🆕 New
is_urlfunction so downstream packages do not have to secretly use the hidden_is_urlanymore. [#10684]
astropy.visualization
➕ Added the
Quadranglepatch forWCSAxesfor a latitude-longitude quadrangle. Unlikematplotlib.patches.Rectangle, the edges of this patch will be rendered as curved lines if appropriate for the WCS transformation. [#10862]The position of tick labels are now only calculated when needed. If any text parameters are changed (color, font weight, size etc.) that don't effect the tick label position, the positions are not recomputed, improving performance. [#10806]
astropy.wcs ^
WCS.to_header()now appends comments to SIP coefficients. [#10480]A new property
dropped_world_dimensionshas been added toSlicedLowLevelWCSto record information about any world axes removed by slicing a WCS. [#10195]New
WCS.proj_plane_pixel_scales()andWCS.proj_plane_pixel_area()methods to return pixel scales and area, respectively, as Quantity. [#10872]
API Changes
astropy.config ^
set_temp_confignow preserves the existing cache rather than deleting it and relying on reloading it from the previous config file. This ensures that any programmatically made changes are preserved as well. [#10474]🔧 Configuration path detection logic has changed: Now, it looks for
~first before falling back to older logic. In addition,HOMESHAREis no longer used in Windows. [#10705]
astropy.coordinates
- The passing of frame classes (as opposed to frame instances) to the
transform_to()methods of low-level coordinate-frame classes has been deprecated. Frame classes can still be passed to thetransform_to()method of the high-levelSkyCoordclass, and usingSkyCoordis recommended for all typical use cases of transforming coordinates. [#10475]
astropy.stats ^
➕ Added a
growparameter toSigmaClip,sigma_clipandsigma_clipped_stats, to allow expanding the masking of each deviant value to its neighbours within a specified radius. [#10613]Passing float
ntopoisson_conf_intervalwhen usinginterval='kraft-burrows-nousek'now raisesTypeErroras its value must be an integer. [#10838]
astropy.table ^
🔄 Change
Table.columns.keys()andTable.columns.values()to both return generators instead of a list. This matches the behavior for Pythondictobjects. [#10543]✂ Removed the
FastBSTandFastRBTindexing engines because they depend on thebintreespackage, which is no longer maintained and is deprecated. Instead, use theSCEngineindexing engine, which is similar in performance and relies on thesortedcontainerspackage. [#10622]When slicing a mixin column in a table that had indices, the indices are no longer copied since they generally are not useful, having the wrong shape. With this, the behaviour becomes the same as that for a regular
Column. (Note that this does not affect slicing of a table; sliced columns in those will continue to carry a sliced version of any indices). [#10890]🔄 Change behavior so that when getting a single item out of a mixin column such as
Time,TimeDelta,SkyCoordorQuantity, theinfoattribute is no longer copied. This improves performance, especially when the object is an indexed column in aTable. [#10889]Raise a TypeError when a scalar column is added to an unsized table. [#10476]
The order of columns when creating a table from a
listofdictmay be changed. Previously, the order was alphabetical because thedictkeys were assumed to be in random order. Since Python 3.7, the keys are always in order of insertion, soTablenow uses the order of keys in the first row to set the column order. To alphabetize the columns to match the previous behavior, uset = t[sorted(t.colnames)]. [#10900]
astropy.time ^
- 🔨 Refactor
TimeandTimeDeltaclasses to inherit from a commonTimeBaseclass. TheTimeDeltaclass no longer inherits fromTime. A number of methods that only apply toTime(e.g.light_travel_time) are no longer available in theTimeDeltaclass. [#10656]
astropy.units ^
- The
barunit is no longer wrongly considered an SI unit, meaning that SI decompositions like(u.kg*u.s**-2* u.sr**-1 * u.nm**-1).siwill no longer include it. [#10586]
astropy.utils ^
Shape-related items from
astropy.utils.misc--ShapedLikeNDArray,check_broadcast,unbroadcast, andIncompatibleShapeError-- have been moved to their own module,astropy.utils.shapes. They remain importable fromastropy.utils. [#10337]check_hasheskeyword incheck_download_cacheis deprecated and will be removed in a future release. [#10628]hexdigestkeyword inimport_file_to_cacheis deprecated and will be removed in a future release. [#10628]
🐛 Bug Fixes
astropy.config ^
- 🛠 Fix a few issues with
generate_configwhen used with other packages. [#10893]
astropy.coordinates
- 🛠 Fixed a bug in the coordinate-frame attribute
CoordinateAttributewhere the internal transformation could behave differently depending on whether the input was a low-level coordinate frame or a high-levelSkyCoord.CoordinateAttributenow always performs aSkyCoord-style internal transformation, including the by-default merging of frame attributes. [#10475]
astropy.modeling ^
- 🛠 Fixed an issue of
Model.renderwhen the inputoutdatatype is not float64. [#10542]
astropy.visualization
- 🛠 Fix support for referencing WCSAxes coordinates by their world axes names. [#10484]
astropy.wcs ^
- Objective functions called by
astropy.wcs.fit_wcs_from_pointswere treating longitude and latitude distances equally. Now longitude scaled properly. [#10759]
Other Changes and Additions
Minimum version of required Python is now 3.7. [#10900]
Minimum version of required Numpy is now 1.17. [#10664]
Minimum version of required Scipy is now 1.1. [#10900]
Minimum version of required PyYAML is now 3.13. [#10900]
Minimum version of required Matplotlib is now 3.0. [#10900]
📦 The private
_erfamodule has been converted to its own package,pyerfa, which is a required dependency for astropy, and can be imported withimport erfa. Importing_erfafromastropywill give a deprecation warning. [#10329]➕ Added
optimize=Trueflag to calls ofyacc.yacc(as already done forlex.lex) to allow running inpython -OOsession without raising an exception inastropy.units.format. [#10379]Shortened FITS comment strings for some D2IM and CPDIS FITS keywords to reduce the number of FITS
VerifyWarningwarnings when working with WCSes containing lookup table distortions. [#10513]🏗 When importing astropy without first building the extension modules first, raise an error directly instead of trying to auto-build. [#10883]
- Methods