Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python
- # encoding: utf-8
- """
- april2016-march2017-pessto-stats-plots.py
- =========================================
- :Summary:
- PESSTO Stat Plots
- :Author:
- David Young
- :Date Created:
- March 6, 2017
- Usage:
- april2016-march2017-pessto-stats-plots
- Options:
- -h, --help show this help message
- -v, --version show version
- -s, --settings the settings file
- ..todo::
- @review: when complete pull all general functions and classes into dryxPython
- """
- ## USER DEFINED VARIABLES - ONLY PLACE THIS SCRIPT NEEDS MODIFIED ##
- ################# GLOBAL IMPORTS ####################
- import sys
- import os
- os.environ['TERM'] = 'vt100'
- import readline
- import glob
- import docopt
- from fundamentals import tools, times
- def main(arguments=None):
- """
- The main function used when ``april2016-march2017-pessto-stats-plots.py`` is run as a single script from the cl, or when installed as a cl command
- """
- # setup the command-line util settings
- su = tools(
- arguments=arguments,
- docString=__doc__,
- logLevel="DEBUG",
- options_first=False,
- projectName=False
- )
- arguments, settings, log, dbConn = su.setup()
- import numpy as np
- import matplotlib.pyplot as plt
- import pylab as P
- # # # CLASSIFICATION PHASE DAYS
- # x = (0, 0, 0, 0, 0, 10, 20, 20, 10, 0, 0, 0, 10, 0, 0, 0, 0, 14, -10, 14, -7, -7, 0, -7, 7, 3, -7, 8, -3, 7, 4, 8, -7, 10, -3, 2, 30, -8, 7, 0, 8, 0, -2, 20, 0, -5, 0, 0, 6, 36, 2, 7, 4, 1, 6, 10, -4, 3, 10, 21, -1, 2, 4, 0, 7, 8, 12, 4, 0, -5, -6, -8, 14, 18, 5, -2, -5, 14, 20, 0, 7, 0, 0, 0, 0, 0, 4, -6, -7, 0, 0, 0, 4, 20, 4, 4, -4, 0, 0, 5,
- # 20, -5, 50, 0, 0, -7, 0, -5, 32, 11, 0, 0, -6, -8, 0, 0, 0, 0, 0, 4, -4,
- # 4, -10, 5, 0, 1, -1, -2, 26, 1, 30, 11, 3, -6, 7, 12, 6, -9, 6, 0, 0, 0,
- # 6, -4, 9, 11, 5, -3, 0, 15, 8, -5, 0, 8, -2, -4, 0, 0, -7, 4, 0, 0, 4,
- # 8, 20, 0, -10, 0, 20, -7, -7, -7, -3, 0, 8, 8, 20, 0, 0, -7, -7, 0, 20,
- # 20, -7, -3, -3, 8, -10, -3, 12, 8, 4, 28, 36, 72, 5, -5, -6)
- # bins = [-13, -10, -7, -4, -1, 2, 5, 8, 11, 15, 18, 21, 24, 27, 30, 33]
- # # the histogram of the data with histtype='step'
- # n, bins, patches = P.hist(x, bins, histtype='bar', rwidth=0.8)
- # P.xlabel("Classification Phase Relative to Peak")
- # P.ylabel("# Supernovae")
- # P.figure()
- # P.show()
- # #
- # n_groups = 4
- # x = (63, 57, 99, 57)
- # fig, ax = plt.subplots()
- # index = np.arange(n_groups)
- # bar_width = 0.9
- # opacity = 1.0
- # rects1 = plt.bar(index, x, bar_width,
- # alpha=opacity,
- # color='r')
- # plt.xlabel('Classification Phase')
- # plt.ylabel('# Supernovae')
- # plt.xticks(index + bar_width / 2, ('pre max',
- # 'at max', 'post max', 'unknown'))
- # ax = plt.gca()
- # ax.set_ylim(0, 120)
- # ax.set_xlim(-1, 5)
- # # plt.tight_layout()
- # plt.show()
- import collections
- surveyDict = {}
- surveyDict = collections.OrderedDict(sorted(surveyDict.items()))
- surveyDict['Gaia'] = 72
- surveyDict['ATLAS'] = 67
- surveyDict['PS1'] = 33
- surveyDict['OGLE'] = 31
- surveyDict['ASASSN'] = 28
- surveyDict['SkyMapper'] = 9
- surveyDict['MASTER'] = 4
- surveyDict['BOSS'] = 4
- surveyDict['POSS'] = 4
- surveyDict['PTSS'] = 3
- surveyDict['CRTS'] = 3
- surveyDict['DES'] = 3
- surveyDict['LSQ'] = 3
- surveyDict['ISSP'] = 2
- surveyDict['DLT40'] = 2
- surveyDict['Monard'] = 1
- surveyDict['LOSS'] = 1
- surveyDict['SNHunt'] = 1
- surveyDict['TAROT'] = 1
- x = surveyDict.values()
- labels = surveyDict.keys()
- n_groups = len(surveyDict)
- fig, ax = plt.subplots()
- index = np.arange(n_groups)
- bar_width = 0.9
- opacity = 1.0
- rects1 = plt.bar(index, x, bar_width,
- alpha=opacity,
- color='r')
- plt.xlabel('Discovery Survey')
- plt.ylabel('# Supernovae')
- plt.xticks(index + bar_width / 2, labels, rotation=60)
- ax = plt.gca()
- # ax.set_ylim(0, 120)
- ax.set_xlim(-1, n_groups + 1)
- # plt.tight_layout()
- plt.show()
- # import collections
- # transientDict = {}
- # transientDict = collections.OrderedDict(sorted(transientDict.items()))
- # transientDict['SN'] = 220
- # transientDict['Variable star'] = 28
- # transientDict['unknown'] = 13
- # transientDict['CV'] = 9
- # transientDict['AGN'] = 4
- # transientDict['SLSN'] = 3
- # transientDict['Galaxy'] = 2
- # transientDict['Impostor'] = 1
- # x = transientDict.values()
- # labels = transientDict.keys()
- # n_groups = len(transientDict)
- # fig, ax = plt.subplots()
- # index = np.arange(n_groups)
- # bar_width = 0.9
- # opacity = 1.0
- # rects1 = plt.bar(index, x, bar_width,
- # alpha=opacity,
- # color='r')
- # plt.xlabel('Spectral Classification')
- # plt.ylabel('# Transients')
- # plt.xticks(index + bar_width / 2, labels, rotation=60)
- # ax = plt.gca()
- # # ax.set_ylim(0, 120)
- # ax.set_xlim(-1, n_groups + 1)
- # # plt.tight_layout()
- # plt.show()
- # import collections
- # transientDict = {}
- # transientDict = collections.OrderedDict(sorted(transientDict.items()))
- # transientDict['SN Ia'] = 159
- # transientDict['SN II'] = 37
- # transientDict['SN Ic'] = 7
- # transientDict['SN IIb'] = 6
- # transientDict['SN IIn'] = 6
- # transientDict['SLSN Ic'] = 2
- # transientDict['SN Ibc'] = 2
- # transientDict['SN IIP'] = 1
- # transientDict['SLSN II'] = 1
- # transientDict['SN I'] = 1
- # transientDict['SN Ib'] = 1
- # x = transientDict.values()
- # labels = transientDict.keys()
- # n_groups = len(transientDict)
- # fig, ax = plt.subplots()
- # index = np.arange(n_groups)
- # bar_width = 0.9
- # opacity = 1.0
- # rects1 = plt.bar(index, x, bar_width,
- # alpha=opacity,
- # color='r')
- # plt.xlabel('Spectral Classification')
- # plt.ylabel('# Supernovae')
- # plt.xticks(index + bar_width / 2, labels, rotation=60)
- # ax = plt.gca()
- # ax.set_ylim(0, 170)
- # ax.set_xlim(-1, n_groups + 1)
- # # plt.tight_layout()
- # plt.show()
- return
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment