[AstroPy] Fast ASCII reader with Fortran notation
mdroe at stsci.edu
Wed Apr 1 08:51:08 EDT 2015
This seems like a great addition. I'd say go ahead and file a pull
request from your branch (with your description below in the initial
comment), as it's probably easiest for us to comment on it in that
interface. It's not unusual for some back-and-forth on pull requests,
so it doesn't need to be "perfect" when you create it.
On 03/31/2015 05:33 PM, Derek Homeier wrote:
> Hi all,
> first thanks to everyone who contributed to the fast C parser framework in 1.0’s io.ascii,
> having decent speed when dealing with cumbersome text files has been on my wish list
> for some time!
> My next highest priority was always being able to read in Fortran-written ascii files with
> its standard double-precision notation (1.495978707D+13…) without further processing,
> which required setting up converters for each column with np.loadtxt or np.genfromtxt.
> I decided to take a shot at the fast_reader module to enable the c parser to directly
> recognise the ‘D’ as exponential character, a branch from the stable tree is here
> which adds ‘fortran_dexp’ as new option to the fast_reader arguments.
> Is there general interest for a pull request against stable or master? I’d also like to put
> some questions on refinements for discussion:
> 1. This patch automatically activates the fast_converter, as changing the call to xstrtod was
> by far the simplest implementation. I guess it would be possible to add it to the more
> precise parser as well, but don’t know how big the demand for this is. I have yet to see
> a case where use_fast_converter gave a different result.
> 2. Currently ‘fortran_dexp’=True changes the recognised exponential character to ‘d’ or ‘D’ only,
> it’s easy to add any other character or an ‘automatic’ option that will both recognise ‘e’ and ‘d’
> in the same file, at a seemingly small performance penalty of 5-10 %.
> If there is interest I could definitely add the second option.
> AstroPy mailing list
> AstroPy at scipy.org
More information about the AstroPy