Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dcclab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
from .utils import *
from .DCCExceptions import *

__version__ = "1.1.1"
__version__ = "1.1.2"
__author__ = "Daniel Cote <dccote@cervo.ulaval.ca>"
2 changes: 2 additions & 0 deletions dcclab/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .computeengine import *
from .labpca import *
3 changes: 1 addition & 2 deletions dcclab/analysis/computeengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from threading import Thread
from queue import Empty
import time
from json import dumps
import signal
from database import *
from dcclab.database import *

"""
A class to run many tasks in parallel when they are mostly independent. This engine is perfectly
Expand Down
4 changes: 2 additions & 2 deletions dcclab/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def connect(self):
pwd = keyring.get_password(serviceName, self.mysqlUser)
if pwd is None:
raise Exception(""" Set the password in the system password manager on the command line with:
python -m keyring set {0} {1}""".format(serviceName, self.mysqlUser))
{2} -m keyring set {0} {1}""".format(serviceName, self.mysqlUser, sys.executable))
else:
pwd = None

Expand Down Expand Up @@ -524,7 +524,7 @@ def connect(self):
pwd = keyring.get_password(serviceName, self.mysqlUser)
if pwd is None:
raise Exception(""" Set the password in the system password manager on the command line with:
python -m keyring set {0} {1}""".format(serviceName, self.mysqlUser))
{2} -m keyring set {0} {1}""".format(serviceName, self.mysqlUser, sys.executable))
else:
pwd = None

Expand Down
1 change: 0 additions & 1 deletion dcclab/database/labdatadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import numpy as np
import pandas as pd
import re
from collections.abc import Iterable

class LabdataDB(MySQLDatabase):
"""
Expand Down
2 changes: 0 additions & 2 deletions dcclab/image/cziUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import xml.etree.ElementTree as ET
import os
import fnmatch
import multiprocessing
import warnings
from concurrent.futures import ThreadPoolExecutor

"""
Python script containing utility functions to be used for handling .czi image.
Expand Down
1 change: 0 additions & 1 deletion dcclab/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import PIL.Image
import matplotlib.pyplot as plt
import os
import re
from typing import List, Union


Expand Down
Empty file added dcclab/ml/__init__.py
Empty file.
1 change: 0 additions & 1 deletion dcclab/ml/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import List
import pandas as pd
import numpy as np
import json
import os

"""
Expand Down
70 changes: 70 additions & 0 deletions dcclab/tests/testComputeEngine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import env
import unittest
from dcclab.analysis import *

def calculateFactorial(inputQueue, outputQueue):
try:
value = inputQueue.get_nowait()
product = 1
for i in range(value):
product *= (i+1)
outputQueue.put( (value, product) )
except Empty as err:
pass # not an error

def slowCalculation(inputQueue, outputQueue):
try:
value = inputQueue.get_nowait()
time.sleep(3)
outputQueue.put( value )
except Empty as err:
pass # not an error

def processSimple(queue):
while not queue.empty():
try:
(n, nfactorial) = queue.get_nowait()
print('Just finished calculating {0}!'.format(n))
except Empty as err:
break # we are done


class MyTestCase(env.DCCLabTestCase):
def testThreads1(self):
N = 11
print("Calculating n! for numbers 0 to {0} (every calculation is independent)".format(N - 1))
print("======================================================================")

print("Using threads: fast startup time appropriate for quick calculations")
engine = ComputeEngine(useThreads=True)
for i in range(N):
engine.inputQueue.put(i)
engine.compute(target=calculateFactorial)

def testProcesses1(self):
N = 11
print("Using processes: long startup time appropriate for longer calculations")
engine = ComputeEngine(useThreads=False)
for i in range(N):
engine.inputQueue.put(i)
engine.compute(target=calculateFactorial)

def testThreadsProcessTask(self):
N = 11
print("Using threads and replacing the processTaskResult function")
engine = ComputeEngine(useThreads=True)
for i in range(N):
engine.inputQueue.put(i)
engine.compute(target=calculateFactorial, processTaskResults=processSimple)
@unittest.skip
def testProcessesVeryLong(self):
N = 11
print("Using processes with very long calculations and timeout")
engine = ComputeEngine(useThreads=False)
for i in range(N):
engine.inputQueue.put(i)
engine.compute(target=slowCalculation, timeoutInSeconds=2)


if __name__ == '__main__':
unittest.main()
10 changes: 4 additions & 6 deletions dcclab/utils/cafeine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
import keyring
from contextlib import redirect_stderr

import sys

class Cafeine:
def __init__(self, username='dcclab'):
Expand All @@ -12,11 +12,9 @@ def startMySQLTunnel(self, remote_bind_address="127.0.0.1"):
password = keyring.get_password("cafeine2-ssh", "dcclab")

if password is None:
print("""
Run the following command in the terminal to add the dcclab password to your Keychain:
keyring set cafeine2-ssh dcclab
(you will be prompted for the password)
""")
print("""Run the following command in the terminal to add the dcclab password to your Keychain:
{0} -m keyring set cafeine2-ssh dcclab
(you will be prompted for the password)""".format(sys.executable))
exit(1)

import io
Expand Down
2 changes: 1 addition & 1 deletion dcclab/utils/pathPattern.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
import os
from pathlib import Path, PureWindowsPath, PurePosixPath
from pathlib import Path, PurePosixPath


class PathPattern:
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
=============
rm dist/*; python setup.py sdist --formats=gztar,zip
or
rm dist/*; python setup.py sdist bdist_wheel; python -m twine upload dist/*
rm dist/*; python3 setup.py sdist; python3 -m twine upload dist/*

"""

setuptools.setup(
name="dcclab",
version="1.1.1",
version="1.1.2",
url="https://github.com/DCC-Lab/PyDCCLab",
author="Daniel Côté, Gabriel Genest, Mathieu Fournier, Ludovick Bégin",
author_email="dccote@cervo.ulaval.ca",
Expand All @@ -24,7 +24,10 @@
license='MIT',
keywords='image analysis stack movies',
packages=setuptools.find_packages(),
install_requires=['keyring', 'sshtunnel', 'mysql-connector-python', 'requests', 'matplotlib','numpy','scikit-image','scipy','czifile >= 2019.6.18','tifffile','read-lif','tables','xlwt','xlrd','seaborn','imagecodecs','deprecated'],
install_requires=['keyring', 'gsheet-keyring', 'sshtunnel', 'mysql-connector-python',
'requests', 'matplotlib','numpy','scikit-image','scipy',
'czifile >= 2019.6.18','tifffile','read-lif','tables','xlwt',
'xlrd','seaborn','imagecodecs','deprecated'],
python_requires='>=3',
package_data={
# If any package contains *.txt or *.rst files, include them:
Expand Down