Exemple #1
0
# Django settings for netshed project.
import os
from lib.utilities import connect_mongo_session, get_config

connect_mongo_session()

GREYLIST_HOST = get_config('greylist', 'host')
GREYLIST_USER = get_config('greylist', 'user')
GREYLIST_PASS = get_config('greylist', 'password')
GREYLIST_DB   = get_config('greylist', 'db')

DATABASES = {
    'default': {
        'USER': '******',
        'NAME': 'dummy',
        'HOST': 'localhost',
        'ENGINE': 'dummy',
        'USER': '******',
        'PASSWORD': '',
    },

    'dmca': {
        'NAME': get_config('dmca', 'name'),
        'HOST': get_config('dmca', 'host'),
        'ENGINE': 'django.db.backends.mysql',
        'USER': get_config('dmca', 'user'),
        'PASSWORD': get_config('dmca', 'password'),
        'PORT': get_config('dmca', 'port'),
    },

    'net': {
# This is the location of the config file, this used to be set by argparse, but users are not to be trusted
config = "/home/mrmisanthropy/Projects/pdi_scientific/pdi_config.cfg"
# Separate out the arguments from the cli
dataPath = args.fileNames[0]
channel = args.channel[0]

# Load event file
events, tLims = ut.get_event_file(dataPath, channel)

# Set the rest of the parameters before initialization
# Note, drops have been observed in VOCALS runs which are below 2 microns, the lower limit was then altered to 1.1
dLims = (1.1, max(events['size']) + 5.)
dBins = 128

params = ut.get_config(config)
sFreq = params['sfreq']
# Initialize timeseries object
flight = ts.TimeSeries(events['arrival time'], events['size'], tLims, dLims,
                       sFreq, dBins)

# Now initialize computation of ELD
eld_coeff, dFit = eld.effective_laser_diameter(events, flight.size_param)

#Now initialize the computation of meteorological variables
# TODO: Figure out how you're passing Alen around, this is some bush league shit
lwc, conc, vol, PVD = met.met_comp(flight, eld_coeff, events['velocity'],
                                   params)

# Now run the visualization routines to check our work
atime = flight.rep_atime
Exemple #3
0
# Django settings for netshed project.
import os
from lib.utilities import connect_mongo_session, get_config

connect_mongo_session()

GREYLIST_HOST = get_config('greylist', 'host')
GREYLIST_USER = get_config('greylist', 'user')
GREYLIST_PASS = get_config('greylist', 'password')
GREYLIST_DB = get_config('greylist', 'db')

DATABASES = {
    'default': {
        'USER': '******',
        'NAME': 'dummy',
        'HOST': 'localhost',
        'ENGINE': 'dummy',
        'USER': '******',
        'PASSWORD': '',
    },
    'dmca': {
        'NAME': get_config('dmca', 'name'),
        'HOST': get_config('dmca', 'host'),
        'ENGINE': 'django.db.backends.mysql',
        'USER': get_config('dmca', 'user'),
        'PASSWORD': get_config('dmca', 'password'),
        'PORT': get_config('dmca', 'port'),
    },
    'net': {
        'NAME': get_config('net', 'name'),
        'HOST': get_config('net', 'host'),
import praw
import logging
from time import sleep
from datetime import datetime
from lib import utilities

seen_log_file = './logs/seen.csv'
nothanks_log_file = './logs/nothanks.csv'
error_log_file = './logs/errors.csv'

accepted_filter_file = './accepted_keywords.txt'
forbidden_filter_file = './forbidden_keywords.txt'

# Get configs 
user_agent, client_id, client_secret, username, password = utilities.get_config()

# Get past data
seen_list = utilities.get_old_data(seen_log_file, nothanks_log_file)

# Get filters
accepted_keywords, forbidden_keywords = utilities.get_filters(accepted_filter_file, forbidden_filter_file)


# Get praw object
reddit = praw.Reddit(user_agent=user_agent,
                     client_id=client_id, client_secret=client_secret,
                     username=username, password=password)

script_running = True

total_seen = len(seen_list)