Skip to content

Commit

Permalink
Fix the broken test and add a test_settings.py that is useful for run…
Browse files Browse the repository at this point in the history
…ning the tests locally without redis
  • Loading branch information
Jon committed Nov 5, 2024
1 parent 7b6602a commit 4f7acd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions datalab/datalab_session/analysis/raw_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from datalab.datalab_session.file_utils import get_hdu
from fits2image.scaling import extract_samples, calc_zscale_min_max

# TODO: This analysis endpoint assumes the image to be of 16 bitdepth. We should make this agnositc to bit depth in the future

def raw_data(input: dict):
fits_path = get_fits(input['basename'], input.get('source', 'archive'))

Expand All @@ -15,8 +17,8 @@ def raw_data(input: dict):
median = np.median(samples)
_, zmax, _ = calc_zscale_min_max(samples, contrast=0.1, iterations=1)

# resize the image to max. 500 pixels on an axis
max_size = input.get('max_size', 800)
# resize the image to max. 500 pixels on an axis by default for the UI
max_size = input.get('max_size', 500)
image = Image.fromarray(image_data)
newImage = image.resize((max_size, max_size), Image.LANCZOS)
scaled_array = np.asarray(newImage).astype(np.float16)
Expand Down
Binary file not shown.
8 changes: 8 additions & 0 deletions test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from datalab.settings import *

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake'
},
}

0 comments on commit 4f7acd5

Please sign in to comment.