PyOPIA 2.5.8__tar.gz → 2.5.10__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.
Files changed (26) hide show
  1. {pyopia-2.5.8 → pyopia-2.5.10}/PKG-INFO +1 -1
  2. pyopia-2.5.10/pyopia/__init__.py +1 -0
  3. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/cli.py +12 -3
  4. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/io.py +14 -7
  5. pyopia-2.5.8/pyopia/__init__.py +0 -1
  6. {pyopia-2.5.8 → pyopia-2.5.10}/LICENSE +0 -0
  7. {pyopia-2.5.8 → pyopia-2.5.10}/README.md +0 -0
  8. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/background.py +0 -0
  9. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/classify.py +0 -0
  10. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/exampledata.py +0 -0
  11. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/instrument/__init__.py +0 -0
  12. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/instrument/common.py +0 -0
  13. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/instrument/holo.py +0 -0
  14. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/instrument/silcam.py +0 -0
  15. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/instrument/uvp.py +0 -0
  16. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/pipeline.py +0 -0
  17. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/plotting.py +0 -0
  18. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/process.py +0 -0
  19. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/simulator/__init__.py +0 -0
  20. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/simulator/silcam.py +0 -0
  21. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/statistics.py +0 -0
  22. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/tests/__init__.py +0 -0
  23. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/tests/test_classify.py +0 -0
  24. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/tests/test_notebooks.py +0 -0
  25. {pyopia-2.5.8 → pyopia-2.5.10}/pyopia/tests/test_pipeline.py +0 -0
  26. {pyopia-2.5.8 → pyopia-2.5.10}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOPIA
3
- Version: 2.5.8
3
+ Version: 2.5.10
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__ = '2.5.10'
@@ -37,7 +37,7 @@ def docs():
37
37
 
38
38
  @app.command()
39
39
  def modify_config(existing_filename: str, modified_filename: str,
40
- raw_files=None,
40
+ raw_files=None, pixel_size=None,
41
41
  step_name=None, modify_arg=None, modify_value=None):
42
42
  '''Modify a existing config.toml file and write a new one to disc
43
43
 
@@ -49,6 +49,8 @@ def modify_config(existing_filename: str, modified_filename: str,
49
49
  e.g. config_new.toml
50
50
  raw_files : str, optional
51
51
  modify the raw file input in the `[general]` settings, by default None
52
+ pixel_size : str, optional
53
+ modify the pixel size in the `[general]` settings, by default None
52
54
  step_name : str, optional
53
55
  the name of the step to modify e.g. `segmentation`, by default None
54
56
  modify_arg : str, optional
@@ -61,11 +63,18 @@ def modify_config(existing_filename: str, modified_filename: str,
61
63
  toml_settings = pyopia.io.load_toml(existing_filename)
62
64
 
63
65
  if raw_files is not None:
64
- toml_settings['general']['raw_files'] = raw_files
66
+ toml_settings['general']['raw_files'] = f'{raw_files}'
67
+ if pixel_size is not None:
68
+ toml_settings['general']['pixel_size'] = float(pixel_size)
65
69
 
66
70
  if step_name is not None:
67
71
  try:
68
- modify_value = float(modify_value)
72
+ if modify_arg == 'average_window':
73
+ modify_value = int(modify_value)
74
+ elif modify_arg == 'threshold':
75
+ modify_value = float(modify_value)
76
+ else:
77
+ modify_value = str(modify_value)
69
78
  except ValueError:
70
79
  pass
71
80
 
@@ -160,7 +160,11 @@ def load_image_stats(datafilename):
160
160
 
161
161
 
162
162
  def load_stats(datafilename):
163
- '''Load STATS file as a DataFrame
163
+ '''Load -STATS.nc file as xarray Dataset
164
+
165
+ .. warning:: Support for loading of old -STATS.h5 formats will be removed in version 3.0.0.
166
+ They will need to be converted to .nc prior to loading.
167
+ Data loaded from -STATS.h5 are returned as an xarray Dataset without metadata.
164
168
 
165
169
  Parameters
166
170
  ----------
@@ -169,21 +173,24 @@ def load_stats(datafilename):
169
173
 
170
174
  Returns
171
175
  -------
172
- stats : DataFrame
173
- STATS DataFrame / xarray dataset
176
+ xstats : xarray.Dataset
177
+ Particle statistics
174
178
  '''
175
179
 
176
180
  if datafilename.endswith('.nc'):
177
- with xarray.open_dataset(datafilename) as stats:
178
- stats.load()
181
+ with xarray.open_dataset(datafilename) as xstats:
182
+ xstats.load()
179
183
  elif datafilename.endswith('.h5'):
184
+ logger.warning('In future, load_stats will only take .nc files')
180
185
  stats = pd.read_hdf(datafilename, 'ParticleStats/stats')
186
+ xstats = stats.to_xarray()
181
187
  else:
182
188
  logger.warning('WARNING. File extension not specified.' +
183
189
  'Assuming prefix of -STATS.h5 for backwards compatability.' +
184
- 'In future, this function will only take .nc files')
190
+ 'In future, load_stats will only take .nc files')
185
191
  stats = pd.read_hdf(datafilename + '-STATS.h5', 'ParticleStats/stats')
186
- return stats
192
+ xstats = stats.to_xarray()
193
+ return xstats
187
194
 
188
195
 
189
196
  def combine_stats_netcdf_files(path_to_data, prefix='*'):
@@ -1 +0,0 @@
1
- __version__ = '2.5.8'
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