Skip to content

Support fixed width ASCII table with header rows for dtype, unit, format, description - #13734

Merged
hamogu merged 6 commits into
astropy:mainfrom
taldcroft:ascii-fixed-width-extra-header-rows
Sep 23, 2022
Merged

hamogu merged 6 commits into
astropy:mainfrom
taldcroft:ascii-fixed-width-extra-header-rows

Conversation

@taldcroft

@taldcroft taldcroft commented Sep 22, 2022 •

Copy link
Copy Markdown
Member

Description

This pull request adds the ability to read and write a fixed width ASCII table that includes additional header rows specifying any or all of the column dtype, unit, format, and description. This is available in the fixed_width and fixed_width_two_line formats via the new header_rows keyword argument.

Fixes #386

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see "When to rebase and squash commits".
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the Extra CI label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the no-changelog-entry-needed label. If this is a manual backport, use the skip-changelog-checks label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • Is a milestone set? Milestone must be set but astropy-bot check might be missing; do not let the green checkmark fool you.
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate backport-X.Y.x label(s) before merge.

@taldcroft
taldcroft requested a review from hamogu September 22, 2022 10:26
@taldcroft

Copy link
Copy Markdown
Member Author

@astrofrog - 8 years later and now practicality beats purity - #2869 is now revived in a more general form.

@hamogu hamogu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm amazed every time how little code change is required to add functionality like this. Long live asciitable!

Comment thread docs/io/ascii/fixed_width_gallery.rst Resolved
EXAMPLE START
Custom Header Rows with Fixed Width Two Line

The same idea can be used with the ``fixed_width_two_line`` format::

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The same idea can be used with the ``fixed_width_two_line`` format::
The same idea can be used with the ``fixed_width_two_line`` format. While more than two lines
in the header are expected when using the ``"header_rows"`` keyword, this format has its name from the fact
that the last line in the header (which is line two if no ``"header_rows"`` are given) marks the width of each column::

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to suggest an explanation of what "two_line" means in this context, because it's not too lines. Maybe my text suggestion is not the best, but I think something along those lines should go in there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hamogu
hamogu merged commit 0404022 into astropy:main Sep 23, 2022
@taldcroft
taldcroft deleted the ascii-fixed-width-extra-header-rows branch December 16, 2022 09:37
davidgegiya added a commit to davidgegiya/agent-orchestrator that referenced this pull request Nov 8, 2026
… width tables

Pin 9fd247339e51441460b43368d415fced327c97a2 and its regression selectors for reproducible runs.

Source: astropy/astropy#13734
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to input/output column units for fixed width tables

2 participants