Skip to content

Commit

Permalink
fix links to images
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasibalic committed Dec 31, 2023
1 parent f959467 commit 7799b62
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
24 changes: 12 additions & 12 deletions docs/ifigures_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
::: ifigures.InteractiveFigure

!!! tip "Why use interactive figure?"
This is discussed in [Physics World blogpost and comment](../example_gallery/#motivation-and-goals). In short, we want to allow exploration of many untold stories and edge cases. To build intuition, connections and maybe get
This is discussed in [Physics World blogpost and comment](example_gallery.md/#motivation-and-goals). In short, we want to allow exploration of many untold stories and edge cases. To build intuition, connections and maybe get
inspired for further work!

!!! Example "Simple interactive figure"
Expand Down Expand Up @@ -89,7 +89,7 @@
print(figure_example1.overallCaption)

```
![static figure example](./assets/example_static.png)
![static figure example](assets/example_static.png)


`(a) Amplitude = 0.50, omega = 1.00, color = red, f(t) = amplitude * sin(omega*x). Highlighted time = 1.50, (b) Amplitude = 0.50, omega = 3.00, color = blue, f(t) = amplitude * sin(omega*x). Highlighted time = 1.60, (c) Amplitude = 0.50, omega = 1.00, color = red, f(t) = amplitude * cos(omega*x). Highlighted time = 1.50, (d) Amplitude = 0.50, omega = 3.00, color = blue, f(t) = amplitude * cos(omega*x). Highlighted time = 1.60`
Expand All @@ -102,22 +102,22 @@ Inputs for interactive figures are range sliders (including specially coloured `
::: ifigures.RangeWidget

!!! Example "Example: a static snapshot of input control widget"
![Range widget](./assets/widget_range.png)
![Range widget](assets/widget_range.png)

::: ifigures.RangeWidgetViridis

!!! Example "Example: a static snapshot of input control widget"
![Range widget viridis for time](./assets/widget_range_viridis.png)
![Range widget viridis for time](assets/widget_range_viridis.png)

::: ifigures.RadioWidget

!!! Example "Example: a static snapshot of input control widget"
![Radio widget](./assets/widget_radio_button.png)
![Radio widget](assets/widget_radio_button.png)

::: ifigures.DropDownWidget

!!! Example "Example: a static snapshot of input control widget"
![Drop down widget](./assets/widget_dropdown.png)
![Drop down widget](assets/widget_dropdown.png)

## Interactive timeline

Expand Down Expand Up @@ -157,7 +157,7 @@ Inputs for interactive figures are range sliders (including specially coloured `
```
produces

![Annotation example](./assets/annotation_example.png)
![Annotation example](assets/annotation_example.png)

!!! tip "Why should one use annotations?"
Modern figures in reserach papers are often dense with information,
Expand Down Expand Up @@ -201,14 +201,14 @@ Some special commands are defined by default for use in equation environment
```
results in

![highlighted equations](./assets/equation_example.png)
![highlighted equations](assets/equation_example.png)

## Quantum state visualisations

::: ifigures.getComplexColor

!!! example "Mapping complex numbers to colors"
![Complex color mapping](./assets/complex_color_mapping.png){width=300px align=right}
![Complex color mapping](assets/complex_color_mapping.png){width=300px align=right}
Mapping of complex number $A e^{i \phi}$ with amplitude $A$ and phase $\phi$
to colours used by the library.
Note that complementary colours correspond
Expand Down Expand Up @@ -271,7 +271,7 @@ Some special commands are defined by default for use in equation environment
bs.plot(axis=ax1)

```
![Bloch sphere example](./assets/bs_example.png)
![Bloch sphere example](assets/bs_example.png)

Example above shows Bloch sphere, with annotated key points of the sphere,
state trajectory in time shown as line with time encoded in viridis gradient,
Expand All @@ -295,7 +295,7 @@ Some special commands are defined by default for use in equation environment

plt.show()
```
![tst](./assets/dm_example.png)
![tst](assets/dm_example.png)

!!! tip "Why use coloured density matrixes"
They are capable of quickly conveying numerical results, arguably providing
Expand Down Expand Up @@ -343,7 +343,7 @@ Some special commands are defined by default for use in equation environment
plt.show()
```

![example of state with dynamics indicated](./assets/example_state.png)
![example of state with dynamics indicated](assets/example_state.png)

- State blob with color and size correspond to phase and amplitude
- small gray dot on the blobs indicates phasor tip, to allow also for colour blind readout
Expand Down
2 changes: 1 addition & 1 deletion ifigures/amoplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def plot (self, axis:plt.axis, rho, visualise="with dots"):
referenceDots["x"].append(col)
referenceDots["y"].append(row)

RGB=np.dstack((R, G, B))
RGB=np.dstack((R, G, B)).transpose()
axis.imshow(RGB)

if (visualise == "with dots"):
Expand Down
6 changes: 3 additions & 3 deletions ifigures/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,16 @@ def saveStaticFigure(self, fileName:str, values: List[List]=None, figuresPerRow=
Args:
fileName (str): filename with extension (e.g. `example.png`).
values (List[List], optional): List of Lists of arguments. For each
one static panel will be created. If not specified will use
all the values provided by the Input widgets.
one static panel will be created. If not specified will use
all the values provided by the Input widgets.
figuresPerRow (int, optional): Number of panels per final figure row.
labelPanels (bool, optional): Should we label panels with `(a), (b), ...`
dpi (int, optional): resolution in dots per inch.
labelSize (int, optional): Label size for individual panels
labelOffset (tuple, optional): Offset position of label.
labelGenerator (_type_, optional): _description_.
compress (bool, optional): Should we use [pngquant](https://pngquant.org/) to compress final
figure.
figure.
"""
self.compress = compress
names = [name for name in self.widgets]
Expand Down
5 changes: 3 additions & 2 deletions ifigures/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import matplotlib.colors as mcolors
import numpy as np
import colorsys
from typing import List
from PIL import Image

mpl.rcParams['xtick.minor.visible'] = True
Expand Down Expand Up @@ -155,7 +156,7 @@ def getColor(amplitude, phase, maxAmplitude):
return (c[0], c[1], c[2], 1.0)


def getComplexColor(complexNo:complex, maxAmplitude:float):
def getComplexColor(complexNo:complex, maxAmplitude:float)->List[float]:
"""
Get color for a complex numbers
Expand All @@ -170,7 +171,7 @@ def getComplexColor(complexNo:complex, maxAmplitude:float):
white color for zero amplitude.
Returns:
color as [red, green, blue, alpha]
List[float]: color as [red, green, blue, alpha]
"""
angle = np.angle(complexNo)
if angle < 0:
Expand Down
2 changes: 1 addition & 1 deletion ifigures/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, values:List[type[str | float]], name=None,
values (List[type[str | float]]): drop down option values
name (_type_, optional): _description_.
labels (List[str], optional): labels for drop down options. By default
they are same as values.
they are same as values.
default (_type_, optional): _description_.
divclass (_type_, optional): _description_.
delimiter (str, optional): _description_.
Expand Down

0 comments on commit 7799b62

Please sign in to comment.