<commit_before>{% extends "base.html" %}

{% load units %}
{% load paginator %}
{% load tableheader %}


{% block navdatabase %}<li><a href="{% url 'datasets' db_name %}">Database {{ db_name }}</a></li>{% endblock navdatabase %}
{% block navdataset %}<li><a href="{% url 'dataset' db_name object.runcat.dataset_id %}">Dataset {{ object.runcat.dataset_id }}</a></li>{% endblock %}
{% block navdeep %}<li><a href="{% url 'transients' db_name %}?dataset={{ object.runcat.dataset_id }}">Transients</a></li>{% endblock %}
{% block navdeper %}<li class="active"><a href="{% url 'transient' db_name object.id %}">Transient {{ object.id }}</a></li>{% endblock %}

{% block title %}Transient {{ object.id }} · Banana{% endblock title %}

{% block content %}

<!-- required for error bars -->
{% block morehead %}<script src="{{ STATIC_URL }}highcharts/highcharts-more.js"></script>{% endblock %}

<div class="row">
    <div class="span5">
        <h2>Transient #{{ object.id }}</h2>
        <dl class="dl-horizontal">
            <dt>Position</dt>
            <dd>({{ object.runcat.wm_ra|stringformat:".3f" }}&deg;,
                {{ object.runcat.wm_decl|stringformat:".3f" }}&deg;) &pm;
                ({{ object.runcatwm_ra_err|stringformat:".3f" }}&Prime;,
                {{ object.runcat.wm_decl_err|stringformat:".3f" }}&Prime;)</dd>
            <dt>Frequency band</dt>
            <dd>{{ object.band }}</dd>
            <dt>Effective frequency</dt>
            <dd>{{ object.freq_eff }} ?</dd>
            <dt>Significance level</dt>
            <dd>{{ object.siglevel }}</dd>
            <dt>&eta;<sub>&nu;</sub></dt>
            <dd>{{ object.eta_int|scientific }}</dd>
            <dt>V<sub>&nu;</sub></dt>
            <dd>{{ object.v_int|scientific }}</dd>
            <dt>Start date</dt>
            <dd>{% if object.t_start %}{{ object.t_start|date:"c" }}{% else %} Unknown {% endif %}</dd>
            <dt># of datapoints</dt>
            <dd>{{ object.runcat.datapoints }}</dd>
            <dt>Running cat #</dt>
            <dd><a href="{% url 'runningcatalog' db_name object.runcat %}">{{ object.runcat }}</a></dd>
            <dt>Dataset</dt>
            <dd><a href="{% url 'dataset' db_name object.runcat.dataset_id %}">{{ object.runcat.dataset.id }}</a></dd>
        </dl>
        <div class="text-center">
          <a href="http://simbad.u-strasbg.fr/simbad/sim-coo?CooEpoch=2000&Coord={{ object.runcat.wm_ra }}d{{ object.runcat.wm_decl }}d&Radius.unit=arcmin&CooEqui=2000&CooFrame=FK5&Radius=10" class="btn">Simbad Cone Search</a>
        </div>
    </div>

    <div class="span7">
        <div id='lightcurve'></div>
    </div>

{% if object_list %}
<h3>Lightcurve</h3>

<div class="row">
        <div class="span12 text-center">
            <a href="?format=csv"><button class="btn" type="button">CSV format</button></a>
        </div>

        <div class="span12 text-center">
            {% paginatorizer %}
        </div>
    <div class="span12">

        <table class="table table-bordered table-striped responsive-utilities table-condensed " data-provides="rowlink">
        <thead>
            {% tableheader 'id' %}
            {% tableheader 'image__taustart_ts' 'Date (UTC)' %}
            {% tableheader 'image__tau_time' 'Integration time (s)' %}
            {% tableheader 'image__band__freq_central' 'Frequency (Hz)' %}
            {% tableheader 'f_int' 'Flux (Jy)' %}
            {% tableheader 'f_int_err' 'Flux error (Jy)' %}
            {% tableheader 'extract_type' 'xtract type' %}
            {% tableheader 'thumbnail' %}
        </thead>
        <tbody>
            {% for point in object_list %}
            <tr class="{% cycle 'odd' 'even' %}">
                <td><a href="{% url 'extractedsource' db_name point.id %}">{{ point.id }}</a></td>
                <td>{{ point.image.taustart_ts|date:"c" }}</td>
                <td>{{ point.image.tau_time|scientific }}</td>
                <td>{{ point.image.band.freq_central|scientific }}</td>
                <td>{{ point.f_int|scientific }}</td>
                <td>{{ point.f_int_err|scientific }}</td>
                <td>{{ point.extract_type }}</td>
                <td><img src="{% url 'extractedsource_plot' db_name point.id %}?size=1"></td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}


