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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ipynb_checkpoints/
**/.ipynb_checkpoints/
**/__pycache__/
**/*.dll
**/*.so
**/*.png
**/data/
**/fits/
126 changes: 94 additions & 32 deletions ht-and-detect-in-frame-set.ipynb

Large diffs are not rendered by default.

37 changes: 18 additions & 19 deletions ht-and-detect.ipynb

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from setuptools import setup, Extension
import numpy

# Define the extension module
ext = Extension(
'libszm',
sources=['szm.c'],
include_dirs=[numpy.get_include()],
language='c++',
extra_compile_args=['-std=c++11', '-O3']
)

setup(
name='libszm',
ext_modules=[ext],
zip_safe=False
)
11 changes: 9 additions & 2 deletions szm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
from ctypes import *
import os
# compilation
# g++ -fPIC -shared -o libszm.so szm.c
lizm = CDLL(os.path.abspath('libszm.so'))
# Linux: g++ -fPIC -shared -o libszm.so szm.c
# Windows: g++ -shared -static -o libszm.dll szm.c
if os.name == 'nt': # Windows
try:
lizm = CDLL(os.path.abspath('libszm.dll'))
except:
lizm = WinDLL(os.path.abspath('libszm.dll'))
else: # Linux/Unix
lizm = CDLL(os.path.abspath('libszm.so'))

lizm.szm.argtypes = (POINTER(c_ushort),c_int,c_int,
POINTER(c_float),POINTER(c_float),
Expand Down