{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/5353","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/5353/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/5353/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/5353/events","html_url":"https://github.com/astropy/astropy/issues/5353","id":178432517,"number":5353,"title":"Possible precision loss bug when reading FITS files with astropy.io","user":{"login":"aringlis","id":1757836,"avatar_url":"https://avatars.githubusercontent.com/u/1757836?v=3","gravatar_id":"","url":"https://api.github.com/users/aringlis","html_url":"https://github.com/aringlis","followers_url":"https://api.github.com/users/aringlis/followers","following_url":"https://api.github.com/users/aringlis/following{/other_user}","gists_url":"https://api.github.com/users/aringlis/gists{/gist_id}","starred_url":"https://api.github.com/users/aringlis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aringlis/subscriptions","organizations_url":"https://api.github.com/users/aringlis/orgs","repos_url":"https://api.github.com/users/aringlis/repos","events_url":"https://api.github.com/users/aringlis/events{/privacy}","received_events_url":"https://api.github.com/users/aringlis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/Affects-release","name":"Affects-release","color":"0052cc"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Bug","name":"Bug","color":"eb6420"},{"url":"https://api.github.com/repos/astropy/astropy/labels/io.fits","name":"io.fits","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":57,"created_at":"2016-09-21T18:53:46Z","updated_at":"2016-09-27T11:27:43Z","closed_at":null,"body":"I and my colleague @wafels encountered a possible bug when attempting to read modified julian day (MJD) values out of a FITS file using astropy.io.fits. A working example is below. For reference, the file in question can be found [here](https://drive.google.com/open?id=0B9-D4zr2735kdTN1WEZ5el90Q0E). It contains a catalogue of triggers marked 'SFLARE' detected by the Fermi mission.\r\n\r\n    In [2]: from astropy.io import fits\r\n    In [3]: from astropy.time import Time\r\n    In [4]: result = fits.open('browse_results.fits’)\r\n    In [5]: hdu1 = result[1]\r\n    In [6]: hdu1.data['TRIGGER_TIME'][108]\r\n    Out[6]: 55719.266\r\n    In [7]: tt = Time(hdu1.data['TRIGGER_TIME'][108],format = 'mjd')\r\n\r\n    In [8]: tt.datetime\r\n    Out[8]: datetime.datetime(2011, 6, 7, 6, 22, 30)\r\n\r\nFor reference, the correct time (verified from manually viewing the file, and also from the original Fermi catalogue online) for this trigger is actually: 2011-06-07 06:23:06:652\r\n\r\nAs a further test, the correct trigger time is read out by MRDFITS in IDL. As best I can tell, there seems to be some sort of precision loss when reading this file with astropy.io.fits. This can be seen here:\r\n\r\n    In [9]: print repr(np.float64(hdu1.data['TRIGGER_TIME'][108]))\r\n    55719.265625\r\n\r\nWhereas from IDL:\r\n\r\n    IDL> result = mrdfits('browse_results.fits',1)\r\n    IDL> print,result[108].trigger_time,format='(d20.13)' \r\n     55719.2660492089999\r\n\r\nPutting these numbers into a time conversion, e.g. [xTIME](https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xTime/xTime.pl) gives you the same difference in times, 55719.265625 --> 06:22:30 UT, and 55719.26604921 --> 06:23:06.652 UT\r\n\r\nAlthough this example is specific to times in MJD format, it could be a more general problem - I have not tested this behaviour on other data types. Another possibility is that something is slightly non-standard regarding how the FITS file is formatted, but I am not sure what would cause this. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/249838453","html_url":"https://github.com/astropy/astropy/issues/5353#issuecomment-249838453","issue_url":"https://api.github.com/repos/astropy/astropy/issues/5353","id":249838453,"user":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T11:27:43Z","updated_at":"2016-09-27T11:27:43Z","body":"+1 to always using float64\r\n\r\nTo be fair, if a table is large enough that this starts to matter memory-wise, it should not be stored as an ASCII FITS table!"}}
{"actor":{"display_login":"astrofrog"}}