<script>
    // get data from django template
    var lightcurve = [
        {% for point in paginator.object_list %}{
            "band": '{{ point.image.band }}',
            "taustart_ts": {{ point.image.taustart_ts|datetime2miliseconds }},
            "f_int": {{ point.f_int }},
            "f_int_err": {{ point.f_int_err }},
            "tau_time": {{ point.image.tau_time }},
            "extract_type": {{ point.extract_type }},
        }{% if not forloop.last %}, {% endif %}
        {% endfor %}
    ];
    var title = 'Lightcurve for transient #{{object.id}}';
    var subtitle = 'start date {% if object.t_start %}{{ object.t_start|date:"c" }}{% else %} Unknown {% endif %}';
</script><commit_msg>add "show thumbnail" button<commit_after>{% extends "base.html" %}

{% load units %}
{% load paginator %}
{% load tableheader %}


{% block navdatabase %}<li><a href="{% url 'datasets' db_name %}">Database {{ db_name }}</a></li>{% endblock navdatabase %}
{% block navdataset %}<li><a href="{% url 'dataset' db_name object.runcat.dataset_id %}">Dataset {{ object.runcat.dataset_id }}</a></li>{% endblock %}
{% block navdeep %}<li><a href="{% url 'transients' db_name %}?dataset={{ object.runcat.dataset_id }}">Transients</a></li>{% endblock %}
{% block navdeper %}<li class="active"><a href="{% url 'transient' db_name object.id %}">Transient {{ object.id }}</a></li>{% endblock %}

{% block title %}Transient {{ object.id }} · Banana{% endblock title %}

{% block content %}

<!-- required for error bars -->
{% block morehead %}<script src="{{ STATIC_URL }}highcharts/highcharts-more.js"></script>{% endblock %}

<div class="row">
    <div class="span5">
        <h2>Transient #{{ object.id }}</h2>
        <dl class="dl-horizontal">
            <dt>Position</dt>
            <dd>({{ object.runcat.wm_ra|stringformat:".3f" }}&deg;,
                {{ object.runcat.wm_decl|stringformat:".3f" }}&deg;) &pm;
                ({{ object.runcatwm_ra_err|stringformat:".3f" }}&Prime;,
                {{ object.runcat.wm_decl_err|stringformat:".3f" }}&Prime;)</dd>
            <dt>Frequency band</dt>
            <dd>{{ object.band }}</dd>
            <dt>Effective frequency</dt>
            <dd>{{ object.freq_eff }} ?</dd>
            <dt>Significance level</dt>
            <dd>{{ object.siglevel }}</dd>
            <dt>&eta;<sub>&nu;</sub></dt>
            <dd>{{ object.eta_int|scientific }}</dd>
            <dt>V<sub>&nu;</sub></dt>
            <dd>{{ object.v_int|scientific }}</dd>
            <dt>Start date</dt>
            <dd>{% if object.t_start %}{{ object.t_start|date:"c" }}{% else %} Unknown {% endif %}</dd>
            <dt># of datapoints</dt>
            <dd>{{ object.runcat.datapoints }}</dd>
            <dt>Running cat #</dt>
            <dd><a href="{% url 'runningcatalog' db_name object.runcat %}">{{ object.runcat }}</a></dd>
            <dt>Dataset</dt>
            <dd><a href="{% url 'dataset' db_name object.runcat.dataset_id %}">{{ object.runcat.dataset.id }}</a></dd>
        </dl>
        <div class="text-center">
          <a href="http://simbad.u-strasbg.fr/simbad/sim-coo?CooEpoch=2000&Coord={{ object.runcat.wm_ra }}d{{ object.runcat.wm_decl }}d&Radius.unit=arcmin&CooEqui=2000&CooFrame=FK5&Radius=10" class="btn">Simbad Cone Search</a>
        </div>
    </div>

    <div class="span7">
        <div id='lightcurve'></div>
    </div>

