revisit 0.0.12__tar.gz → 0.0.14__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {revisit-0.0.12 → revisit-0.0.14}/PKG-INFO +2 -1
- {revisit-0.0.12 → revisit-0.0.14}/pyproject.toml +2 -1
- {revisit-0.0.12 → revisit-0.0.14}/src/revisit/revisit.py +35 -18
- revisit-0.0.14/src/revisit/static/widget.css +2 -0
- revisit-0.0.14/src/revisit/static/widget.js +56 -0
- revisit-0.0.12/src/revisit/static/widget.css +0 -1
- revisit-0.0.12/src/revisit/static/widget.js +0 -55
- {revisit-0.0.12 → revisit-0.0.14}/.gitignore +0 -0
- {revisit-0.0.12 → revisit-0.0.14}/README.md +0 -0
- {revisit-0.0.12 → revisit-0.0.14}/src/revisit/StudyConfigSchema.json +0 -0
- {revisit-0.0.12 → revisit-0.0.14}/src/revisit/__init__.py +0 -0
- {revisit-0.0.12 → revisit-0.0.14}/src/revisit/models.py +0 -0
- {revisit-0.0.12 → revisit-0.0.14}/src/revisit/widget.py +0 -0
@@ -1,11 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: revisit
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.14
|
4
4
|
Requires-Dist: altair[all]>=5.5.0
|
5
5
|
Requires-Dist: anywidget
|
6
6
|
Requires-Dist: ipykernel>=6.29.5
|
7
7
|
Requires-Dist: pandas>=2.2.3
|
8
8
|
Requires-Dist: pydantic>=2.10.5
|
9
|
+
Requires-Dist: scipy>=1.15.1
|
9
10
|
Provides-Extra: dev
|
10
11
|
Requires-Dist: jupyterlab; extra == 'dev'
|
11
12
|
Requires-Dist: watchfiles; extra == 'dev'
|
@@ -4,13 +4,14 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "revisit"
|
7
|
-
version = "0.0.
|
7
|
+
version = "0.0.14"
|
8
8
|
dependencies = [
|
9
9
|
"altair[all]>=5.5.0",
|
10
10
|
"anywidget",
|
11
11
|
"ipykernel>=6.29.5",
|
12
12
|
"pandas>=2.2.3",
|
13
13
|
"pydantic>=2.10.5",
|
14
|
+
"scipy>=1.15.1",
|
14
15
|
]
|
15
16
|
readme = "README.md"
|
16
17
|
|
@@ -10,7 +10,8 @@ import re
|
|
10
10
|
import os
|
11
11
|
import shutil
|
12
12
|
from . import widget as _widget
|
13
|
-
|
13
|
+
import ast
|
14
|
+
import time
|
14
15
|
|
15
16
|
__all__ = [
|
16
17
|
"component",
|
@@ -67,6 +68,7 @@ class _WrappedComponent(_JSONableBaseModel):
|
|
67
68
|
component_name__: str
|
68
69
|
base__: Optional[_WrappedComponent] = None
|
69
70
|
context__: Optional[dict] = None
|
71
|
+
metadata__: Optional[dict] = None
|
70
72
|
root: rvt_models.IndividualComponent
|
71
73
|
|
72
74
|
def model_post_init(self, __context: Any) -> None:
|
@@ -158,18 +160,29 @@ class _WrappedComponentBlock(_JSONableBaseModel):
|
|
158
160
|
|
159
161
|
def get_component(self, name: str) -> _WrappedComponent:
|
160
162
|
for entry in self.component_objects__:
|
161
|
-
print(f'Comp Name: {entry.component_name__}')
|
162
|
-
print(f'Name: {name}')
|
163
163
|
if entry.component_name__ == name:
|
164
164
|
return entry
|
165
165
|
|
166
|
-
def permute(
|
166
|
+
def permute(
|
167
|
+
self,
|
168
|
+
factors: List[str],
|
169
|
+
order: rvt_models.Order,
|
170
|
+
numSamples: Optional[int] = None,
|
171
|
+
component_function=None
|
172
|
+
) -> None:
|
167
173
|
# Convert to JSON
|
168
174
|
self_json = json.loads(self.__str__())
|
169
175
|
# Get all current component dictionaries
|
170
176
|
components_dict = {c.component_name__: c for c in self.component_objects__}
|
171
177
|
# Recursively start permutation function
|
172
|
-
new_permuted_component_block = _recursive_json_permutation(
|
178
|
+
new_permuted_component_block = _recursive_json_permutation(
|
179
|
+
self_json,
|
180
|
+
factors=factors,
|
181
|
+
order=order,
|
182
|
+
numSamples=numSamples,
|
183
|
+
input_components=components_dict,
|
184
|
+
component_function=component_function
|
185
|
+
)
|
173
186
|
# Set new objects
|
174
187
|
self.component_objects__ = new_permuted_component_block.component_objects__
|
175
188
|
# Set new root
|
@@ -685,7 +698,8 @@ def _recursive_json_permutation(
|
|
685
698
|
factors: List[str],
|
686
699
|
order: rvt_models.Order,
|
687
700
|
numSamples: int,
|
688
|
-
input_components: dict
|
701
|
+
input_components: dict,
|
702
|
+
component_function=None
|
689
703
|
):
|
690
704
|
new_seq = __sequence__(order=order, numSamples=numSamples)
|
691
705
|
while input_json['components']:
|
@@ -698,20 +712,22 @@ def _recursive_json_permutation(
|
|
698
712
|
curr_seq = __sequence__(order=order, numSamples=numSamples)
|
699
713
|
# Generate new comp for each
|
700
714
|
for entry in factors:
|
701
|
-
# Split factor entry
|
702
|
-
[name, value] = entry.split(":")
|
703
715
|
# Assign params
|
704
|
-
|
705
|
-
if curr_comp.
|
706
|
-
|
716
|
+
metadata = entry
|
717
|
+
if curr_comp.metadata__ is not None:
|
718
|
+
metadata = {**curr_comp.metadata__, **entry}
|
707
719
|
# Create new component
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
720
|
+
comp_name = ":".join(f"{key}:{value}" for key, value in entry.items())
|
721
|
+
if component_function:
|
722
|
+
new_comp = component_function(**metadata)
|
723
|
+
else:
|
724
|
+
new_comp = __component__(
|
725
|
+
base__=curr_comp,
|
726
|
+
component_name__=f"{c}__{comp_name}",
|
727
|
+
metadata__=metadata
|
728
|
+
)
|
713
729
|
# Add to curr seq block
|
714
|
-
curr_seq = curr_seq +
|
730
|
+
curr_seq = curr_seq + new_comp
|
715
731
|
# Add seq block to outer seq block
|
716
732
|
else:
|
717
733
|
new_input_json = c
|
@@ -724,7 +740,8 @@ def _recursive_json_permutation(
|
|
724
740
|
order=order,
|
725
741
|
numSamples=numSamples,
|
726
742
|
input_components=input_components,
|
727
|
-
factors=factors
|
743
|
+
factors=factors,
|
744
|
+
component_function=component_function
|
728
745
|
)
|
729
746
|
curr_seq.root.order = new_input_json['order']
|
730
747
|
curr_seq.root.numSamples = temp_num_samples
|
@@ -0,0 +1,2 @@
|
|
1
|
+
.revisit_notebook_widget button{background:#f0f0f0;border-radius:5px;border:1px solid #ccc;cursor:pointer;font-family:Roboto,sans-serif;font-size:1em;margin:5px;padding:5px 10px;transition:box-shadow .25s ease-in-out;&:hover{background:#e0e0e0;box-shadow:0 0 5px #ccc}&:active{background:#d0d0d0;box-shadow:0 0 5px #ccc inset}}.revisit_notebook_widget iframe{border:0;margin:0;width:100%}.revisit_notebook_widget{.sequence{width:100%;display:flex}.sequenceComponent{display:flex;padding-left:4px;padding-right:4px;padding-bottom:2px;&:hover{background:#0000001a}}.sequenceComponentIndividual{background:#000;width:5px;height:20px;margin-top:5px}}
|
2
|
+
/*# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vanMvd2lkZ2V0LmNzcyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLnJldmlzaXRfbm90ZWJvb2tfd2lkZ2V0IGJ1dHRvbiB7XG5cdGJhY2tncm91bmQ6ICNmMGYwZjA7XG5cdGJvcmRlci1yYWRpdXM6IDVweDtcblx0Ym9yZGVyOiAxcHggc29saWQgI2NjYztcblx0Y3Vyc29yOiBwb2ludGVyO1xuXHRmb250LWZhbWlseTogXCJSb2JvdG9cIiwgc2Fucy1zZXJpZjtcblx0Zm9udC1zaXplOiAxZW07XG5cdG1hcmdpbjogNXB4O1xuXHRwYWRkaW5nOiA1cHggMTBweDtcblx0dHJhbnNpdGlvbjogYm94LXNoYWRvdyAwLjI1cyBlYXNlLWluLW91dDtcblxuXHQmOmhvdmVyIHtcblx0XHRiYWNrZ3JvdW5kOiAjZTBlMGUwO1xuXHRcdGJveC1zaGFkb3c6IDAgMCA1cHggMCAjY2NjO1xuXHR9XG5cblx0JjphY3RpdmUge1xuXHRcdGJhY2tncm91bmQ6ICNkMGQwZDA7XG5cdFx0Ym94LXNoYWRvdzogMCAwIDVweCAwICNjY2Mg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