How to use the jwql.instrument_monitors.miri_monitors.data_trending.utils.sql_interface.create_connection 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 / website / apps / jwql / views.py View on Github external
Returns
    -------
    HttpResponse object
        Outgoing response sent to the webpage
    """

    # Check if GET or POST request
    if request.method == 'POST':

        # Connect to databas
        __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
        package_dir = __location__.split('website')[0]
        database_location = os.path.join(package_dir, 'database')
        database_file = os.path.join(database_location, 'miri_database.db')
        conn = sql.create_connection(database_file)

        c = conn.cursor()

        # check if new item or delete item
        if '_newItem' in request.POST:

            # gat form
            formAdd = addAnomalyForm_Miri(request.POST)
            if formAdd.is_valid():
                Autor = str(formAdd.cleaned_data['name'])
                start = str(formAdd.cleaned_data['starttime'])
                end = str(formAdd.cleaned_data['endtime'])
                plot = str(formAdd.cleaned_data['select_plot'])
                comment = str(formAdd.cleaned_data['comment'])

                # convert time
github spacetelescope / jwql / jwql / website / apps / jwql / views.py View on Github external
request : HttpRequest object
        Incoming request from the webpage

    Returns
    -------
    HttpResponse object
        Outgoing response sent to the webpage
    """

    # Check if GET or POST request
    if request.method == 'POST':
        __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
        package_dir = __location__.split('website')[0]
        database_location = os.path.join(package_dir, 'database')
        database_file = os.path.join(database_location, 'nirspec_database.db')
        conn = sql.create_connection(database_file)  # get variables
        c = conn.cursor()

        # check if new item or delete item
        if '_newItem' in request.POST:

            # gat form
            formAdd = addAnomalyForm_nir(request.POST)
            if formAdd.is_valid():
                Autor = str(formAdd.cleaned_data['name'])
                start = str(formAdd.cleaned_data['starttime'])
                end = str(formAdd.cleaned_data['endtime'])
                plot = str(formAdd.cleaned_data['select_plot'])
                comment = str(formAdd.cleaned_data['comment'])

                # convert time
                start = float(Time(start, format='iso').mjd)
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / plots / power_ice_plot.py View on Github external
def main():

    db_file = "miri_database.db"
    conn = sql.create_connection(db_file)

    plot_power_ice(conn, "output/power_ice.html")

    sql.close_connection(conn)
    print('end')
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200212 dt_cron_job.py View on Github external
def main():
    max_time = 90
    step_time = 0.5

    # get date
    today = date.today()
    day = today - datetime.timedelta(days=10)
    day = day.strftime("%Y-%m-%d")

    # connect database
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')
    conn = sql.create_connection(DATABASE_FILE)

    # define token
    secrets = netrc.netrc()
    mast_token = secrets.authenticators(host)[2]

    day = '2019-10-15'
    day = '2019-12-10'

    # define time
    start_time = Time(day + ' 12:00:00.000', format='iso')
    end_time = Time(day + ' 12:15:00.000', format='iso')

    # define time
    start_time = Time(day + ' 00:00:00.001', format='iso')
    end_time = Time(day + ' 23:59:59.000', format='iso')
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / archive / 20200211 cor_job.py View on Github external
def main():
    max_time = 90
    step_time = 0.5

    # get date
    today = date.today()
    day = today - datetime.timedelta(days=10)
    day = day.strftime("%Y-%m-%d")

    # connect database
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')
    conn = sql.create_connection(DATABASE_FILE)

    # define token
    secrets = netrc.netrc()
    mast_token = secrets.authenticators(host)[2]

    # define time
    start_time = Time(day + ' 12:00:00.000', format='iso')
    end_time = Time(day + ' 12:15:00.000', format='iso')

    # querry data 15 min STARTED
    print("*************************************************************")
    print("* querry data 15 min STARTED")
    print("*************************************************************")

    # go over all nmemonics
    for mnemonic_name in mn.mnemonic_set_15min:
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / plots / volt4_plot.py View on Github external
def main():

    db_file = "miri_database.db"
    conn = sql.create_connection(db_file)

    plot_volt4(conn, "output/volt4.html")

    sql.close_connection(conn)
    print('end')
github spacetelescope / jwql / jwql / instrument_monitors / miri_monitors / data_trending / 15min_to_db.py View on Github external
def main():
    #generate paths
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')

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

    #process every csv file in directory folder
    for path in paths:
        process_file(conn, path)

    #close connection
    sql.close_connection(conn)
    print("done")

jwql

The James Webb Space Telescope Quicklook Project

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis

Popular jwql functions