{% if object_list %}
<h3>Lightcurve</h3>

<div class="row">
    <div class="span12 text-center">
        <a href="?format=csv"><button class="btn" type="button">CSV format</button></a>
        <a href="javascript:showThumbnails()"><button class="btn" type="button">show thumbnails</button></a>
    </div>

    <div class="span12 text-center">
        {% paginatorizer %}
    </div>

    <div class="span12">
        <table class="table table-bordered table-striped responsive-utilities table-condensed " data-provides="rowlink">
        <thead>
            {% tableheader 'id' %}
            {% tableheader 'image__taustart_ts' 'Date (UTC)' %}
            {% tableheader 'image__tau_time' 'Integration time (s)' %}
            {% tableheader 'image__band__freq_central' 'Frequency (Hz)' %}
            {% tableheader 'f_int' 'Flux (Jy)' %}
            {% tableheader 'f_int_err' 'Flux error (Jy)' %}
            {% tableheader 'extract_type' 'xtract type' %}
            {% tableheader 'thumbnail' %}
        </thead>
        <tbody>
            {% for point in object_list %}
            <tr class="{% cycle 'odd' 'even' %}">
                <td><a href="{% url 'extractedsource' db_name point.id %}">{{ point.id }}</a></td>
                <td>{{ point.image.taustart_ts|date:"c" }}</td>
                <td>{{ point.image.tau_time|scientific }}</td>
                <td>{{ point.image.band.freq_central|scientific }}</td>
                <td>{{ point.f_int|scientific }}</td>
                <td>{{ point.f_int_err|scientific }}</td>
                <td>{{ point.extract_type }}</td>
                <td><div id="thumbnail{{ point.id }}"></div></td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>

    <div class="span12 text-center">
        {% paginatorizer %}
    </div>

</div>

<script>
imgs = {
    {% for point in object_list %}{{point.id}}: '{% url 'extractedsource_plot' db_name point.id %}?size=1'{% if not forloop.last %},{% endif %}
    {% endfor %}
};

function showThumbnails() {
    for (key in imgs) {
        var elem = document.createElement("img");
        elem.src = imgs[key];
        document.getElementById("thumbnail" + key).appendChild(elem);
    }
}
</script>
{% endif %}


<script>
    // get data from django template
    var lightcurve = [
        {% for point in paginator.object_list %}{
            "band": '{{ point.image.band }}',
            "taustart_ts": {{ point.image.taustart_ts|datetime2miliseconds }},
            "f_int": {{ point.f_int }},
            "f_int_err": {{ point.f_int_err }},
            "tau_time": {{ point.image.tau_time }},
            "extract_type": {{ point.extract_type }},
        }{% if not forloop.last %}, {% endif %}
        {% endfor %}
    ];
    var title = 'Lightcurve for transient #{{object.id}}';
    var subtitle = 'start date {% if object.t_start %}{{ object.t_start|date:"c" }}{% else %} Unknown {% endif %}';
</script>
{'fraction_non_alphanumeric': 0.20155328904276223, 'fraction_numerical': 0.005614297744923739, 'mean_word_length': 2.500818866688503, 'pattern_counts': {'":': 12, '<': 262, '<?xml version=': 0, '>': 262, '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': '2757451', 'n_tokens_mistral': 3800, 'n_tokens_neox': 3472, 'n_words': 704}