Skip to content

Commit

Permalink
A/B/C testing of requiresPixelsPyramid() with timings
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Feb 26, 2024
1 parent c3674ff commit 46792d3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions omeroweb/webgateway/marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import re
import logging
from future.utils import isbytes, bytes_to_native_str
from datetime import datetime

from omero.model.enums import PixelsTypeint8, PixelsTypeuint8, PixelsTypeint16
from omero.model.enums import PixelsTypeuint16, PixelsTypeint32
Expand Down Expand Up @@ -355,10 +356,18 @@ def pixel_size_in_microns(method):
# NB: some small images like OME-Zarr can have pyramids
# but these will be ignored

# TEMP - for A/B testing only use size test if ID is EVEN number!
if image.id % 2 == 0 and not image.requiresPixelsPyramid():
# TEMP - for A/B/C testing based on image ID
starttime = datetime.now()
big_image = (rv["size"]["width"] * rv["size"]["height"]) > (3000 * 3000)
rv["tile_ABC"] = image.id % 3
if image.id % 3 == 0 and not big_image:
rv["tiles"] = False
rv["tiles_test"] = "No"
elif image.id % 3 == 1 and not image.requiresPixelsPyramid():
rv["tiles"] = False
rv["tiles_test"] = "requiresPixelsPyramid"
else:
rv["tiles_test"] = "re.getResolutionLevels"
if load_re(image, rv):
levels = image._re.getResolutionLevels()
tiles = levels > 1
Expand All @@ -374,6 +383,7 @@ def pixel_size_in_microns(method):
if init_zoom < 0:
init_zoom = levels + init_zoom
rv["init_zoom"] = init_zoom
rv["tiles_time"] = str(datetime.now() - starttime)

if key is not None and rv is not None:
for k in key.split("."):
Expand Down

0 comments on commit 46792d3

Please sign in to comment.