-
Notifications
You must be signed in to change notification settings - Fork 9
[DOC] MyST examples and other visualization changes #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fa047d2
[VIZ] Improving some visualization things; rename V1V3 to Early Visual
36000 b58ba74
loop GIFs infinitely
36000 0b80051
switch to mp4 over gif
36000 d6889a2
add customizable crf
36000 673f8ef
refactor segsft code
36000 947fd82
bf
36000 c90080d
use np.float32 in segmentedTR
36000 7d23e19
try reducing resolution
36000 bbe56f4
make plot_stages_of_tractometry use less resources
36000 32768ec
First draft of myst notebook system
36000 1aef7df
update syntax in md files
36000 5b93af2
Add examples to index and update parser
36000 2295fd5
copilot suggested tweaks to new docs system
36000 137b27d
faster plot stages of tractometry
36000 f277018
faster plot stages of tractometry
36000 01c5fa1
fix fatal bundles error
36000 1c07331
use tqdm auto, collapse outputs into scrollable boxes, and tweak the …
36000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| [codespell] | ||
| skip = [setup.cfg] | ||
| ignore-words-list = Reson, DNE, ACI, FPT, sagital, saggital, abd, Joo, Mapp, Commun, vor, Claus, coo | ||
| ignore-words-list = Reson, DNE, ACI, FPT, sagital, saggital, abd, Joo, Mapp, Commun, vor, Claus, coo, ans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,24 @@ | ||
| import os | ||
| import shutil | ||
| from glob import glob | ||
| import base64 | ||
|
|
||
| from sphinx_gallery.scrapers import figure_rst | ||
| from IPython.display import HTML | ||
|
|
||
|
|
||
| class PNGScraper(object): | ||
| def __init__(self): | ||
| self.seen = set() | ||
| def embed_video(path): | ||
| with open(path, "rb") as f: | ||
| mp4_data = base64.b64encode(f.read()).decode() | ||
| return HTML( | ||
| f'<video controls><source src="data:video/mp4;base64,{mp4_data}" ' | ||
| 'type="video/mp4"></video>' | ||
| ) | ||
|
|
||
| def __repr__(self): | ||
| return "PNGScraper" | ||
|
|
||
| def __call__(self, block, block_vars, gallery_conf): | ||
| # Find all PNG files in the directory of this example. | ||
| path_current_example = os.path.dirname(block_vars["src_file"]) | ||
| pngs = sorted(glob(os.path.join(path_current_example, "*.png"))) | ||
| def embed_image(path): | ||
| with open(path, "rb") as f: | ||
| img_data = base64.b64encode(f.read()).decode() | ||
| return HTML(f'<img src="data:image/png;base64,{img_data}"/>') | ||
|
|
||
| # Iterate through PNGs, copy them to the sphinx-gallery output directory | ||
| image_names = list() | ||
| image_path_iterator = block_vars["image_path_iterator"] | ||
| for png in pngs: | ||
| if png not in self.seen: | ||
| self.seen |= set(png) | ||
| this_image_path = image_path_iterator.next() | ||
| image_names.append(this_image_path) | ||
| shutil.move(png, this_image_path) | ||
| # Use the `figure_rst` helper function to generate rST for image files | ||
| return figure_rst(image_names, gallery_conf["src_dir"]) | ||
|
|
||
|
|
||
| class GIFScraper(object): | ||
| def __init__(self): | ||
| self.seen = set() | ||
|
|
||
| def __repr__(self): | ||
| return "GIFScraper" | ||
|
|
||
| def __call__(self, block, block_vars, gallery_conf): | ||
| # Find all GIF files in the directory of this example. | ||
| path_current_example = os.path.dirname(block_vars["src_file"]) | ||
| gifs = sorted(glob(os.path.join(path_current_example, "*.gif"))) | ||
|
|
||
| # Iterate through GIFs, copy them to the sphinx-gallery output directory | ||
| image_names = list() | ||
| image_path_iterator = block_vars["image_path_iterator"] | ||
| for gif in gifs: | ||
| if gif not in self.seen: | ||
| self.seen |= set(gif) | ||
| this_image_path = image_path_iterator.next() | ||
| image_names.append(this_image_path) | ||
| shutil.move(gif, this_image_path) | ||
| # Use the `figure_rst` helper function to generate rST for image files | ||
| return figure_rst(image_names, gallery_conf["src_dir"]) | ||
| def embed_html(path): | ||
| with open(path, "r") as f: | ||
| html_content = f.read() | ||
| return HTML(html_content) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.