How to use the jwql.instrument_monitors.miri_monitors.data_trending.utils.sql_interface.add_data function in jwql

To help you get started, we’ve selected a few jwql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200212 dt_cron_job.py View on Github external
print("*************************************************************")
    print("* SQL data 15 min")
    print("*************************************************************")

    # push extracted and filtered data to temporary database
    for key, value in processed_data.items():

        # abbreviate data table
        m = m_raw_data[key]

        if key == "SE_ZIMIRICEA":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "SE_ZIMIRICEA_IDLE", dataset)

        elif key == "IMIR_HK_ICE_SEC_VOLT4":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "IMIR_HK_ICE_SEC_VOLT4_IDLE", dataset)

        else:
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, key, dataset)
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200212 dt_cron_job.py View on Github external
# abbreviate data table
        m = m_raw_data[key]

        if key == "SE_ZIMIRICEA":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "SE_ZIMIRICEA_IDLE", dataset)

        elif key == "IMIR_HK_ICE_SEC_VOLT4":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "IMIR_HK_ICE_SEC_VOLT4_IDLE", dataset)

        else:
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, key, dataset)
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / min_job.py View on Github external
if key == "SE_ZIMIRICEA":
                key = "SE_ZIMIRICEA_IDLE"

            if key == "IMIR_HK_ICE_SEC_VOLT4":
                key = "IMIR_HK_ICE_SEC_VOLT4_IDLE"

            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, key, dataset)

        except:
            if 'variance requires at least two data points' == str(sys.exc_info()[1]):
                dataset = (float(m.meta['start']), float(m.meta['end']), float(1), value[0], float(0))
                sql.add_data(conn, key, dataset)
            else:
                log.log('Error: ' + str(sys.exc_info()[1]), 'Error')
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200212 dt_cron_job.py View on Github external
dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "SE_ZIMIRICEA_IDLE", dataset)

        elif key == "IMIR_HK_ICE_SEC_VOLT4":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "IMIR_HK_ICE_SEC_VOLT4_IDLE", dataset)

        else:
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, key, dataset)
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200211 cor_job.py View on Github external
try:
        # get data
        data, meta, info = edb.query_single_mnemonic(mnemonic_name, start_time, end_time, token=mast_token)
        data['time_iso'] = Time(data['MJD'], format='mjd').iso
        del data['theTime']

        # data.show_in_browser(jsviewer=True)
        value = data['euvalue']

        # process querried data
        length = len(value)
        mean = statistics.mean(value)
        deviation = statistics.stdev(value)
        dataset = (float(start_time.decimalyear), float(end_time.decimalyear), length, mean, deviation)
        sql.add_data(conn, mnemonic_name, dataset)

        # set text and color
        status = 'Succes'
        color = '\033[0m'  # color black (standard)

    except:
        # set text and color
        status = 'Failure'
        color = '\33[31m'  # color red

    print_string = 'dt_corn_job: ' + DateTime.now().isoformat() + '\t' + status + '\t' + mnemonic_name
    sys.stdout = oldstdout  # enable output
    print_string = color + print_string + '\033[0m'
    # sys.stdout.flush()
    # sys.stdout.write("\r%s" %print_string)
    print(print_string)
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / 15min_to_db.py View on Github external
#abbreviate data table
        m = m_raw_data.mnemonic(key)

        if key == "SE_ZIMIRICEA":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "SE_ZIMIRICEA_IDLE", dataset)

        elif key == "IMIR_HK_ICE_SEC_VOLT4":
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, "IMIR_HK_ICE_SEC_VOLT4_IDLE", dataset)

        else:
            length = len(value)
            mean = statistics.mean(value)
            deviation = statistics.stdev(value)
            dataset = (float(m.meta['start']), float(m.meta['end']), length, mean, deviation)
            sql.add_data(conn, key, dataset)

jwql

The James Webb Space Telescope Quicklook Project

BSD-3-Clause
Latest version published 6 days ago

Package Health Score

75 / 100
Full package analysis

Popular jwql functions