prompt
large_stringlengths 72
9.34k
| completion
large_stringlengths 0
7.61k
|
---|---|
<|file_name|>Gauss2.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:29:34 2017
@author: ishort
"""
import math
""" procedure to generate Gaussian of unit area when passed a FWHM"""
#IDL: PRO GAUSS2,FWHM,LENGTH,NGAUS
def <|fim_middle|>(fwhm, length):
#length=length*1l & FWHM=FWHM*1l
#NGAUS=FLTARR(LENGTH)
ngaus = [0.0 for i in range(length)]
#This expression for CHAR comes from requiring f(x=0.5*FWHM)=0.5*f(x=0):
#CHAR=-1d0*ALOG(0.5d0)/(0.5d0*0.5d0*FWHM*FWHM)
char = -1.0 * math.log(0.5) / (0.5*0.5*fwhm*fwhm)
#This expression for AMP (amplitude) comes from requiring that the
#area under the gaussian is unity:
#AMP=SQRT(CHAR/PI)
amp = math.sqrt(char/math.pi)
#FOR CNT=0l,(LENGTH-1) DO BEGIN
# X=(CNT-LENGTH/2)*1.d0
# NGAUS(CNT)=AMP*EXP(-CHAR*X^2)
#ENDFOR
for cnt in range(length):
x = 1.0 * (cnt - length/2)
ngaus[cnt] = amp * math.exp(-1.0*char*x*x)
return ngaus
<|fim▁end|> | gauss2 |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
<|fim▁hole|><|fim▁end|> | x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y)) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
<|fim_middle|>
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
''' |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
<|fim_middle|>
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | pass |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
<|fim_middle|>
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''int: Minimum number of points needed to define the feature.'''
pass |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
<|fim_middle|>
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
<|fim_middle|>
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
''' |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
<|fim_middle|>
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y)) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
<|fim_middle|>
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | self.radius,self.xc,self.yc = self.__gen(points) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
<|fim_middle|>
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
<|fim_middle|>
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
<|fim_middle|>
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y)) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
<|fim_middle|>
<|fim▁end|> | '''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y)) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
<|fim_middle|>
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | self.a,self.k,self.b = self.__gen(points) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
<|fim_middle|>
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | '''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
<|fim_middle|>
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | ''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
<|fim_middle|>
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
<|fim_middle|>
<|fim▁end|> | '''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y)) |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def <|fim_middle|>(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | __init__ |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def <|fim_middle|>(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | min_points |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def <|fim_middle|>(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | points_distance |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def <|fim_middle|>(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | print_feature |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def <|fim_middle|>(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | __init__ |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def <|fim_middle|>(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | __gen |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def <|fim_middle|>(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | points_distance |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def <|fim_middle|>(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | print_feature |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def <|fim_middle|>(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | __init__ |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def <|fim_middle|>(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | __gen |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def <|fim_middle|>(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | exponential |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def <|fim_middle|>(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def print_feature(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | points_distance |
<|file_name|>features.py<|end_file_name|><|fim▁begin|>from __future__ import division
import abc
import numpy as n
import scipy.linalg as linalg
import scipy.optimize as opt
import scipy.spatial.distance as dist
class Feature(object):
'''
Abstract class that represents a feature to be used
with :py:class:`pyransac.ransac.RansacFeature`
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractproperty
def min_points(self):
'''int: Minimum number of points needed to define the feature.'''
pass
@abc.abstractmethod
def points_distance(self,points):
'''
This function implements a method to compute the distance
of points from the feature.
Args:
points (numpy.ndarray): a numpy array of points the distance must be
computed of.
Returns:
distances (numpy.ndarray): the computed distances of the points from the feature.
'''
pass
@abc.abstractmethod
def print_feature(self,num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
class Circle(Feature):
'''
Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0`
'''
min_points = 3
'''int: Minimum number of points needed to define the circle (3).'''
def __init__(self,points):
self.radius,self.xc,self.yc = self.__gen(points)
def __gen(self,points):
'''
Compute the radius and the center coordinates of a
circumference given three points
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
(tuple): A 3 elements tuple that contains the circumference radius
and center coordinates [radius,xc,yc]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
# Linear system for (D,E,F) in circle
# equations: D*xi + E*yi + F = -(xi**2 + yi**2)
# where xi, yi are the coordinate of the i-th point.
# Generating A matrix
A = n.array([(x,y,1) for x,y in points])
# Generating rhs
rhs = n.array([-(x**2+y**2) for x,y in points])
try:
#Solving linear system
D,E,F = linalg.lstsq(A,rhs)[0]
except linalg.LinAlgError:
raise RuntimeError('Circle calculation not successful. Please\
check the input data, probable collinear points')
xc = -D/2
yc = -E/2
r = n.sqrt(xc**2+yc**2-F)
return (r,xc,yc)
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
xa = n.array([self.xc,self.yc]).reshape((1,2))
d = n.abs(dist.cdist(points,xa) - self.radius)
return d
def print_feature(self, num_points):
'''
This method returns an array of x,y coordinates for
points that are in the feature.
Args:
num_points (numpy.ndarray): the number of points to be returned
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
theta = n.linspace(0,2*n.pi,num_points)
x = self.xc + self.radius*n.cos(theta)
y = self.yc + self.radius*n.sin(theta)
return n.vstack((x,y))
class Exponential (Feature):
'''
Feature Class for an exponential curve :math:`y=ax^{k} + b`
'''
min_points = 3
def __init__(self,points):
self.a,self.k,self.b = self.__gen(points)
def __gen(self,points):
'''
Compute the three parameters that univocally determine the
exponential curve
Args:
points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters
[a,k,b]
Raises:
RuntimeError: If the circle computation does not succeed
a RuntimeError is raised.
'''
def exponential(x,points):
''' Non linear system function to use
with :py:func:`scypy.optimize.root`
'''
aa = x[0]
nn = x[1]
bb = x[2]
f = n.zeros((3,))
f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1]
f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1]
f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1]
return f
exp = opt.root(exponential,[1,1,1],points,method='lm')['x']
return exp
def points_distance(self,points):
r'''
Compute the distance of the points from the feature
:math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}`
Args:
points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point.
Returns:
d (numpy.ndarray): the computed distances of the points from the feature.
'''
x = points[:,0]
xa = n.array([x,self.a*n.power(x,self.k)+self.b])
xa = xa.T
d = dist.cdist(points,xa)
return n.diag(d)
def <|fim_middle|>(self, num_points, a,b):
'''
This method returns an array of x,y coordinates for
points that are in the feature in the interval [a,b].
Args:
num_points (numpy.ndarray): the number of points to be returned
a (float): left end of the interval
b (float): right end of the interval
Returns:
coords (numpy.ndarray): a num_points x 2 numpy array that contains
the points coordinates
'''
x = n.linspace(a,b,num_points)
y = self.a*x**self.k + self.b
return n.vstack((x,y))
<|fim▁end|> | print_feature |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''<|fim▁hole|> if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)<|fim▁end|> | lock_wait = storage_config.get('lock_wait', None) |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
<|fim_middle|>
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)
<|fim▁end|> | '''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
<|fim_middle|>
<|fim▁end|> | '''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
) |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
<|fim_middle|>
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)
<|fim▁end|> | return archive |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
<|fim_middle|>
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)
<|fim▁end|> | list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def <|fim_middle|>(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)
<|fim▁end|> | resolve_archive_name |
<|file_name|>list.py<|end_file_name|><|fim▁begin|>import logging
from borgmatic.borg.flags import make_flags, make_flags_from_arguments
from borgmatic.execute import execute_command
logger = logging.getLogger(__name__)
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'
def resolve_archive_name(repository, archive, storage_config, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, an archive name, a storage config dict, a local Borg
path, and a remote Borg path, simply return the archive name. But if the archive name is
"latest", then instead introspect the repository for the latest successful (non-checkpoint)
archive, and return its name.
Raise ValueError if "latest" is given but there are no archives in the repository.
'''
if archive != "latest":
return archive
lock_wait = storage_config.get('lock_wait', None)
full_command = (
(local_path, 'list')
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags('glob-archives', BORG_EXCLUDE_CHECKPOINTS_GLOB)
+ make_flags('last', 1)
+ ('--short', repository)
)
output = execute_command(full_command, output_log_level=None, borg_local_path=local_path)
try:
latest_archive = output.strip().splitlines()[-1]
except IndexError:
raise ValueError('No archives found in the repository')
logger.debug('{}: Latest archive is {}'.format(repository, latest_archive))
return latest_archive
def <|fim_middle|>(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
'''
Given a local or remote repository path, a storage config dict, and the arguments to the list
action, display the output of listing Borg archives in the repository or return JSON output. Or,
if an archive name is given, listing the files in that archive.
'''
lock_wait = storage_config.get('lock_wait', None)
if list_arguments.successful:
list_arguments.glob_archives = BORG_EXCLUDE_CHECKPOINTS_GLOB
full_command = (
(local_path, 'list')
+ (
('--info',)
if logger.getEffectiveLevel() == logging.INFO and not list_arguments.json
else ()
)
+ (
('--debug', '--show-rc')
if logger.isEnabledFor(logging.DEBUG) and not list_arguments.json
else ()
)
+ make_flags('remote-path', remote_path)
+ make_flags('lock-wait', lock_wait)
+ make_flags_from_arguments(
list_arguments, excludes=('repository', 'archive', 'paths', 'successful')
)
+ (
'::'.join((repository, list_arguments.archive))
if list_arguments.archive
else repository,
)
+ (tuple(list_arguments.paths) if list_arguments.paths else ())
)
return execute_command(
full_command,
output_log_level=None if list_arguments.json else logging.WARNING,
borg_local_path=local_path,
)
<|fim▁end|> | list_archives |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):<|fim▁hole|> super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)<|fim▁end|> | |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
<|fim_middle|>
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
<|fim_middle|>
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run() |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
<|fim_middle|>
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
<|fim_middle|>
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
<|fim_middle|>
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
<|fim_middle|>
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run() |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
<|fim_middle|>
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
<|fim_middle|>
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
<|fim_middle|>
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
<|fim_middle|>
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334' |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
<|fim_middle|>
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
<|fim_middle|>
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
<|fim_middle|>
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334' |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
<|fim_middle|>
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | pass |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
<|fim_middle|>
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | print('SCOOP mode functional!')
return False |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
<|fim_middle|>
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | print('SCOOP NOT running!')
return True |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | opt_args = parse_args()
run_suite(**opt_args) |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def <|fim_middle|>():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | scoop_not_functional_check |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def <|fim_middle|>(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def <|fim_middle|>(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_niceness |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def <|fim_middle|>(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def <|fim_middle|>(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_graceful_exit |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def <|fim_middle|>(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def <|fim_middle|>(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_niceness |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def <|fim_middle|>(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def <|fim_middle|>(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_graceful_exit |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def <|fim_middle|>(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def <|fim_middle|>(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_graceful_exit |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def <|fim_middle|>(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | set_mode |
<|file_name|>environment_scoop_test.py<|end_file_name|><|fim▁begin|>__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.integration.environment_test import EnvironmentTest, ResultSortTest
from pypet.tests.integration.environment_multiproc_test import check_nice
import pypet.pypetconstants as pypetconstants
from pypet.tests.testutils.ioutils import parse_args, run_suite
from pypet.tests.testutils.data import unittest
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed and running')
class MultiprocSCOOPNetqueueTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPSortLocalTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop'
def set_mode(self):
super(MultiprocSCOOPSortLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.freeze_input = False
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPLocalTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPLocalTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_LOCAL
self.multiproc = True
self.freeze_input = True
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def test_niceness(self):
pass
# def test_run(self):
# return super(MultiprocSCOOPLocalTest, self).test_run()
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocFrozenSCOOPSortLocalTest(ResultSortTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'local', 'scoop', 'freeze_input'
#
# def set_mode(self):
# super(MultiprocFrozenSCOOPSortLocalTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_LOCAL
# self.freeze_input = True
# self.multiproc = True
# self.ncores = 4
# self.use_pool = False
# self.use_scoop = True
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetlockTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop', 'freeze_input'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.port = (10000, 60000)
self.graceful_exit = False
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocFrozenSCOOPSortNetqueueTest(ResultSortTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop', 'freeze_input', 'mehmet'
def set_mode(self):
super(MultiprocFrozenSCOOPSortNetqueueTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETQUEUE
self.freeze_input = True
self.multiproc = True
self.ncores = 4
self.use_pool = False
self.use_scoop = True
self.graceful_exit = False
#self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with SCOOP')
def test_graceful_exit(self):
pass
# @unittest.skipIf(scoop is None, 'Only makes sense if scoop is installed')
# class MultiprocSCOOPNetqueueTest(EnvironmentTest):
#
# tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netqueue', 'scoop'
#
# def set_mode(self):
# super(MultiprocSCOOPNetqueueTest, self).set_mode()
# self.mode = pypetconstants.WRAP_MODE_NETQUEUE
# self.multiproc = True
# self.freeze_input = False
# self.ncores = 4
# self.gc_interval = 3
# self.niceness = check_nice(1)
# self.use_pool = False
# self.use_scoop = True
# self.port = None
# self.timeout = 9999.99
@unittest.skipIf(scoop_not_functional_check(), 'Only makes sense if scoop is installed')
class MultiprocSCOOPNetlockTest(EnvironmentTest):
tags = 'integration', 'hdf5', 'environment', 'multiproc', 'netlock', 'scoop'
def set_mode(self):
super(MultiprocSCOOPNetlockTest, self).set_mode()
self.mode = pypetconstants.WRAP_MODE_NETLOCK
self.multiproc = True
self.freeze_input = False
self.ncores = 4
self.gc_interval = 3
self.niceness = check_nice(1)
self.use_pool = False
self.use_scoop = True
self.port = None
self.timeout = 1099.99
self.graceful_exit = False
# self.port = 'tcp://127.0.0.1:22334'
@unittest.skip('Does not work with scoop (fully), because scoop uses main frame.')
def <|fim_middle|>(self):
pass
if __name__ == '__main__':
opt_args = parse_args()
run_suite(**opt_args)
<|fim▁end|> | test_niceness |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()<|fim▁hole|>
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()<|fim▁end|> | |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
<|fim_middle|>
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close() |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
<|fim_middle|>
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
<|fim_middle|>
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | pass |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
<|fim_middle|>
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design) |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
<|fim_middle|>
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design) |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
<|fim_middle|>
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17') |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
<|fim_middle|>
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872') |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
<|fim_middle|>
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas) |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
<|fim_middle|>
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | """
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close() |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
<|fim_middle|>
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | """
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close() |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
<|fim_middle|>
if __name__ == '__main__':
main()
<|fim▁end|> | unittest.main() |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | main() |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def <|fim_middle|>(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | setUp |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def <|fim_middle|>(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | tearDown |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def <|fim_middle|>(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_attributos_voo_1 |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def <|fim_middle|>(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_attributos_voo_17 |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def <|fim_middle|>(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_attributos_voo_18 |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def <|fim_middle|>(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_attributos_quarto_voo |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def <|fim_middle|>(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_calculo_horas_voadas |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def <|fim_middle|>(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_ics |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def <|fim_middle|>(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def main():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | test_csv |
<|file_name|>test_escala.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.TestDir()
self.maxDiff = None
def tearDown(self):
pass
def test_attributos_voo_1(self):
p_voo = self.escala.escalas[0]
self.assertEqual(p_voo.activity_date, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4148')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'GYN')
self.assertEqual(p_voo.actype, 'E95')
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 3, 1, 10, 36))
self.assertEqual(p_voo.std, datetime(2013, 3, 1, 13, 13))
self.assertEqual(p_voo.sta, datetime(2013, 3, 1, 11, 36))
self.assertEqual(p_voo.activity_info, 'AD4148')
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_17(self):
p_voo = self.escala.escalas[17]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, None)
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'VCP')
self.assertEqual(p_voo.activity_info, 'P04')
self.assertEqual(p_voo.actype, None)
self.assertEqual(p_voo.sta, datetime(2013, 10, 28, 3, 0))
self.assertEqual(p_voo.std, datetime(2013, 10, 28, 15, 0))
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertFalse(p_voo.duty_design)
def test_attributos_voo_18(self):
p_voo = self.escala.escalas[18]
self.assertEqual(p_voo.activity_date, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.present_location, 'VCP')
self.assertEqual(p_voo.flight_no, '4050')
self.assertEqual(p_voo.origin, 'VCP')
self.assertEqual(p_voo.destination, 'FLN')
self.assertEqual(p_voo.activity_info, 'AD4050')
self.assertEqual(p_voo.actype, 'E95')
self.assertEqual(p_voo.sta, datetime(2013, 10, 29, 4, 58))
self.assertEqual(p_voo.std, datetime(2013, 10, 29, 6, 15))
self.assertTrue(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, datetime(2013, 10, 29, 5, 8))
self.assertFalse(p_voo.duty_design)
self.assertEqual(p_voo.horas_de_voo, '1:17')
def test_attributos_quarto_voo(self):
p_voo = self.escala.escalas[25]
self.assertFalse(p_voo.checkin)
self.assertEqual(p_voo.checkin_time, None)
self.assertEqual(p_voo.flight_no, '2872')
self.assertEqual(p_voo.activity_info, 'AD2872')
def test_calculo_horas_voadas(self):
s_horas = {
'h_diurno': '6:40',
'h_noturno': '6:47',
'h_total_voo': '13:27',
'h_faixa2': '0:00',
'h_sobreaviso': '40:00',
'h_reserva': '29:13'
}
self.assertEqual(self.escala.soma_horas(), s_horas)
def test_ics(self):
"""
Check ICS output
"""
escala = Escala('fixtures/escala_ics.xml')
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.ics')
self.assertEqual(escala.ics(), f_result.read())
f_result.close()
def test_csv(self):
"""
Check CSV output
"""
f_result = open(self.dir.get_data_dir() + 'fixtures/escala.csv')
self.assertEqual(self.escala.csv(), f_result.read())
f_result.close()
def <|fim_middle|>():
unittest.main()
if __name__ == '__main__':
main()
<|fim▁end|> | main |
<|file_name|>test_compat.py<|end_file_name|><|fim▁begin|>"""
Test cases adapted from the test_bsddb.py module in Python's
regression test suite.
"""
import sys, os, string
import unittest
import tempfile
from test_all import verbose
try:
# For Python 2.3
from bsddb import db, hashopen, btopen, rnopen
except ImportError:
# For earlier Pythons w/distutils pybsddb
from bsddb3 import db, hashopen, btopen, rnopen
class CompatibilityTestCase(unittest.TestCase):
def setUp(self):
self.filename = tempfile.mktemp()
def tearDown(self):
try:
os.remove(self.filename)
except os.error:
pass
def test01_btopen(self):
self.do_bthash_test(btopen, 'btopen')
def test02_hashopen(self):
self.do_bthash_test(hashopen, 'hashopen')
def test03_rnopen(self):
data = string.split("The quick brown fox jumped over the lazy dog.")
if verbose:
print "\nTesting: rnopen"
f = rnopen(self.filename, 'c')
for x in range(len(data)):
f[x+1] = data[x]
getTest = (f[1], f[2], f[3])
if verbose:
print '%s %s %s' % getTest
assert getTest[1] == 'quick', 'data mismatch!'
f[25] = 'twenty-five'
f.close()
del f
f = rnopen(self.filename, 'w')
f[20] = 'twenty'
def noRec(f):
rec = f[15]
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f['a string']
self.assertRaises(TypeError, badKey, f)
del f[3]
rec = f.first()
while rec:
if verbose:
print rec
try:
rec = f.next()
except KeyError:
break
f.close()
def test04_n_flag(self):
f = hashopen(self.filename, 'n')
f.close()
def do_bthash_test(self, factory, what):
if verbose:
print '\nTesting: ', what
f = factory(self.filename, 'c')
if verbose:
print 'creation...'
# truth test
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
f['0'] = ''
f['a'] = 'Guido'
f['b'] = 'van'
f['c'] = 'Rossum'
f['d'] = 'invented'
f['f'] = 'Python'
if verbose:
print '%s %s %s' % (f['a'], f['b'], f['c'])
if verbose:
print 'key ordering...'
f.set_location(f.first()[0])
while 1:
try:
rec = f.next()
except KeyError:
assert rec == f.last(), 'Error, last <> last!'
f.previous()
break
if verbose:<|fim▁hole|> f.sync()
f.close()
# truth test
try:
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
except db.DBError:
pass
else:
self.fail("Exception expected")
del f
if verbose:
print 'modification...'
f = factory(self.filename, 'w')
f['d'] = 'discovered'
if verbose:
print 'access...'
for key in f.keys():
word = f[key]
if verbose:
print word
def noRec(f):
rec = f['no such key']
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f[15]
self.assertRaises(TypeError, badKey, f)
f.close()
#----------------------------------------------------------------------
def test_suite():
return unittest.makeSuite(CompatibilityTestCase)
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')<|fim▁end|> | print rec
assert f.has_key('f'), 'Error, missing key!'
|
<|file_name|>test_compat.py<|end_file_name|><|fim▁begin|>"""
Test cases adapted from the test_bsddb.py module in Python's
regression test suite.
"""
import sys, os, string
import unittest
import tempfile
from test_all import verbose
try:
# For Python 2.3
from bsddb import db, hashopen, btopen, rnopen
except ImportError:
# For earlier Pythons w/distutils pybsddb
from bsddb3 import db, hashopen, btopen, rnopen
class CompatibilityTestCase(unittest.TestCase):
<|fim_middle|>
#----------------------------------------------------------------------
def test_suite():
return unittest.makeSuite(CompatibilityTestCase)
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
<|fim▁end|> | def setUp(self):
self.filename = tempfile.mktemp()
def tearDown(self):
try:
os.remove(self.filename)
except os.error:
pass
def test01_btopen(self):
self.do_bthash_test(btopen, 'btopen')
def test02_hashopen(self):
self.do_bthash_test(hashopen, 'hashopen')
def test03_rnopen(self):
data = string.split("The quick brown fox jumped over the lazy dog.")
if verbose:
print "\nTesting: rnopen"
f = rnopen(self.filename, 'c')
for x in range(len(data)):
f[x+1] = data[x]
getTest = (f[1], f[2], f[3])
if verbose:
print '%s %s %s' % getTest
assert getTest[1] == 'quick', 'data mismatch!'
f[25] = 'twenty-five'
f.close()
del f
f = rnopen(self.filename, 'w')
f[20] = 'twenty'
def noRec(f):
rec = f[15]
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f['a string']
self.assertRaises(TypeError, badKey, f)
del f[3]
rec = f.first()
while rec:
if verbose:
print rec
try:
rec = f.next()
except KeyError:
break
f.close()
def test04_n_flag(self):
f = hashopen(self.filename, 'n')
f.close()
def do_bthash_test(self, factory, what):
if verbose:
print '\nTesting: ', what
f = factory(self.filename, 'c')
if verbose:
print 'creation...'
# truth test
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
f['0'] = ''
f['a'] = 'Guido'
f['b'] = 'van'
f['c'] = 'Rossum'
f['d'] = 'invented'
f['f'] = 'Python'
if verbose:
print '%s %s %s' % (f['a'], f['b'], f['c'])
if verbose:
print 'key ordering...'
f.set_location(f.first()[0])
while 1:
try:
rec = f.next()
except KeyError:
assert rec == f.last(), 'Error, last <> last!'
f.previous()
break
if verbose:
print rec
assert f.has_key('f'), 'Error, missing key!'
f.sync()
f.close()
# truth test
try:
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
except db.DBError:
pass
else:
self.fail("Exception expected")
del f
if verbose:
print 'modification...'
f = factory(self.filename, 'w')
f['d'] = 'discovered'
if verbose:
print 'access...'
for key in f.keys():
word = f[key]
if verbose:
print word
def noRec(f):
rec = f['no such key']
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f[15]
self.assertRaises(TypeError, badKey, f)
f.close() |
<|file_name|>test_compat.py<|end_file_name|><|fim▁begin|>"""
Test cases adapted from the test_bsddb.py module in Python's
regression test suite.
"""
import sys, os, string
import unittest
import tempfile
from test_all import verbose
try:
# For Python 2.3
from bsddb import db, hashopen, btopen, rnopen
except ImportError:
# For earlier Pythons w/distutils pybsddb
from bsddb3 import db, hashopen, btopen, rnopen
class CompatibilityTestCase(unittest.TestCase):
def setUp(self):
<|fim_middle|>
def tearDown(self):
try:
os.remove(self.filename)
except os.error:
pass
def test01_btopen(self):
self.do_bthash_test(btopen, 'btopen')
def test02_hashopen(self):
self.do_bthash_test(hashopen, 'hashopen')
def test03_rnopen(self):
data = string.split("The quick brown fox jumped over the lazy dog.")
if verbose:
print "\nTesting: rnopen"
f = rnopen(self.filename, 'c')
for x in range(len(data)):
f[x+1] = data[x]
getTest = (f[1], f[2], f[3])
if verbose:
print '%s %s %s' % getTest
assert getTest[1] == 'quick', 'data mismatch!'
f[25] = 'twenty-five'
f.close()
del f
f = rnopen(self.filename, 'w')
f[20] = 'twenty'
def noRec(f):
rec = f[15]
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f['a string']
self.assertRaises(TypeError, badKey, f)
del f[3]
rec = f.first()
while rec:
if verbose:
print rec
try:
rec = f.next()
except KeyError:
break
f.close()
def test04_n_flag(self):
f = hashopen(self.filename, 'n')
f.close()
def do_bthash_test(self, factory, what):
if verbose:
print '\nTesting: ', what
f = factory(self.filename, 'c')
if verbose:
print 'creation...'
# truth test
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
f['0'] = ''
f['a'] = 'Guido'
f['b'] = 'van'
f['c'] = 'Rossum'
f['d'] = 'invented'
f['f'] = 'Python'
if verbose:
print '%s %s %s' % (f['a'], f['b'], f['c'])
if verbose:
print 'key ordering...'
f.set_location(f.first()[0])
while 1:
try:
rec = f.next()
except KeyError:
assert rec == f.last(), 'Error, last <> last!'
f.previous()
break
if verbose:
print rec
assert f.has_key('f'), 'Error, missing key!'
f.sync()
f.close()
# truth test
try:
if f:
if verbose: print "truth test: true"
else:
if verbose: print "truth test: false"
except db.DBError:
pass
else:
self.fail("Exception expected")
del f
if verbose:
print 'modification...'
f = factory(self.filename, 'w')
f['d'] = 'discovered'
if verbose:
print 'access...'
for key in f.keys():
word = f[key]
if verbose:
print word
def noRec(f):
rec = f['no such key']
self.assertRaises(KeyError, noRec, f)
def badKey(f):
rec = f[15]
self.assertRaises(TypeError, badKey, f)
f.close()
#----------------------------------------------------------------------
def test_suite():
return unittest.makeSuite(CompatibilityTestCase)
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
<|fim▁end|> | self.filename = tempfile.mktemp() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.