Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'method.': 0.05; 'ascii': 0.07; 'padding': 0.07; 'bytes)': 0.09; 'lengths': 0.09; 'stored': 0.10; ':-)': 0.13; '-tkc': 0.16; '[*]': 0.16; 'guessing': 0.16; 'inputs': 0.16; 'processed.': 0.16; 'reversed': 0.16; 'sequential': 0.16; 'written.': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'tim': 0.18; 'input': 0.18; 'otherwise,': 0.20; 'to:name :python-list@python.org': 0.20; 'written': 0.20; 'finally,': 0.22; 'example': 0.23; 'external': 0.24; 'least': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '---': 0.26; 'charset:iso-8859-15': 0.26; '(e.g.': 0.27; 'question': 0.27; 'chase': 0.29; 'smart': 0.29; 'thus,': 0.29; 'performing': 0.30; 'file': 0.32; 'could': 0.32; 'ram': 0.33; 'utility': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'faster': 0.35; 'saved': 0.35; 'data.': 0.36; 'problems': 0.36; 'subject: (': 0.36; 'being': 0.37; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'files': 0.38; 'some': 0.38; 'sure': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'save': 0.61; 'first': 0.61; 'provide': 0.62; 'series': 0.63; 'details': 0.63; 'skip:n 10': 0.63; 'more': 0.63; 'total': 0.65; 'reverse': 0.65; 'forward': 0.66; 'manner.': 0.66; 'records': 0.68; 'hoping': 0.72; 'manner': 0.74; 'disappointed': 0.84; 'subject:Fast': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'same,': 0.91 X-SENDER-IP: [213.112.50.224] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQuAC/QhlDVcDLgPGdsb2JhbAANN4pOs1qDYAEBAQE4glIBAQEBAzhRCxgJJQ8CMhQGDQgBAbBYgymQNotfhl4Dkj+WXA X-IronPort-AV: E=Sophos;i="4.80,637,1344204000"; d="scan'208";a="211861873" Date: Tue, 23 Oct 2012 19:17:51 +0200 From: Virgil Stokes User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "python-list@python.org" Subject: Re: Fast forward-backward (write-read) References: <5086AA35.4000509@it.uu.se> <5086C156.40707@tim.thechases.com> In-Reply-To: <5086C156.40707@tim.thechases.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351012669 news.xs4all.nl 6920 [2001:888:2000:d::a6]:59037 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31945 On 23-Oct-2012 18:09, Tim Chase wrote: > On 10/23/12 09:31, Virgil Stokes wrote: >> I am working with some rather large data files (>100GB) that contain time series >> data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII format. I perform >> various types of processing on these data (e.g. moving median, moving average, >> and Kalman-filter, Kalman-smoother) in a sequential manner and only a small >> number of these data need be stored in RAM when being processed. When performing >> Kalman-filtering (forward in time pass, k = 0,1,...,N) I need to save to an >> external file several variables (e.g. 11*32 bytes) for each (t_k, y(t_k)). These >> are inputs to the Kalman-smoother (backward in time pass, k = N,N-1,...,0). >> Thus, I will need to input these variables saved to an external file from the >> forward pass, in reverse order --- from last written to first written. >> >> Finally, to my question --- What is a fast way to write these variables to an >> external file and then read them in backwards? > Am I missing something, or would the fairly-standard "tac" utility > do the reversal you want? It should[*] be optimized to handle > on-disk files in a smart manner. Not sure about "tac" --- could you provide more details on this and/or a simple example of how it could be used for fast reversed "reading" of a data file? > > Otherwise, if you can pad the record-lengths so they're all the > same, and you know the total number of records, you can seek to > Total-(RecSize*OneBasedOffset) and write the record,optionally > padding if you need/can. At least on *nix-like OSes, you can seek > into a sparse-file with no problems (untested on Win32). The records lengths will all be the same and yes seek could be used; but, I was hoping for a faster method. Thanks Tim! :-) > > -tkc > > > > [*] > Just guessing here. Would be disappointed if it *wasn't*.