def getParsedPrefs(): cfg = loadConfig() args = argParser.parse_args() prefsDict = dict() prefsDict['currBoard'] = args.board if args.images == None: prefsDict['asciiImagesEnable'] = cfg['images']['enableAsciiImages'] else: prefsDict['asciiImagesEnable'] = args.images if args.op_only == None: prefsDict['ignoreReplies'] = cfg['display']['onlyShowOP'] else: prefsDict['ignoreReplies'] = args.op_only if args.width == None: prefsDict['termWidth'] = cfg['display']['terminalWidth'] else: prefsDict['termWidth'] = args.width if args.indent == None: prefsDict['replyIndent'] = cfg['display']['replyIndent'] else: prefsDict['replyIndent'] = args.indent if args.wh_ratio == None: prefsDict['asciiWidthHeightRatio'] = cfg['images']['asciiWidthHeightRatio'] else: prefsDict['asciiWidthHeightRatio'] = args.wh_ratio return prefsDict
def getParsedPrefs(): cfg = loadConfig() args = argParser.parse_args() prefsDict = dict() prefsDict['currBoard'] = args.board if args.images == None: prefsDict['asciiImagesEnable'] = cfg['images']['enableAsciiImages'] else: prefsDict['asciiImagesEnable'] = args.images if args.op_only == None: prefsDict['ignoreReplies'] = cfg['display']['onlyShowOP'] else: prefsDict['ignoreReplies'] = args.op_only if args.width == None: prefsDict['termWidth'] = cfg['display']['terminalWidth'] else: prefsDict['termWidth'] = args.width if args.indent == None: prefsDict['replyIndent'] = cfg['display']['replyIndent'] else: prefsDict['replyIndent'] = args.indent if args.wh_ratio == None: prefsDict['asciiWidthHeightRatio'] = cfg['images'][ 'asciiWidthHeightRatio'] else: prefsDict['asciiWidthHeightRatio'] = args.wh_ratio return prefsDict
def getSubjectsWithSvgFiles(): cfg = loadConfig() directory = cfg['dataLoc']['svgDir'] extension = 'svg' subjListLoc = cfg['dataLoc']['subjList'] with open(subjListLoc, 'r') as subjData: fullSubjList = cPickle.load(subjData) subjList = [] fileList = glob.glob(directory + '/' + '*.' + extension) for fileName in fileList: fnSplit = fileName.split('/') fnDotted = fnSplit[len(fnSplit) - 1] fnDSplit = fnDotted.split('.') fnClean = fnDSplit[0] subjList.append(fnClean) intersectList = [val for val in subjList if val in fullSubjList] intersectList.sort() return intersectList
def saveCourseDict(): startTime = time.clock() cfg = loadConfig() season = cfg['oneStop']['season'] year = cfg['oneStop']['year'] courseDataDir = cfg['dataLoc']['courseDataDir'] dataExt = cfg['dataLoc']['courseDataExt'] # **** is the abbreviation for 'all subjects' oneStopLookupUrl = oneStopUtils.getOneStopSearchUrl(season, year, '****') timeScraped = unixTime() # retrieve html from OneStop htmlObj = urllib2.urlopen(oneStopLookupUrl) rawHtml = htmlObj.read() courseDict = bsParseHtml(rawHtml) with open(courseDataDir + '/' + str(timeScraped) + '.' + dataExt, 'w') as dataOut: cPickle.dump(courseDict, dataOut) totalTime = time.clock() - startTime return totalTime
import sqlite3 as lite import sys from scipy.sparse import lil_matrix import cPickle import loadConfig FILE = '' DATABASE = '/Users/cyriltrosset/Desktop/SPECIAL_PROJ_DB/database-50.sqlite' APP_KEY = {} APP_SECRET = {} loadConfig.loadConfig(FILE,DATABASE,APP_KEY,APP_SECRET) con = lite.connect(DATABASE) con.row_factory = lite.Row cur = con.cursor() cur.execute("SELECT * FROM ProfilesIds") rows = cur.fetchall() profilesMatrix = lil_matrix((132,1)) for row in rows: profilesMatrix[row['id'],0] = row['idProfile'] f = open('profilesMatrix.pkl','wb') cPickle.dump(profilesMatrix,f,-1) f.close()
import string import random import os # read yaml config: proxy data directory from loadConfig import loadConfig cfg = loadConfig() dataDir = cfg['proxy']['dataDir'] # taken from http://stackoverflow.com/a/2257449 # takes in: size (int) # returns: a random string of uppercase letters and digits of length size def genRandomID(size): allChars = string.ascii_uppercase + string.digits return ''.join(random.choice(allChars) for x in range(size)) # takes in: a filename # returns: true if dataDir/filename exists, false otherwise def fileExists(filename): filePath = dataDir + '/' + filename return os.path.isfile(filePath) # takes in: length of random filename to generate # returns: tuple of (filename - .extension, extension) # example: # >>> genUnusedFilename(8, 'dat') # '8JCB980K.dat' # (dataDir/8JCB980K.dat does not exist yet)
import os import sys import flask import threadParse import parseForWeb import urllib2 from loadConfig import loadConfig from htmlParse import stripTags # make sure config file exists try: cfg = loadConfig() except IOError, err: print 'Error reading config file:', err print ' (Maybe you didn\'t copy sampleConfig.yml to config.yml?)' sys.exit() # read yaml config: server devel mode, port develMode = cfg['server']['develMode'] serverPort = cfg['server']['port'] analyticsEnabled = cfg['server']['analytics'] app = flask.Flask(__name__) app.debug = develMode boardList = [['a', 'c', 'w', 'm', 'cgl', 'cm', 'f', 'n', 'jp', 'vp'], ['v', 'vg', 'co', 'g', 'tv', 'k', 'o', 'an', 'tg', 'sp', 'sci', 'int'], ['i', 'po', 'p', 'ck', 'ic', 'wg', 'mu', 'fa', 'toy', '3', 'diy', 'wsg'], ['s', 'hc', 'hm', 'h', 'e', 'u', 'd', 'y', 't', 'hr', 'gif'], ['q', 'trv', 'fit', 'x', 'lit', 'adv', 'mlp'], ['b', 'r', 'r9k', 'pol', 'soc']] @app.route('/') def index(): if analyticsEnabled:
debris versus clean area batch Create a list that groups the fits files by date. Run LINT on pre-grouped (by date) fits files. Plot the debris accumulation over time as: scatter plot To do: -add logger -add help command in optional arguments -check to see if dependencies are installed -add Try command for errors -mask bad pixel columns -test installation code ------------------------------------------------------------------------------------------------------------------------------ This research makes use of: -Astropy, a community-developed core Python package for Astronomy (Astropy Collaboration, 2013). -Bertin, E. & Arnouts, S. 1996: SExtractor: Software for source extraction, Astronomy & Astrophysics Supplement 317, 393 -PyDev for Eclipse 4.5.5.201603221110 org.python.pydev.feature.feature.group Fabio Zadrozny -Hunter, J. D. Matplotlib: A 2D graphics environment. 2007 ''' # Import ####################################################################################### from loadConfig import loadConfig from batch import timePlot ################################################################################################ if __name__ == '__main__': #Load dictionary of user inputs (from LINT.config using loadConfig()) and begin processing. Using loadConfig to load variables from LINT.config into dictonary. timePlot(loadConfig())