<filename>lc/utils.py
# coding: utf-8

import csv
from StringIO import StringIO

def get_csv(medium):
    fp = StringIO()
    fp_csv = csv.writer(fp)
    fp_csv.writerow(["x","y","filament","particle"])
    for f in medium:
        for p in f:
            fp_csv.writerow([p.x,p.y,f.order,p.order])
    return fp.getvalue()

def get_manifest(config):
    fp = StringIO()
    for key,val in config.items('lc'):
        fp.write("%s=%s\n" % (key, val))
    return fp.getvalue()

