Ejemplo n.º 1
0
def session_info():

    ### PRINT SESSION INFO TO STDOUT
    ### TO BE USED INSIDE PYTHON SCRIPTS    
    
    import IPython
    import subprocess as sp
    
    for i in IPython.sys_info().splitlines():
        print(i)
        
    for i in sp.run("pip3 freeze", shell=True, stdout=sp.PIPE).stdout.decode().splitlines():
        print(i)    
Ejemplo n.º 2
0
def check():
    from subprocess import Popen, PIPE
    import IPython
    res = "### Informations related to Python ###\n"
    res += IPython.sys_info().replace(
        "': '", ":\t").replace("': u'", ":\t").replace("", "").replace(
            "',", "").replace("{'", "").replace(" '", "").replace("'}", "")
    res += "\n######\n"
    res += "\n### Informations related to R ###\n"
    process = Popen("Rscript -e 'sessionInfo()'",
                    stdout=PIPE,
                    stderr=PIPE,
                    shell=True)
    stdout, stderr = process.communicate()
    res += stdout
    res += "\n######\n"
    return (res)
Ejemplo n.º 3
0
time_string = str(datetime.datetime.now())
tz_string = datetime.datetime.now(datetime.timezone.utc).astimezone().tzname()
print("\n### system time: " + time_string + " " + tz_string)
print("\n########################################")

#################################################
#################################################
import sinfo, IPython

### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
from testHawkesEM import test_HawkesEM

test_HawkesEM()

#################################################
#################################################
print("\n\n########################################")

print("\n### IPython.sys_info():")
print(IPython.sys_info())

print("\n### sinfo.info():")
print(sinfo.sinfo(print_std_lib=True, print_implicit=True))

print("\n########################################")
time_string = str(datetime.datetime.now())
tz_string = datetime.datetime.now(datetime.timezone.utc).astimezone().tzname()
print("\n### system time: " + time_string + " " + tz_string + "\n")
sys.exit(0)
Ejemplo n.º 4
0
import sys
import IPython
import numpy
import scipy
import matplotlib
import networkx
import shapely
import doctest
import sphere
import SimPy

b = eval(IPython.sys_info())
for k in b:
    print k, b[k]
print 'Python   : ' + str(sys.version)
print 'numpy    : ' + str(numpy.__version__)
print 'scipy    : ' + str(scipy.__version__)
print 'matplotlib : ' + str(matplotlib.__version__)
print 'networkx : ' + str(networkx.__version__)
print 'SImPy : ' + str(SimPy.__version__)
Ejemplo n.º 5
0
### save session info to file
### to be used into bash scripts

import IPython
import subprocess as sp

info = IPython.sys_info().splitlines()

for l in info:

    with open('session_info', 'a') as outfile:
        outfile.write(l + '\n')

info = sp.run("pip3 freeze", shell=True,
              stdout=sp.PIPE).stdout.decode().splitlines()

for l in info:

    with open('session_info', 'a') as outfile:
        outfile.write(l + '\n')
Ejemplo n.º 6
0
        color_map = np.zeros((row, column))
        for i in range(len(y_pred)): 
            x = locations[i][0]
            y = locations[i][1]
            if y_actual[i]==y_pred[i]==0:
               color_map[x,y]= 1
            if y_actual[i]==y_pred[i]==1:
               color_map[x,y]= 2
            if y_pred[i]==1 and y_actual[i]!=y_pred[i]:
               color_map[x,y]= 3
            if y_pred[i]==0 and y_actual[i]!=y_pred[i]:
               color_map[x,y]= 4
            return color_map

    color_map = assign_value_for_cmap(y_actual, y_pred, locations) 
    cm  =  generate_cmap ([ 'moccasin', 'black', 'white', 'green', 'red' ]) #one color is assigned to one value
    plt.imshow(color_map, cmap = cm)
    plt.show()
#5. System
#Code to get environement setting

    import IPython
    # print system information (but not packages)
    print(IPython.sys_info())

    # get module information
    !pip freeze > frozen-requirements.txt

    # append system information to file
    with open("frozen-requirements.txt", "a") as file:
        file.write(IPython.sys_info())
Ejemplo n.º 7
0
import sys
import IPython
import numpy
import scipy
import matplotlib
import networkx
import shapely
import doctest
import sphere
import SimPy
import pandas


b = eval(IPython.sys_info())
for k in b:
    print k, b[k]
print 'Python   : '   + str(sys.version)
print 'numpy    : '   + str(numpy.__version__)
print 'scipy    : '   + str(scipy.__version__)
print 'matplotlib : ' + str(matplotlib.__version__)
print 'networkx : '   + str(networkx.__version__)
print 'SImPy : '   + str(SimPy.__version__)
print 'Pandas : '   + str(pandas.__version__)