Skip to content

Commit

Permalink
started low dimensional mappings for joint polytopic regions.
Browse files Browse the repository at this point in the history
  • Loading branch information
victoraalves committed Apr 15, 2024
1 parent 2ee7b89 commit 2a1cae6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 1 deletion.
61 changes: 60 additions & 1 deletion src/opyrability.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,66 @@ def AIS2AOS_map(model: Callable[...,Union[float,np.ndarray]],
if plot is False:
pass
elif plot is True:
if input_map.shape[-1] == 2 and AOS.shape[-1] == 2:

if input_map.shape[-1] == 1 and AOS.shape[-1] == 1:


input_plot = input_map.reshape(np.prod(input_map.shape[0:-1]),
input_map.shape[-1])

AOS_plot = AOS.reshape(np.prod(AOS.shape[0:-1]), AOS.shape[-1])

_, ax = plt.subplots(nrows=1,ncols=1,
constrained_layout=True)

plt.rcParams['figure.facecolor'] = 'white'
ax.scatter(input_plot[:, 0], AOS_plot[:, 1], s=16,
c=np.sqrt(AOS_plot[:, 0]**2),
cmap=cmap, antialiased=True,
lw=lineweight, marker='s',
edgecolors=edgecolors)


elif input_map.shape[-1] == 2 and AOS.shape[-1] == 1:


input_plot = input_map.reshape(np.prod(input_map.shape[0:-1]),
input_map.shape[-1])

AOS_plot = AOS.reshape(np.prod(AOS.shape[0:-1]), AOS.shape[-1])

_, (ax1, ax2) = plt.subplots(nrows=1,ncols=2,
constrained_layout=True)

plt.rcParams['figure.facecolor'] = 'white'
ax1.scatter(input_plot[:, 0], input_plot[:, 1], s=16,
c=np.sqrt(AOS_plot[:, 0]**2),
cmap=cmap, antialiased=True,
lw=lineweight, marker='s',
edgecolors=edgecolors)

ax1.set_xlabel('$u_{1}$')
if (EDS_bound and EDS_resolution) is None:
ax1.set_title('$AIS_{u}$')
ax1.set_ylabel('$u_{2}$')
else:
ax1.set_title('$AIS_{u} \, and \, EDS_{d}$')
ax1.set_ylabel('$d_{1}$')


ax2.scatter(AOS_plot[:, 0], np.array([np.zeros(AOS_plot[:,0].size),]).T, s=16,
c=np.sqrt(AOS_plot[:, 0]**2),
cmap=cmap, antialiased=True,
lw=lineweight, marker='o',
edgecolors=edgecolors)

# ax2.set_ylabel('$y_{2}$')
plt.xlabel('$y_{1}$')
plt.yticks([])

ax2.set_title('$AOS$')

elif input_map.shape[-1] == 2 and AOS.shape[-1] == 2:

input_plot = input_map.reshape(np.prod(input_map.shape[0:-1]),
input_map.shape[-1])
Expand Down
21 changes: 21 additions & 0 deletions tests/dma_mr.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,27 @@ def dma_mr_design(u):
return jnp.array([F_C6H6, X_CH4])



def dma_mr_2x1(u):


L = u[0]
dt = u[1]

# Initial conditions
y0 = jnp.hstack((Ft0, jnp.zeros(7)))
rtol, atol = 1e-10, 1e-10

z = jnp.linspace(0, L, 2000)
F = odeint(dma_mr_jax, y0, z, dt, rtol=rtol, atol=atol)


F_C6H6 = ((F[-1, 3] * 1000) * MM_B)
# X_CH4 = (100 * (Ft0 - F[-1, 0] - F[-1, 4]) / Ft0)

return jnp.array([F_C6H6])


def dma_mr_mvs(u):


Expand Down

0 comments on commit 2a1cae6

Please sign in to comment.