Skip to content

Instantly share code, notes, and snippets.

@inclement
Created November 11, 2014 22:03
Show Gist options
  • Select an option

  • Save inclement/9333c6f0e3858aadbf5a to your computer and use it in GitHub Desktop.

Select an option

Save inclement/9333c6f0e3858aadbf5a to your computer and use it in GitHub Desktop.
import sys
sys.path.append('/home/asandy')
from matplotlib import rc
rc('font', **{'family':'serif','serif':['Computer Modern Roman']})
rc('text', usetex=True)
rc('axes', **{'labelsize':10})
rc('xtick', **{'labelsize':10})
rc('ytick', **{'labelsize':10})
rc('legend', **{'fontsize':10})
import json
import cPickle
import numpy as n
import matplotlib.pyplot as plt
fig, axes = plt.subplots(ncols=2)
ax1, ax2 = axes
determinants = range(1,5)
min_cs = range(1,5)
hyp_vols = range(1,5)
from pyknot2.catalogue.database import Knot
all_knots = Knot.select()
min_cs = []
determinants = []
hyp_vols = []
print 'Retrieving invariants'
for knot in all_knots:
min_cs.append(knot.min_crossings)
determinants.append(knot.determinant)
# hyp_vols.append(knot.hyperbolic_volume)
# print '...done'
# hyp_vols = [(float(v) if (v is not None and v[0] != 'N') else None) for v in hyp_vols]
print 'Converted hyp_vols to floats'
print 'n is', n
print n.log10(5)
logds = n.log10(determinants)
print 'did logds'
ax1.scatter(min_cs, logds, s=1.5, color='blue', alpha=0.5)
ax2.scatter(min_cs, n.log10(hyp_vols), s=1.5, color='green',
alpha=0.5)
fig.set_size_inches(6, 2.85)
fig.tight_layout()
fig.savefig('graph-topologicalmethods-knottable_behaviour.png', dpi=300)
fig.savefig('graph-topologicalmethods-knottable_behaviour.pdf', dpi=300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment