<commit_before>from collections import namedtuple

import numpy as np
import matplotlib.cm as cm

import euler
import leapfrog
import icc 
import constants
from snapshots.display import SnapshotRenderer
from snapshots.storage import SnapshotStorage

total_time = 10000 * constants.YR
dt = 1 * constants.YR
dt_output = 5 * constants.YR

epsilon = 0.2 #Smoothing parameter
d= 1.0e14
bodies = icc.uniform_distribution(500, d)
#bodies.m *= constants.SOLAR_MASS # tai jau daroma icc

snapshot_storage = SnapshotStorage()
snapshot_storage.append(bodies.r)

snapshot_renderer = SnapshotRenderer.for_clusters(snapshot_storage, bounds=[-2*d, 2*d])
snapshot_renderer.display_step()

for i, current_t in enumerate(leapfrog.simulate_step(bodies, dt, constants.G, epsilon, dt_output=dt_output)):
    if current_t >= total_time:
        break

    print "%e/%e" %(current_t, total_time)

    snapshot_storage.append(bodies.r)
    snapshot_renderer.display_step()
<commit_msg>Saving all snapshots after simulation<commit_after>from collections import namedtuple

import numpy as np
import matplotlib.cm as cm

import euler
import leapfrog
import icc 
import constants
from snapshots.display import SnapshotRenderer
from snapshots.storage import SnapshotStorage

total_time = 10000 * constants.YR
dt = 1 * constants.YR
dt_output = 5 * constants.YR

epsilon = 0.2 #Smoothing parameter
d= 1.0e14
bodies = icc.uniform_distribution(500, d)
#bodies.m *= constants.SOLAR_MASS # tai jau daroma icc

snapshot_storage = SnapshotStorage()
snapshot_storage.append(bodies.r)

snapshot_renderer = SnapshotRenderer.for_clusters(snapshot_storage, bounds=[-d, d])
snapshot_renderer.display_step()

for i, current_t in enumerate(leapfrog.simulate_step(bodies, dt, constants.G, epsilon, dt_output=dt_output)):
    if current_t >= total_time:
        break

    print "%e/%e" %(current_t, total_time)

    snapshot_storage.append(bodies.r)
    snapshot_renderer.display_step()

snapshot_storage.save("snapshot.pkl")

{'fraction_non_alphanumeric': 0.08783442705704189, 'fraction_numerical': 0.017163048965169108, 'mean_word_length': 5.498360655737705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1510787', 'n_tokens_mistral': 689, 'n_tokens_neox': 657, 'n_words': 163}