Skip to content

Fixes issue #3552: Mention Table interface in "Creating a New Table File" in FITS docs - #3558

Closed
vinayak-mehta wants to merge 3 commits into
astropy:masterfrom
vinayak-mehta:table_interface
Closed

vinayak-mehta wants to merge 3 commits into
astropy:masterfrom
vinayak-mehta:table_interface

Conversation

@vinayak-mehta

Copy link
Copy Markdown
Contributor

@embray

embray commented Mar 2, 2015

Copy link
Copy Markdown
Member

Thanks, this seems like a good start. Though I would probably write this differently, ultimately. I would want to move it closer to the top of the section and go through a more complete example (also with links to the Table docs). Perhaps showing how to create the same table using both the Table interface, and the old lower-level PyFITS interface, and also an explanation as to why the former should be preferred in most cases.

@vinayak-mehta

Copy link
Copy Markdown
Contributor Author

@embray - Please point out the mistakes and help me refine it.

@embray

embray commented Mar 3, 2015

Copy link
Copy Markdown
Member

@vortex-ape Thanks, this is looking good. I don't think there's much in the way of "mistakes" though I have a few other comments. I'll get back to it in a bit. But this is definitely on the right track for what I'm looking for.

@embray

embray commented May 18, 2015

Copy link
Copy Markdown
Member

Thanks again for this, but I'm probably going to finish up this update to the docs myself, though I will include your example and make sure you're credited. I just want to go a little more in-depth, and actually refactor the docs altogether to emphasize this, and other simpler options for creating table HDUs. This is perfectly good work, but it's only a start.

@hamogu

hamogu commented Mar 16, 2017

Copy link
Copy Markdown
Member

current fits maintaienrs @embray @MSeifert04 @pllim : I'm just looking through old, open PRs. Is there any reason this has not been merged yet? Yes, somebody could rework the docs more fully but that has not happened for the last two years, so I suggest merging this as is.
(The Travis failure seems unrelated, but in any case, somebody with the right priviliges should restart Travis, since that run was about 2 years ago.)

@pllim pllim 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.

The PR is so old that simply restarted the failed test wouldn't work. It needs to be rebased (despite no merge conflict).

Would also be nice to post a screenshot of rendered HTML of this change.

@vinayak-mehta , sorry for the long delay. Erik is no longer involved and I wasn't signed up as a "deputy" then. If you cannot follow-up on this, just let me know and I'll take over. Since this PR existed before "allow edits from maintainers" was introduced, I will need to take over via a new PR but credit you for your original commits.

Comment thread docs/io/fits/index.rst
.. note::

If you want to create a simple binary FITS table with no other HDUs,
you should use the Table_ interface in Astropy instead and then

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.

It is simpler to just do

:class:`~astropy.table.Table`

This way, "stable" will properly link to the API in "stable", "latest" to "latest", and so on.

Comment thread docs/io/fits/index.rst
write to FITS.

>>> from astropy.table import Table
>>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))

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.

Wouldn't hurt to follow PEP8 here and add spaces after commas.

Comment thread docs/io/fits/index.rst

When using "lower-level" FITS interface, it is not usually necessary to
create column object explicitly as long as the data is stored in a
`structured array <http://docs.scipy.org/doc/numpy/user/basics.rec.html>`_.

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.

https now.

Comment thread docs/io/fits/index.rst

- Code complexity is decreased.

.. _Table: http://astropy.readthedocs.org/en/latest/api/astropy.table.Table.html#astropy.table.Table

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.

This can be removed as per my suggestion above.

Comment thread docs/io/fits/index.rst

Benefits:

- Code complexity is decreased.

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.

Is it really necessary to make a bulleted list out of a single item like this?

Comment thread docs/io/fits/index.rst
>>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))
>>> t.write('table.fits', format='fits')

Same code in PyFITS would look like this:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PyFITS? 😄

@pllim pllim Mar 16, 2017 •

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.

Now that you mention it, PyFITS's move to astropy.io.fits is so long ago now that we can probably replace PyFITS reference with astropy.io.fits. 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no "probably" about it. Please change it to astropy.io.fits. PyFITS has been deprecated for 3 years now (early 2014).

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.

