App state
This app has state for different components placed into
You may notice that all names are postpended with Data
. Here, we use classes to create them, but create seperate classes with methods. This makes API documentation cleaner and the namespaces more Pydantic-like.
State#
State is used to hold certain app-wide state variables that control the app itself.
API#
Holds app-wide state variables
Attributes:
Name | Type | Description |
---|---|---|
mapping |
Reactive[DataFrame]
|
bitmappings dataframe, used for targeting filters. |
datamodel |
Reactive[DataFrame]
|
column glossary dataframe |
df |
Reactive[DataFrame]
|
loaded dataframe file, defaults to nothing but app will instantiate with one loaded. |
columns |
Reactive[dict[str, list[str]]]
|
column lookup, used for guardrailing. |
release |
str
|
release type |
datatype |
str
|
datatype of file |
Source code in src/sdss_explorer/dashboard/dataclass/state.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
datatype
property
#
Current datatype of app (star or visit)
kernel_id
property
#
Virtual kernel ID
release
property
#
Current release of app (dr19, etc)
subset_store
property
#
Internal subset backend
uuid
property
#
User ID; Solara Session ID
__repr__()
#
Show relevant properties of class as string.
Source code in src/sdss_explorer/dashboard/dataclass/state.py
214 215 216 217 218 219 220 221 222 223 224 |
|
get_default_dataset()
#
Method version to get the default dataset of app (star or visit). Used for defaulting the Subset dataclass
Source code in src/sdss_explorer/dashboard/dataclass/state.py
194 195 196 197 |
|
load_dataset(release=None, datatype=None)
#
load the HDF5 dataset for the dashboard
Source code in src/sdss_explorer/dashboard/dataclass/state.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
SubsetState#
SubsetState specifically holds Subset dataclasses, which are used to generate the components in the sidebar. These also hold specific vx.DataFrame
instances which correspond to plots.
Subset#
Subset dataclass.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
subset name |
expresssion |
str
|
custom filter expression |
dataset |
str
|
specific dataset |
flags |
list[str]
|
toggled quick flags list |
carton |
list[str]
|
selected targeting cartons |
mapper |
list[str]
|
selected mapper programs |
crossmatch |
str
|
multi-line string of crossmatch identifiers |
cmtype |
str
|
type of crossmatch |
df |
DataFrame
|
vaex dataframe, corresponds to dataset |
columns |
list[str]
|
specific columns, used internally to guardrail users and reset valid columns |
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
API#
User-facing subset reactive class, with functions for add/remove/etc.
Attributes:
Name | Type | Description |
---|---|---|
index |
Reactive[int]
|
index, used to ensure unique keys |
subsets |
Reactive[dict[str, Subset]]
|
dictionary of keys to subsets |
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
add_subset(name, **kwargs)
#
Adds subset and subsetcard, generating new unique key for subset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
subset key |
required | |
kwargs
|
kwargs
|
keyword arguments to instantiate |
{}
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
|
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
clone_subset(key)
#
Clones a subset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
subset key |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
|
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
remove_subset(key)
#
Removes a subset from the Subset master list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
subset key |
required |
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
171 172 173 174 175 176 177 178 179 180 181 182 |
|
rename_subset(key, newname)
#
Renames a subset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
subset key |
required |
newname
|
str
|
new name for subset |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
|
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
update_subset(key, **kwargs)
#
Updates subset of key with specified kwargs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
subset key |
required |
kwargs
|
kwargs
|
keyword arguments to update with |
{}
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
|
Source code in src/sdss_explorer/dashboard/dataclass/subsets.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
VCData#
Used to hold the current virtual columns. Handles add and remove operations in the backend.
API#
Virtual column data class
Attributes:
Name | Type | Description |
---|---|---|
columns |
dict[str, str]
|
list of virtual columns by their name and expression. |
Source code in src/sdss_explorer/dashboard/dataclass/vcdata.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
add_column(name, expression)
#
Add a virtual column to the DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name of vc to add |
required |
expression
|
str
|
custom expression |
required |
Source code in src/sdss_explorer/dashboard/dataclass/vcdata.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
delete_column(name)
#
Remove a virtual column from the DataFrame.
Warning
This could lead to race conditions. Untested under high stress.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name of vc to remove |
required |
Source code in src/sdss_explorer/dashboard/dataclass/vcdata.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
GridState#
Used to control the grid layout
API#
Class holding current state of grid layout.
Note
All modifying functions are nested as subfunctions of ObjectGrid
.
Attributes:
Name | Type | Description |
---|---|---|
grid_layout |
Reactive[list[dict[str, int]]]
|
list of grid layout properties per item |
objects |
Reactive[list[Any]]
|
list of widgets to render |
states |
Reactive[list[PlotState]]
|
list of states, for exporting |
index |
Reactive[int]
|
index, used for ensuring unique state between widgets |
Source code in src/sdss_explorer/dashboard/dataclass/gridstate.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
PlotState#
PlotState
is a specific class of plot settings that is instantiated and used in individual plot inistances. See more in Plots.