Skip to content

Commit 1ac170d

Browse files
authored
minor updates
1 parent 22c7c93 commit 1ac170d

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

src/aind_exaspim_image_compression/utils/img_util.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get_start_end(voxel, shape, from_center=True):
165165
Shape of the image patch to be read.
166166
from_center : bool, optional
167167
Indication of whether the provided coordinates represent the center of
168-
the patch or the front-top-left corner. The default is True.
168+
the patch or the front-top-left corner. Default is True.
169169
170170
Return
171171
------
@@ -383,15 +383,14 @@ def convert_tiff_ome_zarr(
383383
out_path : str
384384
Path to write the N5.
385385
chunks : Tuple[int], optional
386-
Chunk shape of the N5 dataset. The default is (1, 1, 64, 128, 128).
386+
Chunk shape of the N5 dataset. Default is (1, 1, 64, 128, 128).
387387
compressor : Blosc, optional
388-
Numcodecs compressor instance for the N5 dataset. The default is
388+
Numcodecs compressor instance for the N5 dataset. Default is
389389
Blosc(cname="zstd", clevel=5, shuffle=Blosc.SHUFFLE).
390390
voxel_size : Tuple[float], optional
391-
Voxel spacing of the image, in nanometers. The default is
392-
(748, 748, 1000).
391+
Voxel spacing of the image. Default is (748, 748, 1000).
393392
n_levels : int, optional
394-
Number of levels in the multiscale pyramid. The default is 3.
393+
Number of levels in the multiscale pyramid. Default is 3.
395394
396395
Returns
397396
-------
@@ -448,8 +447,8 @@ def compute_cratio(img, codec, chunk_shape=(64, 64, 64)):
448447
Image to compute compression ratio of.
449448
codec : blosc.Blosc
450449
Blosc codec used to compress each chunk.
451-
chunk_shape : tuple of ints
452-
Shape of chunks Zarr would use.
450+
chunk_shape : Tuple[int]
451+
Shape of chunks Zarr would use. Default is (64, 64, 64).
453452
454453
Returns
455454
-------
@@ -488,10 +487,10 @@ def compute_ssim3D(img1, img2, data_range=None, window_size=16):
488487
img2 : numpy.ndarray
489488
3D Image.
490489
data_range : float, optional
491-
Value range of input images. If None, computed from "img1". The
492-
default is None.
490+
Value range of input images. If None, computed from "img1". Default
491+
is None.
493492
window_size : int, optional
494-
Size of the 3D filter window. The default is 16.
493+
Size of the 3D filter window. Default is 16.
495494
496495
Returns
497496
-------

src/aind_exaspim_image_compression/utils/swc_util.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def __init__(self, anisotropy=(1.0, 1.0, 1.0), min_size=0):
5252
----------
5353
anisotropy : Tuple[float], optional
5454
Image to physical coordinates scaling factors to account for the
55-
anisotropy of the microscope. The default is [1.0, 1.0, 1.0].
55+
anisotropy of the microscope. Default is [1.0, 1.0, 1.0].
5656
min_size : int, optional
5757
Threshold on the number nodes in SWC files that are parsed and
58-
returned. The default is 0.
58+
returned. Default is 0.
5959
6060
Returns
6161
-------
@@ -140,7 +140,7 @@ def read_from_paths(self, swc_paths):
140140
141141
Returns
142142
-------
143-
Dequeue[dict]
143+
swc_dicts : Dequeue[dict]
144144
List of dictionaries whose keys and values are the attribute
145145
names and values from an SWC file.
146146
@@ -170,7 +170,7 @@ def read_from_path(self, path):
170170
171171
Returns
172172
-------
173-
dict
173+
result : dict
174174
Dictionaries whose keys and values are the attribute names and
175175
values from an SWC file.
176176
@@ -193,7 +193,7 @@ def read_from_zips(self, zip_dir):
193193
194194
Returns
195195
-------
196-
Deque[dict]
196+
swc_dicts : Deque[dict]
197197
Dictionaries whose keys and values are the attribute names and
198198
values from an SWC file.
199199
@@ -223,7 +223,7 @@ def read_from_zip(self, zip_path):
223223
224224
Returns
225225
-------
226-
Dequeue[dict]
226+
swc_dicts : Dequeue[dict]
227227
List of dictionaries whose keys and values are the attribute
228228
names and values from an SWC file.
229229
@@ -250,7 +250,7 @@ def read_from_zipped_file(self, zip_file, path):
250250
251251
Returns
252252
-------
253-
dict
253+
result : dict
254254
Dictionaries whose keys and values are the attribute names and
255255
values from an SWC file.
256256
@@ -274,7 +274,7 @@ def read_from_gcs_swcs(self, gcs_dict):
274274
275275
Returns
276276
-------
277-
Dequeue[dict]
277+
swc_dicts : Dequeue[dict]
278278
List of dictionaries whose keys and values are the attribute
279279
names and values from an SWC file.
280280
@@ -337,7 +337,7 @@ def parse(self, content):
337337
338338
Returns
339339
-------
340-
dict
340+
swc_dict : dict
341341
Dictionaries whose keys and values are the attribute names
342342
and values from an SWC file.
343343
@@ -380,10 +380,10 @@ def process_content(self, content):
380380
381381
Returns
382382
-------
383-
List[str]
383+
content : List[str]
384384
A list of strings representing the lines of text starting from the
385385
line immediately after the last commented line.
386-
List[float]
386+
offset : List[float]
387387
Offset used to shift coordinates.
388388
389389
"""
@@ -403,12 +403,12 @@ def read_xyz(self, xyz_str, offset=[0.0, 0.0, 0.0]):
403403
xyz_str : str
404404
Coordinate stored as a str.
405405
offset : List[float], optional
406-
Offset used to shift coordinates if provided in the SWC file. The
407-
default is [0.0, 0.0, 0.0].
406+
Offset used to shift coordinates if provided in the SWC file.
407+
Default is [0.0, 0.0, 0.0].
408408
409409
Returns
410410
-------
411-
numpy.ndarray
411+
xyz : numpy.ndarray
412412
Coordinate of a node from an SWC file.
413413
414414
"""

src/aind_exaspim_image_compression/utils/util.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def mkdir(path, delete=False):
2828
Path of directory to be created.
2929
delete : bool, optional
3030
Indication of whether to delete directory at path if it already
31-
exists. The default is False.
31+
exists. Default is False.
3232
3333
Returns
3434
-------
@@ -69,7 +69,7 @@ def list_dir(directory, extension=None):
6969
directory : str
7070
Path to directory to be searched.
7171
extension : str, optional
72-
Extension of filenames to be returned. The default is None.
72+
Extension of filenames to be returned. Default is None.
7373
7474
Returns
7575
-------
@@ -94,7 +94,7 @@ def list_subdirectory_names(directory_path):
9494
9595
Returns
9696
-------
97-
List[str]
97+
subdir_names : List[str]
9898
List of the names of subdirectories.
9999
100100
"""
@@ -115,12 +115,12 @@ def list_paths(directory, extension=""):
115115
directory : str
116116
Directory to be searched.
117117
extension : str, optional
118-
If provided, only paths of files with the extension are returned. The
119-
default is an empty string.
118+
If provided, only paths of files with the extension are returned.
119+
Default is an empty string.
120120
121121
Returns
122122
-------
123-
list[str]
123+
List[str]
124124
List of all paths within "directory".
125125
126126
"""
@@ -321,20 +321,20 @@ def list_block_paths(brain_id):
321321

322322
def list_gcs_filenames(gcs_dict, extension):
323323
"""
324-
Lists all files in a GCS bucket with the given extension.
324+
Lists filenames in a GCS bucket path filtered by file extension.
325325
326326
Parameters
327327
----------
328328
gcs_dict : dict
329-
...
329+
Dictionary with keys "bucket_name" and "path" specifying the GCS
330+
location.
330331
extension : str
331-
File extension of filenames to be listed.
332+
File extension to filter by (e.g., '.tif').
332333
333334
Returns
334335
-------
335-
list
336-
Filenames stored at "cloud" path with the given extension.
337-
336+
List[str]
337+
List of blob names containing the specified extension.
338338
"""
339339
bucket = storage.Client().bucket(gcs_dict["bucket_name"])
340340
blobs = bucket.list_blobs(prefix=gcs_dict["path"])
@@ -354,7 +354,7 @@ def list_gcs_subprefixes(bucket_name, prefix):
354354
355355
Returns
356356
-------
357-
list[str]
357+
subdirs : List[str]
358358
List of direct subdirectories.
359359
360360
"""
@@ -476,11 +476,11 @@ def list_s3_bucket_prefixes(bucket_name, keyword=None):
476476
bucket_name : str
477477
Name of the S3 bucket to search.
478478
keyword : str, optional
479-
Keyword used to filter the prefixes.
479+
Keyword used to filter the prefixes. Default is None.
480480
481481
Returns
482482
--------
483-
List[str]
483+
prefixes : List[str]
484484
A list of top-level prefixes (directories) in the S3 bucket. If a
485485
keyword is provided, only the matching prefixes are returned.
486486
@@ -566,7 +566,7 @@ def write_to_s3(local_path, bucket_name, prefix):
566566
# --- Miscellaneous ---
567567
def sample_once(my_container):
568568
"""
569-
Samples a single element from "my_container".
569+
Samples a single element from the given container.
570570
571571
Parameters
572572
----------
@@ -575,7 +575,8 @@ def sample_once(my_container):
575575
576576
Returns
577577
-------
578-
sample
578+
object
579+
Element sampled from the given container
579580
580581
"""
581582
return sample(my_container, 1)[0]
@@ -590,13 +591,13 @@ def time_writer(t, unit="seconds"):
590591
t : float
591592
Runtime.
592593
unit : str, optional
593-
Unit of time that "t" is expressed in.
594+
Unit of time that "t" is expressed in. Default is "seconds".
594595
595596
Returns
596597
-------
597-
float
598+
t : float
598599
Runtime
599-
str
600+
unit : str
600601
Unit of time.
601602
602603
"""

0 commit comments

Comments
 (0)