Skip to content

Commit 4ae8627

Browse files
authored
Merge pull request #345 from Carifio24/export-size
Serialize settings for size attributes
2 parents d76265b + 7efa3eb commit 4ae8627

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pywwt/layers.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131

132132
# The following are columns that we add dynamically and internally, so we need
133133
# to make sure they have unique names that won't clash with existing columns
134-
SIZE_COLUMN_NAME = str(uuid.uuid4())
135134
CMAP_COLUMN_NAME = str(uuid.uuid4())
136135
TIME_COLUMN_NAME = str(uuid.uuid4())
137136

@@ -1406,7 +1405,11 @@ def _serialize_state(self):
14061405
if self._uniform_size():
14071406
state["settings"]["sizeColumn"] = -1
14081407
else:
1409-
state["settings"]["sizeColumn"] = SIZE_COLUMN_NAME
1408+
state["settings"]["sizeColumn"] = self.size_att
1409+
state["settings"]["normalizeSize"] = True
1410+
state["settings"]["normalizeSizeMin"] = self.size_vmin
1411+
state["settings"]["normalizeSizeMax"] = self.size_vmax
1412+
state["settings"]["normalizeSizeClip"] = True
14101413
state["settings"]["pointScaleType"] = 0
14111414

14121415
return state

pywwt/tests/test_serialization.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22

33
from ..core import BaseWWTWidget
4-
from ..layers import SIZE_COLUMN_NAME
54

65
import numpy as np
76
import os
@@ -470,7 +469,11 @@ def test_table_setting_serialization():
470469
layer.size_att = 'dec'
471470
layer.alt_unit = u.Mpc
472471

473-
expected_settings['sizeColumn'] = SIZE_COLUMN_NAME
472+
expected_settings['sizeColumn'] = 'dec'
473+
expected_settings['normalizeSize'] = True
474+
expected_settings["normalizeSizeMin"] = layer.size_vmin
475+
expected_settings["normalizeSizeMax"] = layer.size_vmax
476+
expected_settings["normalizeSizeClip"] = True
474477
expected_settings['pointScaleType'] = 0
475478
expected_settings['colorMapColumn'] = layer.cmap_att
476479
expected_settings['colorMap'] = 3

0 commit comments

Comments
 (0)