Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timescale from FITS format time strings #7870

Merged
merged 6 commits into from
Oct 27, 2018

Conversation

timj
Copy link
Contributor

@timj timj commented Oct 9, 2018

As discussed in #7781 and #5329.

It might be better to retain the parsing support for timescale but no longer include the timescale when converting to a string.

@astropy-bot
Copy link

astropy-bot bot commented Oct 9, 2018

Hi there @timj 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here.

@saimn
Copy link
Contributor

saimn commented Oct 17, 2018

This concerns mostly astropy.time so I will leave it to @mhvk 😉

@saimn saimn requested review from mhvk and removed request for saimn October 17, 2018 21:40
@saimn saimn added the time label Oct 17, 2018
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I think it would be preferable to avoid hard crashes in cases where the scale was included in the brackets. Could you make it so that parsing e.g:

t = Time('2010-01-01T00:00:34.000(TAI)', format='fits')

still works but emits a DeprecationWarning? You can even just ignore the content of the brackets rather than parsing it, but just at least explicitly saying that this part is ignored, so that things don't crash and the user has some feedback.

Then t.fits would of course return the value without the scale.

If you can fix this up, I think it would be great to include this in v3.1 to minimize the number of files with issues.


ISOT with two extensions:
ISOT with one extension:
- Can give signed five-digit year (mostly for negative years);
Copy link
Member

Choose a reason for hiding this comment

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

This now reads strangely with only one bullet point - can you just make it a sentence instead?

@Cadair
Copy link
Member

Cadair commented Oct 25, 2018

👍 To keeping the parsing working with a deprecation warning.

@timj
Copy link
Contributor Author

timj commented Oct 25, 2018

Ok. I'll have another stab over the weekend.

@astrofrog
Copy link
Member

@timj - thanks! Just so you know, the feature freeze for v3.1 is at the end of tomorrow, so if there's any way at all you could wrap this up by then, we could be sure to include it in v3.1. There may be a small chance of getting it in over the weekend depending on when exactly the branching of v3.1.x happens though, in case you can't finish it by tomorrow evening.

@Cadair
Copy link
Member

Cadair commented Oct 26, 2018

Personally, I would classify this as "breaking bug fix" 😛

@timj timj force-pushed the u/timj/fits-time branch 2 times, most recently from 5d2202f to 5c255b6 Compare October 26, 2018 16:50
@timj
Copy link
Contributor Author

timj commented Oct 26, 2018

I've updated the PR so that it now understands the old style (and will parse it) but issues a deprecation warning (I added a test for it). Newly created strings will not have the time scale.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Thanks for the quick update @timj! It all looks good to me provided the CI passes. However, before merging, I'm going to ping @mhvk to see if he can do a quick review (but if he doesn't do it by later today I think we should merge this before feature freeze).

@Cadair
Copy link
Member

Cadair commented Oct 26, 2018

👍

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

Sorry for being so late to the game, but I'm in China at a conference and cannot really keep up with all the feature freeze PRs!
I think this PR is a bit incomplete, since it now no longer seems possible to give the FITS specific timescales and thus, e.g., I think _fits_realization is not used any more. Possibly all that is needed is to add a TODO comment that once the deprecation warning is removed, the rest should be cleaned up as well. Or to allow the FITS scales and representationsto be given in scale? (Or is that possible, I wrote the code, but don't recall and have to run now)

@timj
Copy link
Contributor Author

timj commented Oct 27, 2018

I've added some extra tests to make sure things are really working and it seems fine. I've mentioned that the code section is deprecated. I could remove the _fits_realization and _fits_scale attributes since they are now ignored, but since this code will all be deleted in the future it didn't seem worth doing. I'll have a quick go at removing those attributes.

I agree that there is a problem now that there is no way to use the FITS deprecated timescales. The problem seems to be that:

t = Time("1990-01-10T00:00:00.123", format="fits", scale="et")

doesn't work because the scale is handled above the formatter and is rejected before the FITS class has a chance to do anything. Fixing this would require that the Time constructor asks the formatter for a timescale translation. Not something for this PR I feel.

@astrofrog
Copy link
Member

@timj - thanks for enhancing the tests - can you rebase this PR to get rid of the merge conflict in the changelog?

@timj
Copy link
Contributor Author

timj commented Oct 27, 2018

Rebased and I've also removed the fits realization code and added tests that things still work the same.

@bsipocz
Copy link
Member

bsipocz commented Oct 27, 2018

Thank you @timj!

@bsipocz bsipocz merged commit 577ba66 into astropy:master Oct 27, 2018
@timj
Copy link
Contributor Author

timj commented Oct 29, 2018

I think you can close #7781 and #5329 now.

@astrofrog
Copy link
Member

Thanks @timj!

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.

6 participants