コード例 #1
0
ファイル: dt_cron_job.py プロジェクト: cracraft/jwql
def main():
    '''
    from ..utils.engineering_database import query_single_mnemonic

    mnemonic_identifier = 'SA_ZFGOUTFOV'
    start_time = Time(2016.0, format='decimalyear')
    end_time = Time(2018.1, format='decimalyear')


    mnemonic = query_single_mnemonic(mnemonic_identifier, start_time, end_time)
    assert len(mnemonic.data) == mnemonic.meta['paging']['rows']
    '''

    for mnemonic in mn.mnemonic_set_15min:
        whole_day.update(mnemonic=query_single_mnemonic(mnemonic, start, end))

    # generate paths
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'nirspec_database.db')

    # connect to temporary database
    conn = sql.create_connection(DATABASE_FILE)

    process_daysample(conn, table_day)
    process_15minsample(conn, table_15min)

    # close connection
    sql.close_connection(conn)
    print("done")
コード例 #2
0
def test_query_single_mnemonic():
    """Test the query of a mnemonic over a given time range."""

    mnemonic_identifier = 'SE_ZIMIRICEA'
    start_time = Time(2018.01, format='decimalyear')
    end_time = Time(2018.02, format='decimalyear')

    mnemonic = edb.query_single_mnemonic(mnemonic_identifier, start_time,
                                         end_time)
    print(mnemonic)
コード例 #3
0
ファイル: dt_cron_job.py プロジェクト: ttemim/jwql
def main():

    from ..utils.engineering_database import query_single_mnemonic

    mnemonic_identifier = 'SA_ZFGOUTFOV'
    start_time = Time(2016.0, format='decimalyear')
    end_time = Time(2018.1, format='decimalyear')


    mnemonic = query_single_mnemonic(mnemonic_identifier, start_time, end_time)
    assert len(mnemonic.data) == mnemonic.meta['paging']['rows']



    for mnemonic in mn.mnemonic_set_15min:
        whole_day.update(mnemonic = query_single_mnemonic(mnemonic, start, end))


    #configure start and end time for query
    #
    #
    #
    #

    #query table start and end from engineering_database
    #
    #
    #
    #
    #return table_day, table_15min

    #open temporary database and write data!
    DATABASE_LOCATION = os.path.join(PACKAGE_DIR, 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')

    conn = sql.create_connection(DATABASE_FILE)

    process_day_sample(conn, table_day)
    process_15process_15min_sample(conn, table_15min)

    sql.close_connection(conn)
コード例 #4
0
ファイル: dt_cron_job.py プロジェクト: DanielKuebi/jwql
def main():

    from ..utils.engineering_database import query_single_mnemonic

    mnemonic_identifier = 'SA_ZFGOUTFOV'
    start_time = Time(2016.0, format='decimalyear')
    end_time = Time(2018.1, format='decimalyear')


    mnemonic = query_single_mnemonic(mnemonic_identifier, start_time, end_time)
    assert len(mnemonic.data) == mnemonic.meta['paging']['rows']



    for mnemonic in mn.mnemonic_set_15min:
        whole_day.update(mnemonic = query_single_mnemonic(mnemonic, start, end))


    #configure start and end time for query
    #
    #
    #
    #

    #query table start and end from engineering_database
    #
    #
    #
    #
    #return table_day, table_15min

    #open temporary database and write data!
    db_file = "/home/daniel/STScI/jwql/jwql/database/miri_database_new.db"
    conn = sql.create_connection(db_file)

    add_day_to_db(conn, table_day)
    add_15min_to_db(conn, table_15min)

    sql.close_connection(conn)
コード例 #5
0
ファイル: data_containers.py プロジェクト: dickreuter/jwql
def get_edb_components(request):
    """Return dictionary with content needed for the EDB page.

    Parameters
    ----------
    request : HttpRequest object
        Incoming request from the webpage

    Returns
    -------
    edb_components : dict
        Dictionary with the required components

    """
    mnemonic_name_search_result = {}
    mnemonic_query_result = {}
    mnemonic_query_result_plot = None

    # If this is a POST request, we need to process the form data
    if request.method == 'POST':

        if 'mnemonic_name_search' in request.POST.keys():
            mnemonic_name_search_form = MnemonicSearchForm(
                request.POST, prefix='mnemonic_name_search')

            if mnemonic_name_search_form.is_valid():
                mnemonic_identifier = mnemonic_name_search_form[
                    'search'].value()
                if mnemonic_identifier is not None:
                    mnemonic_name_search_result = query_mnemonic_info(
                        mnemonic_identifier)

            # create forms for search fields not clicked
            mnemonic_query_form = MnemonicQueryForm(prefix='mnemonic_query')

        elif 'mnemonic_query' in request.POST.keys():
            mnemonic_query_form = MnemonicQueryForm(request.POST,
                                                    prefix='mnemonic_query')

            # proceed only if entries make sense
            if mnemonic_query_form.is_valid():
                mnemonic_identifier = mnemonic_query_form['search'].value()
                start_time = Time(mnemonic_query_form['start_time'].value(),
                                  format='iso')
                end_time = Time(mnemonic_query_form['end_time'].value(),
                                format='iso')

                if mnemonic_identifier is not None:
                    mnemonic_query_result = query_single_mnemonic(
                        mnemonic_identifier, start_time, end_time)
                    mnemonic_query_result_plot = mnemonic_query_result.bokeh_plot(
                    )

            # create forms for search fields not clicked
            mnemonic_name_search_form = MnemonicSearchForm(
                prefix='mnemonic_name_search')

    else:
        mnemonic_name_search_form = MnemonicSearchForm(
            prefix='mnemonic_name_search')
        mnemonic_query_form = MnemonicQueryForm(prefix='mnemonic_query')

    edb_components = {
        'mnemonic_query_form': mnemonic_query_form,
        'mnemonic_query_result': mnemonic_query_result,
        'mnemonic_query_result_plot': mnemonic_query_result_plot,
        'mnemonic_name_search_form': mnemonic_name_search_form,
        'mnemonic_name_search_result': mnemonic_name_search_result
    }

    return edb_components