This tool creates specialized log-log plots with diagonal reference lines that help identify shear stress patterns in velocity profiles. The diagonal lines represent constant shear rates (u = α·y), making it easy to visualize where your data follows linear shear relationships.
Enhance your data analysis with custom Xarray accessors for detecting and visualizing both positive and negative peaks in 1D signals. This Python code snippet makes it easy to identify and annotate peaks directly on your plots. doc xarray
- Find Peaks: Utilize the
find_peaks
accessor to detect peaks in your DataArray. - Plot Peaks: With the
plot_peaks
accessor, visualize positive and negative peaks on your plots, including annotations for peak indices.
This Python script is designed to load images from a specified directory using a ThreadPoolExecutor
for concurrent execution. It reads all .tif
files from the "tif" directory and processes them in parallel, utilizing multiple threads to speed up the image loading process.
✅Important Note: The order of the images is preserved throughout this process. The executor.map
method guarantees that the results are returned in the same order as the input paths, ensuring that the correspondence between the file paths and the loaded images is maintained.
- 🖥️ os (built-in): For interacting with the operating system to list files in a directory.
- 📷 cv2 (OpenCV, to be installed): For reading image files.
- 📁 pathlib (built-in): For manipulating filesystem paths in a platform-independent way.
- 🌐 concurrent.futures.ThreadPoolExecutor (built-in): For managing a pool of threads to execute calls asynchronously.
""" | |
Author: Clement TIFFON | |
Date: 14-06-2023 | |
Description: This is a simple GUI for the OpenAI Text-to-Speech API. This is an example of a Streamlit app that uses the OpenAI API to convert text to speech. The app allows users to enter text in a chat input field, which is then converted to speech using the OpenAI API. The app displays the chat history and the corresponding audio files. The app uses the OpenAI Python client library to interact with the OpenAI API. The app also uses the Streamlit chat input and audio components to create a chat interface for the user. The app is a simple example of how to use the OpenAI API with Streamlit to create a text-to-speech application. | |
to run the app, you need to install the following libraries: | |
- streamlit | |
- openai | |
- numpy |
import codecs | |
import nbformat | |
import re | |
def grab_value_from_notebook(file_path, pattern): | |
""" | |
This function opens a Jupyter notebook file and searches for a specific pattern in the outputs of the code cells. | |
If the pattern is found, it returns the first group of the match as a float. | |
""" | |
import matplotlib as mpl | |
def draw_loglog_slope(fig, ax, origin, width_inches, slope, inverted=False, color=None, polygon_kwargs=None, label=True, labelcolor=None, label_kwargs=None, zorder=None): | |
""" | |
This function draws slopes or "convergence triangles" into loglog plots. | |
@param fig: The figure | |
@param ax: The axes object to draw to | |
@param origin: The 2D origin (usually lower-left corner) coordinate of the triangle | |
@param width_inches: The width in inches of the triangle |