Skip to content

Commit

Permalink
Merge pull request #368 from esheldon/unsort
Browse files Browse the repository at this point in the history
Return table data in order requested by user
  • Loading branch information
esheldon authored May 26, 2023
2 parents 9df0df1 + f494b8f commit 54cc73d
Show file tree
Hide file tree
Showing 5 changed files with 377 additions and 278 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ version 1.1.9

Changes

- Row subsets of table data are returned in the order sent by the user
rather than sorted and unique. E.g. rows = [2, 2, 1] will return
data corresponding to that order of rows, including duplicates.
- Removed deprecated `pkg_resources` from tests (M. Becker).
- converted tests to use pytest
- Improved doc strings (N. Tessore)
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ fitsio.write(filename, data)

fitsio.write(filename, image)

# NOTE when reading row subsets, the data must still be read from disk.
# This is most efficient if the data are read in the order they appear in
# the file. For this reason, the rows are always returned in row-sorted
# order.

#
# the FITS class gives the you the ability to explore the data, and gives
# more control
Expand Down Expand Up @@ -178,10 +173,14 @@ data = fits[1]['x'][:]
# each column
data = fits[1]['x','y'][:]

# General column and row subsets. As noted above, the data are returned
# in row sorted order for efficiency reasons.
# General column and row subsets.
columns=['index','x','y']
rows=[1,5]
rows = [1, 5]
data = fits[1][columns][rows]

# data are returned in the order requested by the user
# and duplicates are preserved
rows = [2, 2, 5]
data = fits[1][columns][rows]

# iterate over rows in a table hdu
Expand Down
Loading

0 comments on commit 54cc73d

Please sign in to comment.