Skip to content

Commit 0fdfe2e

Browse files
committed
Update single fit tutorial
1 parent 573f6f9 commit 0fdfe2e

File tree

7 files changed

+3657
-25
lines changed

7 files changed

+3657
-25
lines changed

.github/workflows/build-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
# The notebooks are used to generate the documentation
101101
- name: Convert ${{ env.NOTEBOOKS_DIR }}/*.py to docs/${{env.NOTEBOOKS_DIR }}/*.ipynb
102102
run: |
103+
cp -R ${{ env.NOTEBOOKS_DIR }}/data docs/${{ env.NOTEBOOKS_DIR }}/
103104
jupytext ${{ env.NOTEBOOKS_DIR }}/*.py --to ipynb
104105
mv ${{ env.NOTEBOOKS_DIR }}/*.ipynb docs/${{ env.NOTEBOOKS_DIR }}/
105106

src/easydiffraction/plotting/plotters/plotter_plotly.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import darkdetect
12
import plotly.graph_objects as go
23
import plotly.io as pio
34

@@ -14,7 +15,7 @@
1415

1516

1617
class PlotlyPlotter(PlotterBase):
17-
pio.templates.default = 'plotly_white'
18+
pio.templates.default = 'plotly_dark' if darkdetect.isDark() else 'plotly_white'
1819

1920
def _get_trace(self, x, y, label):
2021
mode = SERIES_CONFIG[label]['mode']

src/easydiffraction/project.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
import datetime
33
import tempfile
44
from textwrap import wrap
5-
65
from varname import varname
7-
from tabulate import tabulate
6+
from typing import List
87

98
from easydiffraction.utils.formatting import (
109
paragraph,
@@ -83,8 +82,8 @@ def update_last_modified(self) -> None:
8382

8483
def as_cif(self) -> str:
8584
"""Export project metadata to CIF."""
86-
wrapped_title: List[str] = wrap(self.title, width=60)
87-
wrapped_description: List[str] = wrap(self.description, width=60)
85+
wrapped_title: List[str] = wrap(self.title, width=46)
86+
wrapped_description: List[str] = wrap(self.description, width=46)
8887

8988
title_str: str = f"_project.title '{wrapped_title[0]}'"
9089
for line in wrapped_title[1:]:

src/easydiffraction/utils/formatting.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ def chapter(title: str) -> str:
88
full_title = f" {title.upper()} "
99
pad_len = (WIDTH - len(full_title)) // 2
1010
padding = SYMBOL * pad_len
11-
line = f"{Fore.MAGENTA + Style.BRIGHT}{padding}{full_title}{padding}{Style.RESET_ALL}"
11+
line = f"{Fore.LIGHTMAGENTA_EX + Style.BRIGHT}{padding}{full_title}{padding}{Style.RESET_ALL}"
1212
if len(line) < WIDTH:
1313
line += SYMBOL
1414
return f'\n{line}'
1515

1616
def section(title: str) -> str:
1717
"""Formats a section header with bold green text."""
1818
full_title = f'*** {title.upper()} ***'
19-
return f"\n{Fore.GREEN + Style.BRIGHT}{full_title}{Style.RESET_ALL}"
19+
return f"\n{Fore.LIGHTGREEN_EX + Style.BRIGHT}{full_title}{Style.RESET_ALL}"
2020

2121
def paragraph(title: str) -> str:
2222
"""Formats a subsection header with bold blue text while keeping quoted text unformatted."""
2323
import re
2424
parts = re.split(r"('.*?')", title)
25-
formatted = f"{Fore.BLUE + Style.BRIGHT}"
25+
formatted = f"{Fore.LIGHTBLUE_EX + Style.BRIGHT}"
2626
for part in parts:
2727
if part.startswith("'") and part.endswith("'"):
28-
formatted += Style.RESET_ALL + part + Fore.BLUE + Style.BRIGHT
28+
formatted += Style.RESET_ALL + part + Fore.LIGHTBLUE_EX + Style.BRIGHT
2929
else:
3030
formatted += part
3131
formatted += Style.RESET_ALL
3232
return f"\n{formatted}"
3333

3434
def error(title: str) -> str:
3535
"""Formats an error message with red text."""
36-
return f"\n{Fore.RED}Error{Style.RESET_ALL}\n{title}"
36+
return f"\n{Fore.LIGHTRED_EX}Error{Style.RESET_ALL}\n{title}"
3737

3838
def warning(title: str) -> str:
3939
"""Formats a warning message with yellow text."""
40-
return f"\n⚠️ {Fore.YELLOW}Warning{Style.RESET_ALL}\n{title}"
40+
return f"\n⚠️ {Fore.LIGHTYELLOW_EX}Warning{Style.RESET_ALL}\n{title}"
4141

4242
def info(title: str) -> str:
4343
"""Formats an info message with cyan text."""
44-
return f"\nℹ️ {Fore.CYAN}Info{Style.RESET_ALL}\n{title}"
44+
return f"\nℹ️ {Fore.LIGHTCYAN_EX}Info{Style.RESET_ALL}\n{title}"

tools/prepare_docs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cp ../assets-branding/easydiffraction/icons/bw.svg overrides/.icons/easydiffract
1515
cp ../assets-branding/easyscience-org/icons/eso-icon_bw.svg overrides/.icons/easyscience.svg
1616

1717
echo "\033[0;33m:::::: Add Jupyter notebooks from the project to the docs/\033[0m"
18+
cp -R tutorials/data docs/tutorials/
1819
jupytext tutorials/*.py --to ipynb
1920
mv tutorials/*.ipynb docs/tutorials/
2021

0 commit comments

Comments
 (0)