NASA-Planetary-Science / sbpy

A Python package for small bodies research
https://sbpy.org/
Other
66 stars 34 forks source link

Enable combining `DataClass` objects #367

Closed jianyangli closed 1 year ago

jianyangli commented 1 year ago

This PR responds to issue #203 to provide a mechanism to combine DataClass objects. New methods implemented include:

These methods allow for the same flexibilities provided by other DataClass methods, such as column name alias, expanding table with a new DataClass or astropy.table.Table object, new row, or new column with different shapes from the original table.

The implementation tries to make use of the existing functionalities from astropy.table.Table and DataClass as much as possible. join function uses astropy.table.vstack. add_row uses DataClass.from_rows and join. add_column uses DataClass.apply.

codecov[bot] commented 1 year ago

Codecov Report

Merging #367 (74d8edc) into main (462f453) will increase coverage by 0.35%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #367      +/-   ##
==========================================
+ Coverage   75.65%   76.01%   +0.35%     
==========================================
  Files          78       78              
  Lines        6795     6895     +100     
==========================================
+ Hits         5141     5241     +100     
  Misses       1654     1654              
Impacted Files Coverage Δ
sbpy/data/core.py 100.00% <100.00%> (ø)
sbpy/data/tests/test_dataclass.py 98.84% <100.00%> (+0.30%) :arrow_up:
jianyangli commented 1 year ago

@mkelley OK this one is ready for review, too. Thanks.

mkelley commented 1 year ago

That failing test is something that should be marked as a remote test, and I'll have a fix in #374

jianyangli commented 1 year ago

OK, should I go ahead with merge, or wait for the fix first?

mkelley commented 1 year ago

Go ahead.