PyOPIA 1.1.6__tar.gz → 1.1.7__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.6
3
+ Version: 1.1.7
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
@@ -111,12 +111,6 @@ git clone https://github.com/SINTEF/pyopia.git
111
111
  cd pyopia
112
112
  ```
113
113
 
114
- If you do not want to use git, you can manually download the repository from github. To do so, click on the green "<> CODE button" (top right-hand side) and select "Download zip". Unzip the files into your target folder, and move into the new directory (note the foldername may contain the branch name, such as 'main').
115
-
116
- ```bash
117
- cd pyopia-main
118
- ```
119
-
120
114
  For the next steps, you need to be located in the directory that contains the file 'environment.yml'.
121
115
 
122
116
  1. (optional, but recommended) Create a virtual environment using the environment.yml. This will create an environment called pyopia, but with no dependencies installed. Dependencies are managed by poetry (in step 2):
@@ -63,12 +63,6 @@ git clone https://github.com/SINTEF/pyopia.git
63
63
  cd pyopia
64
64
  ```
65
65
 
66
- If you do not want to use git, you can manually download the repository from github. To do so, click on the green "<> CODE button" (top right-hand side) and select "Download zip". Unzip the files into your target folder, and move into the new directory (note the foldername may contain the branch name, such as 'main').
67
-
68
- ```bash
69
- cd pyopia-main
70
- ```
71
-
72
66
  For the next steps, you need to be located in the directory that contains the file 'environment.yml'.
73
67
 
74
68
  1. (optional, but recommended) Create a virtual environment using the environment.yml. This will create an environment called pyopia, but with no dependencies installed. Dependencies are managed by poetry (in step 2):
@@ -0,0 +1 @@
1
+ __version__ = '1.1.7'
@@ -1,14 +1,10 @@
1
- '''
2
- This is a submodule for providing convienient access to online testdata
3
- for use in the tests contain within this submodule.
4
- '''
5
-
6
1
  import urllib.request
7
2
  import zipfile
8
3
  import os
4
+ import gdown
9
5
 
10
6
 
11
- def get_file_from_pysilcam_blob(filename, download_directory):
7
+ def get_file_from_pysilcam_blob(filename, download_directory='./'):
12
8
  '''Downloads a specified filename from the pysilcam.blob into the working dir. if it doesn't already exist
13
9
 
14
10
  only works for known filenames that are on this blob
@@ -25,7 +21,7 @@ def get_file_from_pysilcam_blob(filename, download_directory):
25
21
  urllib.request.urlretrieve(url, os.path.join(download_directory, filename))
26
22
 
27
23
 
28
- def get_example_silc_image(download_directory):
24
+ def get_example_silc_image(download_directory='./'):
29
25
  '''calls `get_file_from_pysilcam_blob` for a silcam iamge
30
26
 
31
27
  Returns
@@ -34,11 +30,14 @@ def get_example_silc_image(download_directory):
34
30
  filename
35
31
  '''
36
32
  filename = 'D20181101T142731.838206.silc'
33
+ if os.path.isfile(filename):
34
+ print('Example image already exists. Skipping download.')
35
+ return filename
37
36
  get_file_from_pysilcam_blob(filename, download_directory)
38
37
  return filename
39
38
 
40
39
 
41
- def get_example_model(download_directory):
40
+ def get_example_model(download_directory='./'):
42
41
  '''Downloads and unzips an example trained CNN model from the pysilcam.blob
43
42
  into the working dir. if it doesn't already exist.
44
43
 
@@ -60,7 +59,7 @@ def get_example_model(download_directory):
60
59
  return os.path.join(download_directory, model_filename)
61
60
 
62
61
 
63
- def get_example_hologram_and_background(download_directory):
62
+ def get_example_hologram_and_background(download_directory='./'):
64
63
  '''calls `get_file_from_pysilcam_blob` for a raw hologram, and its associated background image.
65
64
 
66
65
  Returns
@@ -80,3 +79,35 @@ def get_example_hologram_and_background(download_directory):
80
79
  holo_background_filename = os.path.join(download_directory, holo_background_filename)
81
80
 
82
81
  return holo_filename, holo_background_filename
82
+
83
+
84
+ def get_folder_from_holo_repository(foldername="holo_test_data_01", existsok=False):
85
+ '''Downloads a specified folder from the holo testing repository into the working dir. if it doesn't already exist
86
+
87
+ only works for known folders that are on the GoogleDrive repository
88
+ by default will download a known-good folder. Additional elif statements can be added to implement additional folders.
89
+
90
+ Parameters
91
+ ----------
92
+ foldername : string
93
+ known filename on the blob
94
+ existsok : (bool, optional)
95
+ if True, then don't download if the specified folder already exists, defaults to False
96
+
97
+ '''
98
+ if foldername == "holo_test_data_01":
99
+ url = 'https://drive.google.com/drive/folders/1yNatOaKdWwYQp-5WVEDItoibr-k0lGsP?usp=share_link'
100
+
101
+ elif foldername == "holo_test_data_02":
102
+ url = "https://drive.google.com/drive/folders/1E5iNSyfeKcVMLVe4PNEwF2Q2mo3WVjF5?usp=share_link"
103
+
104
+ else:
105
+ foldername == "holo_test_data_01"
106
+ url = 'https://drive.google.com/drive/folders/1yNatOaKdWwYQp-5WVEDItoibr-k0lGsP?usp=share_link'
107
+
108
+ if os.path.exists(foldername) and existsok:
109
+ print(foldername + ' already exists. Skipping download.')
110
+ return foldername
111
+
112
+ gdown.download_folder(url, quiet=True, use_cookies=False)
113
+ return foldername
@@ -7,7 +7,7 @@ from glob import glob
7
7
  import tempfile
8
8
  import os
9
9
 
10
- import pyopia.tests.testdata as testdata
10
+ import pyopia.exampledata as testdata
11
11
  import pyopia.io
12
12
  import pyopia.classify
13
13
  from pyopia.pipeline import Pipeline
@@ -1 +0,0 @@
1
- __version__ = '1.1.6'
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