<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 23, 2015 at 6:34 AM, Cem Karan <span dir="ltr"><<a href="mailto:cfkaran2@gmail.com" target="_blank">cfkaran2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On Apr 23, 2015, at 1:59 AM, Steven D'Aprano <<a href="mailto:steve%2Bcomp.lang.python@pearwood.info">steve+comp.lang.python@pearwood.info</a>> wrote:<br>
<br>
> On Thursday 23 April 2015 11:53, Cem Karan wrote:<br>
><br>
>> Precisely.  In order to make my simulations more realistic, I use a lot of<br>
>> random numbers.  I can fake things by keeping the seed to the generator,<br>
>> but if I want to do any sort of hardware in the loop simulations, then<br>
>> that approach won't work.<br>
><br>
> That's exactly why we have *pseudo* random number generators. They are<br>
> statistically indistinguishable from "real" randomness, but repeatable when<br>
> needed.<br>
<br>
</span>Which is why is why I mentioned keeping the seed above.  The problem is that I eventually want to do hardware in the loop, which will involve IO between the simulation machine and the actual robots, and IO timing is imprecise and uncontrollable.  That is where not recording something becomes lossy.  That said, the mere act of trying to record everything is going to cause timing issues, so I guess I'm over thinking things yet again.<br>
<br>
Thanks for the help everyone, its helped me clarify what I need to do in my mind.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div> </div></div>Well, you could achieve this on Linux by using the rdiff library.  Not exactly a purely Python solution, but it would give you file-based diffs.  </div><div class="gmail_extra"><br></div><div class="gmail_extra">Basically, what you could do is write the first file.  Then for each subsequent saves, write out the file (as a temp file) and issue shell commands (via the Python script) to calculate the diffs of the new file against the first (basis) file.  Once you remove the temp files, you'd have a full first save and a set of diffs against that file.  You could rehydrate any save you want by applying the diff to the basis.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If you work on it a bit, you might even be able to avoid the temp file saves by using pipes in the shell command.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Of course, I haven't tested this so there may be non-obvious issues with diffing between subsequent pickled saves, but it seems that it should work on the surface.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Good luck!</div><div class="gmail_extra"><br></div><div class="gmail_extra">SS</div></div>