Exemplo n.º 1
0
def combined_excel_image(request, uniquename, exp_type):
    feat = Feature.objects.get(uniquename=uniquename)
    excel_datas = feat.combined_experiment_excel_data(exp_type)
    out_fhand = NamedTemporaryFile(suffix='.svg')
    draw_combined_graph(excel_datas, out_fhand)
    image_content = open(out_fhand.name).read()
    content_type = 'image/svg+xml'
    return HttpResponse(image_content, content_type=content_type)
Exemplo n.º 2
0
def filter_private_and_make_svgs(experiments_by_type, user):
    public_experiments_by_type = {}
    # filter private
    try:
        user = User.objects.get(username=user)
    except User.DoesNotExist:
        user = AnonymousUser()
    for type_, exps in experiments_by_type.items():
        for exp in exps:
            if exp.owner == user or user.is_staff or exp.is_public:
                if type_ not in public_experiments_by_type:
                    public_experiments_by_type[type_] = []
                public_experiments_by_type[type_].append(exp)
    combined_svgs = []
    for exp_type, excel_data in combined_experiment_excel_data(public_experiments_by_type):
        if exp_type.startswith("NS") or not excel_data:
            continue

        out_fhand = StringIO()
        draw_combined_graph(excel_data, out_fhand, exp_type)
        combined_svgs.append((exp_type, out_fhand.getvalue()))
    return combined_svgs
Exemplo n.º 3
0
 def test_combined(self):
     fhand = NamedTemporaryFile(suffix='.svg')
     fhand = open('/tmp/tmpf.svg', 'w')
     draw_combined_graph(COMBINED_DATA, fhand, 'SE_001')
     raw_input(fhand.name)
     fhand.close()