Skip to content
Merged

Smoo #71

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions Notebooks_Unused/n_search_fail.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "47f4a073",
"metadata": {},
"outputs": [],
"source": [
"%reload_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "282a714d",
"metadata": {},
"outputs": [],
"source": [
"from cereeberus import Interleave, MapperGraph, ReebGraph\n",
"\n",
"import cereeberus.data.ex_reebgraphs as ex_rg\n",
"import cereeberus.data.ex_mappergraphs as ex_mg"
]
},
{
"cell_type": "markdown",
"id": "e191f088",
"metadata": {},
"source": [
"# Create torus and line mappers of mismatched heights"
]
},
{
"cell_type": "markdown",
"id": "d1a6c618",
"metadata": {},
"source": [
"### It works when the difference is 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6c6b8ae9",
"metadata": {},
"outputs": [],
"source": [
"line = ex_mg.line(a=0, b= 16)\n",
"torus = ex_mg.torus(a=0, b =2, c = 13, d = 17)\n",
"myInt = Interleave(torus, line)\n",
"result = myInt.fit()\n",
"dist_result = myInt.dist_fit() # dist_fit function optimizes with the distance matrix\n",
"print(f\"Interleaving distance: {result}\")\n",
"print(f\"Interleaving distance (with dist_fit): {dist_result}\")"
]
},
{
"cell_type": "markdown",
"id": "30459cf0",
"metadata": {},
"source": [
"### But fails when the difference is more than 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ee3dea41",
"metadata": {},
"outputs": [],
"source": [
"line = ex_mg.line(a =0, b= 16)\n",
"torus = ex_mg.torus(a=0, b =2, c = 13, d = 18)\n",
"myInt = Interleave(torus, line)\n",
"result = myInt.fit()\n",
"dist_result = myInt.dist_fit() # dist_fit function optimizes with the distance matrix\n",
"print(f\"Interleaving distance: {result}\")\n",
"print(f\"Interleaving distance (with dist_fit): {dist_result}\")"
]
},
{
"cell_type": "markdown",
"id": "b442c31a",
"metadata": {},
"source": [
"I checked the code and I think the problem is in the boundary matrix computation. Which affects the edge-vertex parallelogram checks. Tried fixing, but haven't figured it out yet."
]
},
{
"cell_type": "markdown",
"id": "c17be785",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "interleavingenv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
100 changes: 100 additions & 0 deletions Notebooks_Unused/sandbox_fixing_optimization.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "3d7c8bc8",
"metadata": {},
"outputs": [],
"source": [
"%reload_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a632ce73",
"metadata": {},
"outputs": [],
"source": [
"from cereeberus import Interleave, MapperGraph, Assignment\n",
"import cereeberus.data.ex_mappergraphs as ex_mg\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import networkx as nx"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "44844a7b",
"metadata": {},
"outputs": [],
"source": [
"mg1 = ex_mg.line(0, 20)\n",
"mg2 = ex_mg.torus(0, 2, 17, 18)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0657e22b",
"metadata": {},
"outputs": [],
"source": [
"myInt = Interleave(mg1, mg2)\n",
"myInt.fit(verbose=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6a5a4786",
"metadata": {},
"outputs": [],
"source": [
"from cereeberus import ReebGraph\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "88cb17ae",
"metadata": {},
"outputs": [],
"source": [
"# Example point cloud (you can replace this with your own)\n",
"points = np.random.rand(500, 3) # 500 points in 3D\n",
"\n",
"# Define a scalar function on these points — say, height (z-coordinate)\n",
"values = points[:, 2]\n",
"\n",
"# Build and compute the Reeb graph\n",
"rg = ReebGraph()\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "interleavingenv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading