In [2]:
import sys
sys.path.append('/Users/spacecoffin/Development')
import GravelKicker as gk
import os
import pandas as pd
from datetime import datetime
from supriya.tools import nonrealtimetools
In [3]:
this_dir = '/Users/spacecoffin/Development/GravelKicker/__gen_files'
In [5]:
datetime.now().strftime("df-%Y_%m_%d.p")
Out[5]:
In [6]:
def make_out_dir(path, new_dir):
if os.path.exists(path):
new_dir_path = os.path.join(path, new_dir)
os.makedirs(new_dir_path, exist_ok=True)
return new_dir_path
else:
return "{} does not exist".format(path)
In [16]:
dt_identifier = datetime.now().strftime("df-%Y_%m_%d_%H%M%S.p")
In [17]:
_pickle_dir = os.path.join(this_dir, "pickle_files")
In [18]:
os.path.join(_pickle_dir, dt_identifier)
Out[18]:
In [7]:
dir_list = os.listdir(path=this_dir)
_pickle_path = os.path.join(this_dir, "df.p")
if "df.p" in dir_list:
#_pickle_path = os.path.join(this_dir, "df.p")
_old_df = pd.read_pickle(_pickle_path)
_pickle_dir = make_out_dir(this_dir, "pickle_files")
dt_identifier = datetime.now().strftime("df-%Y_%m_%d_%H%M%S.p")
_old_pickle_path = os.path.join(_pickle_dir, dt_identifier)
pd.to_pickle(_old_pickle_path)
In [ ]:
dt = datetime.now().strftime("%Y_%m_%d_%H-%M-%S")
identifier = '{0}-len{1}'.format(dt, str(df.shape[0]))
df.to_pickle("{0}/df-{1}.p".format(this_dir, dt))
df.to_pickle("{0}/df.p".format(this_dir, dt))
In [9]:
_old_df["hash"]
Out[9]:
In [11]:
_old_df.dtypes
Out[11]:
In [15]:
pmtx = gk.generator.gendy1.gen_params(rows=20)
df = gk.generator.gendy1.format_params(pmtx)
df.sort_values(["hash"])
Out[15]:
In [20]:
for i, row in df.iterrows():
session = nonrealtimetools.Session()
builder = gk.generator.gendy1.make_builder(row)
out = gk.generator.gendy1.build_out(builder)
synthdef = builder.build()
with session.at(0):
synth_a = session.add_synth(duration=10, synthdef=synthdef)
gk.util.render_session(session, this_dir, row["hash"])
In [47]:
dt = datetime.now().strftime("%Y_%m_%d") #_%H-%M-%S")
identifier = '{0}-len{1}'.format(dt, str(df.shape[0]))
In [53]:
df.to_pickle("{0}/df-{1}.p".format(this_dir, dt))
In [54]:
df.to_pickle("{0}/df.p".format(this_dir, dt))
Next, we need to:
In [ ]: