<commit_before>import StringIO
import base64
import datetime
import time
import numpy
import aplpy
from scipy.stats import scoreatpercentile
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection
from .image import open_image
import dbase


def image(dbimage, scale=0.9, plotsources=None, database=None):
    figure = Figure(figsize=(5, 5))
    canvas = FigureCanvasAgg(figure)
    image = aplpy.FITSFigure(dbimage['url'], figure=figure, auto_refresh=False)
    image.show_grayscale()
    image.tick_labels.set_font(size=5)
    if plotsources:
        ra = [source['ra'] for source in plotsources]
        dec = [source['decl'] for source in plotsources]
        image.show_markers(ra, dec, s=40, facecolor='none', edgecolor='green')
    memfig = StringIO.StringIO()
    canvas.print_figure(memfig, format='png', transparent=True)
    encoded_png = StringIO.StringIO()<commit_msg>Updated image plots: show Gaussian fits<commit_after>import StringIO
import base64
import datetime
import time
import numpy
import aplpy
from scipy.stats import scoreatpercentile
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection
from .image import open_image
import dbase


def image(dbimage, scale=0.9, plotsources=None, database=None):
    figure = Figure(figsize=(5, 5))
    canvas = FigureCanvasAgg(figure)
    image = aplpy.FITSFigure(dbimage['url'], figure=figure, auto_refresh=False)
    image.show_grayscale()
    image.tick_labels.set_font(size=5)
    if plotsources:
        ra = [source['ra'] for source in plotsources]
        dec = [source['decl'] for source in plotsources]
        major = [source['major']/900 for source in plotsources]
        minor = [source['minor']/900 for source in plotsources]
        angle = [source['theta']+90 for source in plotsources]
        image.show_ellipses(ra, dec, major, minor, angle, facecolor='none', edgecolor='green')
        #show_ellipses(self, xw, yw, width, height, angle=0, layer=False, zorder=None, **kwargs):
        #image.show_markers(ra, dec, s=40, facecolor='none', edgecolor='green')
    memfig = StringIO.StringIO()
    canvas.print_figure(memfig, format='png', transparent=True)
    encoded_png = StringIO.StringIO()
{'fraction_non_alphanumeric': 0.10101010101010101, 'fraction_numerical': 0.01090909090909091, 'mean_word_length': 4.923444976076555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2250159', 'n_tokens_mistral': 778, 'n_tokens_neox': 743, 'n_words': 202}