Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions knotid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
import os, sys, subprocess
import numpy, networkx, sympy, appdirs, requests, tqdm
_thisdir = os.path.split(os.path.abspath(__file__))[0]

try:
import planarity
except ModuleNotFoundError:
pass

try:
import peewee
except ModuleNotFoundError:
print('peewee not installed')

try:
import vizpy
except ModuleNotFoundError:
print('vizpy not installed')

sys.path.append(_thisdir)
import pyknotid
print(pyknotid)
import pyknotid.spacecurves as sp
print(sp)
import pyknotid.make as mk
print(mk)

def test():
k = sp.SpaceCurve(mk.trefoil())
print(k)
g2 = k.gauss_code(recalculate=True, try_cython=False)
print(g2)

def test_random():
from random import uniform
points = [ [uniform(-1,1),uniform(-1,1),uniform(-1,1)] for i in range(10)]
k = sp.SpaceCurve( points )
print(k)
g2 = k.gauss_code(recalculate=True, try_cython=False)
print(g2)

if '--test' in sys.argv:
test()
test_random()
15 changes: 9 additions & 6 deletions pyknotid/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

from __future__ import division

import vispy
try:
import vispy
except ModuleNotFoundError:
vispy = None
# vispy.use('PyQt5')

import numpy as n
Expand All @@ -29,11 +32,11 @@
from pyknotid.utils import ensure_shape_tuple, vprint
import random
from colorsys import hsv_to_rgb

try:
from vispy.visuals.transforms import MatrixTransform
except (AttributeError, ImportError):
from vispy.visuals.transforms import AffineTransform as MatrixTransform
if vispy:
try:
from vispy.visuals.transforms import MatrixTransform
except (AttributeError, ImportError):
from vispy.visuals.transforms import AffineTransform as MatrixTransform

vispy_canvas = None

Expand Down