Exemplo n.º 1
0
def galaxy_parameter_image(bucket, galaxy_key, name):
    """
    Returns base64 string version of galaxy image
    """
    tmp_file = get_temp_file('.png')
    key = get_build_png_name(galaxy_key, name)
    get_file_from_bucket(bucket, key, tmp_file)

    out_file = open(tmp_file, "rb")
    image64 = base64.b64encode(out_file.read())
    out_file.close()

    os.remove(tmp_file)

    return image64
Exemplo n.º 2
0
def galaxy_parameter_image(bucket, galaxy_key, name):
    """
    Returns base64 string version of galaxy image
    """
    tmp_file = get_temp_file('.png')
    key = get_build_png_name(galaxy_key, name)
    get_file_from_bucket(bucket, key, tmp_file)

    out_file = open(tmp_file, "rb")
    image64 = base64.b64encode(out_file.read())
    out_file.close()

    os.remove(tmp_file)

    return image64
Exemplo n.º 3
0
def user_galaxy_image(bucket, galaxy_key, connection, userid, galaxy_id, colour):
    """
    Returns base64 string version of galaxy image
    """
    image_file_name = get_temp_file(".png")
    marked_image_file_name = get_temp_file(".png")

    key = get_colour_image_key(galaxy_key, colour)
    get_file_from_bucket(bucket, key, image_file_name)

    image = fitsimage.FitsImage(connection)
    image.mark_image(image_file_name, marked_image_file_name, galaxy_id, userid)

    out_file = open(marked_image_file_name, "rb")
    image64 = base64.b64encode(out_file.read())
    out_file.close()
    os.remove(marked_image_file_name)
    os.remove(image_file_name)

    return image64
Exemplo n.º 4
0
def user_galaxy_image(bucket, galaxy_key, connection, userid, galaxy_id,
                      colour):
    """
    Returns base64 string version of galaxy image
    """
    image_file_name = get_temp_file(".png")
    marked_image_file_name = get_temp_file(".png")

    key = get_colour_image_key(galaxy_key, colour)
    get_file_from_bucket(bucket, key, image_file_name)

    image = fitsimage.FitsImage(connection)
    image.mark_image(image_file_name, marked_image_file_name, galaxy_id,
                     userid)

    out_file = open(marked_image_file_name, "rb")
    image64 = base64.b64encode(out_file.read())
    out_file.close()
    os.remove(marked_image_file_name)
    os.remove(image_file_name)

    return image64