PyOPIA 1.1.2__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOPIA
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: A Python Ocean Particle Image Analysis toolbox.
5
5
  Home-page: https://github.com/sintef/pyopia
6
6
  Keywords: Ocean,Particles,Imaging,Measurement,Size distribution
@@ -0,0 +1 @@
1
+ __version__ = '1.1.4'
@@ -69,19 +69,11 @@ class Pipeline():
69
69
  self.data['settings'] = settings
70
70
 
71
71
  self.pass_general_settings()
72
- print('raw_files:', self.data['raw_files'])
73
72
 
74
73
  for stepname in self.stepnames:
75
74
  if not self.initial_steps.__contains__(stepname):
76
75
  continue
77
- if stepname == 'classifier':
78
- callobj = self.step_callobj(stepname)
79
- self.data['cl'] = callobj()
80
- else:
81
- callobj = self.step_callobj(stepname)
82
- self.data = callobj(self.data)
83
-
84
- print('Pipeline ready with these data: ', list(self.data.keys()))
76
+ self.run_step(stepname)
85
77
 
86
78
  def run(self, filename):
87
79
  '''Method for executing the processing pipeline.
@@ -109,14 +101,40 @@ class Pipeline():
109
101
  if self.initial_steps.__contains__(stepname):
110
102
  continue
111
103
 
112
- callobj = self.step_callobj(stepname)
113
- self.data = callobj(self.data)
104
+ self.run_step(stepname)
114
105
 
115
106
  stats = self.data['stats']
116
107
 
117
108
  return stats
118
109
 
110
+ def run_step(self, stepname):
111
+ '''Execute a pipeline step and update the pipeline data
112
+
113
+ Parameters
114
+ ----------
115
+ stepname : str
116
+ Name of the step defined in the settings
117
+ '''
118
+ if stepname == 'classifier':
119
+ callobj = self.step_callobj(stepname)
120
+ self.data['cl'] = callobj()
121
+ else:
122
+ callobj = self.step_callobj(stepname)
123
+ self.data = callobj(self.data)
124
+
119
125
  def step_callobj(self, stepname):
126
+ '''Generate a callable object for use in run_step()
127
+
128
+ Parameters
129
+ ----------
130
+ stepname : str
131
+ Name of the step defined in the settings
132
+
133
+ Returns
134
+ -------
135
+ obj
136
+ callable object for use in run_step()
137
+ '''
120
138
 
121
139
  pipeline_class = self.settings['steps'][stepname]['pipeline_class']
122
140
  classname = pipeline_class.split('.')[-1]
@@ -254,7 +272,7 @@ class ReturnData():
254
272
  .. code-block:: python
255
273
 
256
274
  [steps.returndata]
257
- pipeline_class = 'pyopia.classify.ReturnData'
275
+ pipeline_class = 'pyopia.pipeline.ReturnData'
258
276
 
259
277
  This will allow you to call pipeline.run() like this:
260
278
 
@@ -427,9 +427,10 @@ def statextract(imbw, timestamp, imc,
427
427
  if not len(s) == 3:
428
428
  imref = np.copy(imc)
429
429
  imc = np.zeros((np.shape(imc)[0], np.shape(imc)[1], 3), dtype=np.uint8)
430
- imc[:, :, 0] = imref
431
- imc[:, :, 1] = imref
432
- imc[:, :, 2] = imref
430
+ # Convert from floats in [0, 1] to ints in [0, 255]
431
+ imc[:, :, 0] = 255 * imref
432
+ imc[:, :, 1] = 255 * imref
433
+ imc[:, :, 2] = 255 * imref
433
434
  print('WARNING. exportparticles temporarily modified for 2-d images without color!')
434
435
 
435
436
  stats = extract_particles(imc, timestamp, Classification, region_properties,
@@ -1 +0,0 @@
1
- __version__ = '1.1.2'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes