Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9fe1f45 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-donarise committed Sep 1, 2024
1 parent 4c45638 commit 3d4b6ee
Show file tree
Hide file tree
Showing 14 changed files with 8,215 additions and 7,722 deletions.
7,654 changes: 3,874 additions & 3,780 deletions node.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node.d.ts.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node.deps.json

Large diffs are not rendered by default.

123 changes: 92 additions & 31 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17988,25 +17988,37 @@ var $;
json() {
return $mpds_visavis_plot_cube_json(this.plot_raw().json());
}
value_list() {
return this.json().payload.points.v.slice().sort((a, b) => a - b);
}
value_min() {
return this.value_list()[0];
if (this.heatmap_diif())
return this.points_traversed().diff_value_min;
return this.points_traversed().value_min;
}
value_max() {
return this.value_list().slice(-1)[0];
if (this.heatmap_diif())
return this.points_traversed().diff_value_max;
return this.points_traversed().value_max;
}
sort_dict() {
return $mpds_visavis_elements_list.prop_names();
}
order(order) {
return d3.range(95).sort((a, b) => $mpds_visavis_elements_list.element_by_num(a + 1)[order] - $mpds_visavis_elements_list.element_by_num(b + 1)[order]);
}
heatmap_diif() {
const jsons = this.multi_jsons();
if (jsons.length == 2) {
return jsons.every(json => json.payload.points.v.some(val => Math.floor(val) !== val));
}
return false;
}
heatmap() {
if (this.multi_jsons())
return false;
return this.json().payload.points.v.some(val => Math.floor(val) !== val);
if (this.heatmap_diif())
return this.intersection_only();
const jsons = this.multi_jsons();
let json = this.json();
if (jsons?.length == 1)
json = jsons[0];
return json.payload.points.v.some(val => Math.floor(val) !== val);
}
heatmap_color(index) {
return this.heatmap_colors()[index];
Expand All @@ -18018,10 +18030,20 @@ var $;
this.Heatmap_max(),
];
}
marker_heatmap(values) {
return {
color: values,
colorscale: 'Rainbow',
size: 4,
opacity: 0.9
};
}
marker(color_id) {
if (this.heatmap()) {
return this.marker_heatmap(this.json().payload.points.v);
}
return {
color: this.heatmap() ? this.json().payload.points.v : this.colorset()[color_id],
...this.heatmap() ? { colorscale: 'Rainbow' } : {},
color: this.colorset()[color_id],
size: 4,
opacity: 0.9
};
Expand Down Expand Up @@ -18051,18 +18073,22 @@ var $;
...this.convert_to_axes(this.json().payload.points.x, this.json().payload.points.y, this.json().payload.points.z, this.x_sort(), this.y_sort(), this.z_sort())
};
}
scatters() {
const values = new Map();
const entries = new Map();
points_traversed() {
const values_by_label = Object.fromEntries(this.multi_jsons().map((j, i) => [i, new Map]));
let value_min = Infinity;
let value_max = -Infinity;
const indexes_by_label = new Map();
const labels = new Set();
let points_x = [];
let points_y = [];
let points_z = [];
this.multi_jsons().map((json, index) => {
const points = $mpds_visavis_plot_cube_json(json).payload.points;
points.labels.forEach((label, i) => {
entries.get(label)?.push(index) ?? entries.set(label, [index]);
values.set([label, index], points.v[i]);
indexes_by_label.get(label)?.push(index) ?? indexes_by_label.set(label, [index]);
values_by_label[index].set(label, points.v[i]);
value_min = Math.min(value_min, points.v[i]);
value_max = Math.max(value_max, points.v[i]);
if (!labels.has(label)) {
labels.add(label);
points_x.push(points.x[i]);
Expand All @@ -18078,43 +18104,63 @@ var $;
y: converted.y[i],
z: converted.z[i],
}));
const new_scatter = (index) => {
const new_scatter = (marker) => {
return {
...this.scatter3d_common(),
marker: index == 'intersection' ? { color: "#303030", size: 5, opacity: 0.9 } : this.marker(index),
marker,
x: [],
y: [],
z: [],
v: [],
text: [],
};
};
const scatters_once = new Map();
const intersects = new_scatter('intersection');
entries.forEach((entry, label) => {
const no_intersects = new Map();
const intersects = new_scatter({ color: "#303030", size: 5, opacity: 0.9 });
const heatmap_diif = this.heatmap_diif();
let diff_value_min = Infinity;
let diff_value_max = -Infinity;
indexes_by_label.forEach((indexes, label) => {
const point = points.get(label);
let scatter = intersects;
if (entry.length == 1) {
const index = entry[0];
scatter = scatters_once.get(index) ?? new_scatter(index);
scatters_once.set(index, scatter);
scatter.v.push(values.get([label, index]));
if (indexes.length == 1) {
const index = indexes[0];
scatter = no_intersects.get(index) ?? new_scatter(this.marker(index));
no_intersects.set(index, scatter);
scatter.v.push(values_by_label[index].get(label));
}
else if (heatmap_diif) {
const v1 = values_by_label[indexes[0]].get(label);
const v2 = values_by_label[indexes[1]].get(label);
const diff = Math.abs(v1 - v2);
scatter.v.push(diff);
diff_value_min = Math.min(diff_value_min, diff);
diff_value_max = Math.max(diff_value_max, diff);
}
scatter.text.push(label);
scatter.x.push(point.x);
scatter.y.push(point.y);
scatter.z.push(point.z);
});
return { intersects, scatters_once };
return { intersects, no_intersects, value_min, value_max, diff_value_min, diff_value_max };
}
scatters_no_intersect() {
return this.points_traversed().no_intersects;
}
intersects_colored() {
const intersects = this.points_traversed().intersects;
const marker = this.heatmap()
? this.marker_heatmap(intersects.v)
: { color: "#303030", size: 5, opacity: 0.9 };
return { ...intersects, marker };
}
multi_dataset() {
if (!this.multi_jsons())
return null;
this.nonformers_checked(false);
const { intersects, scatters_once } = this.scatters();
return [
intersects,
...this.intersection_only() ? [] : scatters_once.values()
this.intersects_colored(),
...this.intersection_only() ? [] : this.scatters_no_intersect().values()
];
}
cmp_labels() {
Expand Down Expand Up @@ -18271,16 +18317,25 @@ var $;
], $mpds_visavis_plot_cube.prototype, "plot_body", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "value_list", null);
], $mpds_visavis_plot_cube.prototype, "value_min", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "value_max", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "sort_dict", null);
__decorate([
$mol_mem_key
], $mpds_visavis_plot_cube.prototype, "order", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "heatmap_diif", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "heatmap", null);
__decorate([
$mol_action
], $mpds_visavis_plot_cube.prototype, "marker_heatmap", null);
__decorate([
$mol_mem_key
], $mpds_visavis_plot_cube.prototype, "marker", null);
Expand All @@ -18295,7 +18350,13 @@ var $;
], $mpds_visavis_plot_cube.prototype, "data", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "scatters", null);
], $mpds_visavis_plot_cube.prototype, "points_traversed", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "scatters_no_intersect", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "intersects_colored", null);
__decorate([
$mol_mem
], $mpds_visavis_plot_cube.prototype, "multi_dataset", null);
Expand Down
2 changes: 1 addition & 1 deletion node.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 3d4b6ee

Please sign in to comment.