And I vaguely remember previous PRs that got rid of similar mentions of pyfits both in code and docs.

Comment thread docs/io/fits/index.rst
>>> t = pyfits.BinTableHDU.from_columns([
... pyfits.Column(name='a', array=c1),
... pyfits.Column(name='b', array=c2),
... pyfits.Column(name='c', array=c3)])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't work, a format is required, something like fits.Column(name='a', array=[1,2], format='K').

@pllim

pllim commented Mar 17, 2017

Copy link
Copy Markdown
Member

@SaraOgaz , are you going to Katniss this one too? Or should I take over? 😂

@SaOgaz

SaOgaz commented Mar 17, 2017

Copy link
Copy Markdown
Contributor

@pllim depends on how early you want it, heh. Do we know that @vinayak-mehta won't get to it? Are they still around?

@pllim

pllim commented Mar 17, 2017

Copy link
Copy Markdown
Member

I think code freeze for v2 is May-ish, so we have some time yet.

@pllim

pllim commented Mar 17, 2017

Copy link
Copy Markdown
Member

But if you want people to know about this in latest doc, then ASAP would be nice. Not sure if @vinayak-mehta is still interested. This PR is 2 years old. He might have moved on to something else.

@SaOgaz

SaOgaz commented Mar 17, 2017

Copy link
Copy Markdown
Contributor

In that case, sure. I'll try and get to that today. Might need some guidance to make sure @vinayak-mehta still get's the credit.

@bsipocz

bsipocz commented Mar 17, 2017

Copy link
Copy Markdown
Member

@pllim @SaraOgaz - I always feel weird about these history hacks and credit amendments. What about cherry picking the original commit from here on top of the current master, and do the fixes in a separate commits? That case the first commit will be credited to @vinayak-mehta and will have the original date, too without any hacking involved. Any additional fix will be credited to the person taking up the stab and finishing the issue.

@pllim

pllim commented Mar 17, 2017 •

Copy link
Copy Markdown
Member

@bsipocz , I never done that before but I like the suggestion. What are the incantations involved? Thanks!

@saimn

saimn commented Mar 17, 2017

Copy link
Copy Markdown
Contributor

You can get a branch from this PR and continue to work on it (possibly squashing the commits in one):

git fetch upstream pull/3558/head:pr-3558
git checkout pr-3558

@bsipocz

bsipocz commented Mar 17, 2017 •

Copy link
Copy Markdown
Member

@pllim - The other option, start with a new branch on top of the current master, and pick the 3 commits from here.
git cherry-pick 39bc597edf80d25b77578c8b079b2c55d739d9e3 20b3dc05152b333650b67643a5f8d08f82a53582 335c72ccaae180b661b7cc5c34370c2e0755a72e

I agree with @saimn, that it would be then best to squash them together.

@bsipocz

bsipocz commented Mar 17, 2017

Copy link
Copy Markdown
Member

hmm, in my solution you may need to add the fork of @vinayak-mehta as a remote to be able to see these commits (I usually have the forks of many people as remotes, so haven't tried this without it).

@pllim

pllim commented Mar 21, 2017

Copy link
Copy Markdown
Member

I took over and moved it to #5893 . This will close when that one is merged. FYI.

@pllim pllim closed this in #5893 Mar 22, 2017
@hamogu

hamogu commented Mar 22, 2017

Copy link
Copy Markdown
Member

Thanks to everybody who contributed work on this PR and the discussion!

You might hear from me again: I've decided to comb through all open PRs to find those that are still open while "almost but not quite finished". Some are really good ideas, but the longer we wait, the more extra work somebody has to put in to finish them (rebase etc.). So, I'll try to call out those that seem easy to finish (or do it myself if I know enough about the relevant sub-package). Also, the number of open PRs can be intimidating to newcomers.

@vinayak-mehta

Copy link
Copy Markdown
Contributor Author

Sorry for not being able to address this, saw it just today.

@pllim

pllim commented Mar 23, 2017

Copy link
Copy Markdown
Member

@vinayak-mehta , no worries!

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.

9 participants