SFPPy is fully compatible with Google Colab and AI tools! π This quick setup provides full functionality while ensuring privacy and confidentiality. In just a few clicks π±οΈ, you'll have the entire SFPPy framework cloned into your private workspace. π‘οΈβ¨
πΉ Why Google Colab β
Google Colab (colab.research.google.com) is a free, cloud-based Python environment πβοΈππ¨π»βπ» that enables seamless execution of computational workflows π without requiring local installation. When combined with the SFPPy framework πβ©π, Colab offers a powerful and flexible platform for running simulations, analyzing chemical migration data, and leveraging AI-driven tools π€.
β‘ Why AI? π€π
SFPPy is designed with a highly modular and Pythonic architecture, making it seamlessly compatible with advanced AI systems such as:
π Bottom line: AI can assist in code generation, optimization, documentation, debugging, and even regulatory compliance analysis when working with SFPPy. π
π Why AI Works So Well with SFPPy β
SFPPy
functions effortlessly.SFPPy
scripts using its class-based approach.SFPPy
βs architecture (layer objects, food-contact classes, Patankar-based solvers) breaks down complex operations into small, well-labeled steps, making it easy to extend or debug with AI assistance.
Tip
With Colab, SFPPy can be accessed from any device, including:
Windows, macOS, Linux (no installation needed)
Tablets or mobile devices (for quick analysis on the go)
This makes it ideal for:
β Academics & Researchers conducting chemical migration studies β Regulatory Experts analyzing EU 10/2011 compliance and others β Industry Professionals performing safety assessments
Follow these simple steps to get SFPPy running in Google Colab:
Note
The videos were recorded using a Dark Theme. You can enable or switch themes by navigating to Tools β Settings β Site β Theme in the top menu.
π― Congratulations! SFPPy is running in Google Colab! ππ
Colab AI can generate and modify Python code based on SFPPy.
Example prompt:
"Generate a list of properties forBHT
,Irganox 1076
,Irganox 1010
,Irgafos 168
, andDEHP
using migrant."
Important
SFPPy
on Collab
includes Toxtree, PubChem integration, and πͺπΊ EU 10/2011 positive list support.
Lists from πΊπΈ and π¨π³ are pending.
from patankar.loadpubchem import migrant, migrantToxtree # Chemical database tools
m1a = migrant("decabromodiphenyl ether") # Without ToxTree outputs
m1b = migrantToxtree("decabromodiphenyl ether") # With ToxTree outputs
m2 = migrant("BHT") # Positively listed substance
m1b # Display results
Tip
Google Colab supports interactive forms for structured data input.
xxxxxxxxxx
# Example Colab Form
%%form --col 2
# @title **Substance Contact Details** { display-mode: "form" }
# @markdown ### **Enter the details below:**
substance_name = "Irganox 1076" # @param {type:"string"}
contact_temp = 25.0 # @param {type:"number"}
contact_time = 10 # @param {type:"integer"}
form_date = "2025-03-18" # @param {type:"date"}
print(f"Substance: {substance_name}")
print(f"Contact Temperature: {contact_temp} Β°C")
print(f"Contact Time: {contact_time} days")
print(f"Date: {form_date}")
Tip
Colab provides free CPU and GPU access, which can be leveraged for:
Complex chemical migration modeling
Monte Carlo simulations with fast execution
Machine learning applications in regulatory compliance
Execute all notebook cells via Runtime β Run All.
Even without a GPU, SFPPy runs efficiently on Colabβs CPU-optimized environment, completing most calculations in typically under one or two seconds ποΈ.
Note
According to Google Colab FAQs. βIn the version of Colab that is free of charge notebooks can run for at most 12 hours, depending on availability and your usage patterns.β
Open additional SFPPy notebooks from
index.ipynb
.
Each notebook runs in an isolated session (Google policy).
SFPPy
provides an intuitive, interactive interface that simplifies the design of complex migration scenarios with minimal coding effort. These fully functional widgets are available in Google Colab and can be accessed directly from thegui.ipynb
notebook.While these tools streamline workflows and enhance usability, AI assistants may have difficulty interpreting user intent when working with graphical elements. Nevertheless, SFPPyβs visual approach significantly reduces the coding barrier and enables seamless model setup. π
π Example SFPPy GUI Screenshots:
Positively listed substances within πͺπΊ appear have blue information including details onon their applicable restrictions. | .
![]() |
Non-postively listed Substances are shown with toxilogical information in red, including relevant warnings and alerts. ![]() | .
![]() |
No external plotting libraries are requiredβeverything runs directly within the notebook. SFPPy provides built-in tools for exporting kinetic and concentration profile data in multiple formats.
π Example Output:
πΉ SFPPy exports both CF
(kinetics) and Cx
(concentration profiles) in four formats:
βοΈ CSV β For easy data handling
βοΈ XLS β Compatible with Excel
βοΈ PDF β For reports and documentation
βοΈ PNG β For visualization and presentations
π Example Exported Data:
Since the notebook contains all assumptions used for the simulation, it is recommended to download it as a Python script (
.py
) or as a Jupyter Notebook (.ipynb
) for reproducibility.
π Example Notebook Export Options:
Google Colab enables real-time collaboration, making it easy to:
β Share SFPPy notebooks with colleagues
β Work together on chemical safety analyses
β Use GitHub for version control
β Enable one-click access to SFPPy workflows via shared links
Warning
Colab notebooks can be accessed and edited by multiple users in real time. Changes made by one user will automatically sync after a short delay.
However, if two users edit the same cell at the same time, one set of changes may be lost upon refresh. To avoid conflicts, it is recommended to coordinate edits or use GitHub versioning.
Caution
Google Colab runs in a temporary environment, meaning files and changes π will be lost once the session ends.
Tip
π₯ You can download your scripts, images and text from your browser, but saving files to Google Drive is the best option. This tutorial will guide you through:
β
Mounting Google Drive in Google Colab
β
Saving specific files (scripts, results) or datasets
β
Saving an entire GitHub repository
Before saving any data, you need to connect Google Drive to Google Colab.
π Run the following code:
xxxxxxxxxx
from google.colab import drive
drive.mount('/content/drive')
πΉ This will prompt you to authorize access to your Google Drive.
πΉ Follow the on-screen instructions, copy the authentication code, and paste it into the prompt.
πΉ Once authenticated, Google Drive will be available under the /content/drive/My Drive/
path.
To keep your files organized, create a dedicated folder in your Google Drive. You can do this manually or using Python:
βximport os
from google.colab import drive
# Mount Google Drive
drive.mount('/content/drive')
# Create a folder inside Google Drive
folder_path = "/content/drive/My Drive/Colab_Files"
os.makedirs(folder_path, exist_ok=True)
print(f"Folder created at: {folder_path}")
πΉ This code will create a folder named "Colab_Files" inside Google Drive.
πΉ If the folder already exists, the script will not overwrite it.
To save a simple text file or any generated data:
xxxxxxxxxx
file_path = "/content/drive/My Drive/Colab_Files/sample.txt"
# Write a sample file
with open(file_path, "w") as file:
file.write("Hello, World from Google Colab!")
print(f"File saved at: {file_path}")
πΉ This saves "sample.txt" in Colab_Files inside Google Drive.
πΉ You can open Google Drive and check My Drive > Colab_Files > sample.txt.
To save a GitHub repository or any directory to Google Drive, follow these steps:
First, clone your GitHub repo inside Colab:
xxxxxxxxxx
!git clone https://github.com/ovitrac/SFPPy.git /content/SFPPy
This will create a local copy of the repository in Colab under /content/SFPPy/
.
Now, move the entire repository to Google Drive:
xxxxxxxxxx
import shutil
repo_path = "/content/SFPPy"
drive_repo_path = "/content/drive/My Drive/SFPPy_Backup"
# Copy the repository to Google Drive
shutil.copytree(repo_path, drive_repo_path)
print(f"Repository saved at: {drive_repo_path}")
πΉ This copies the entire SFPPy repository to your Google Drive under My Drive > SFPPy_Backup.
If you need to reload a saved file in a future Colab session:
xxxxxxxxxx
file_path = "/content/drive/My Drive/Colab_Files/sample.txt"
# Read the file
with open(file_path, "r") as file:
content = file.read()
print("File Content:", content)
Similarly, to restore the full repository:
xxxxxxxxxx
import shutil
# Define paths
drive_repo_path = "/content/drive/My Drive/SFPPy_Backup"
local_repo_path = "/content/SFPPy"
# Copy back to Colab
shutil.copytree(drive_repo_path, local_repo_path)
print("Repository restored in:", local_repo_path)
πΉ Google Colab's storage is temporary β always save important work to Google Drive.
πΉ Use shutil.copytree
to back up and restore large folders.
πΉ Google Drive syncs automatically, so you can access files from anywhere.
π Now your files and repository are safe inside Google Drive! π
π You're now ready to explore SFPPy, run examples, and customize scripts!
Do not forget to download your scripts on Google Drive on your local disk.π‘π¬
To deepen your understanding of Jupyter Notebooks and Google Colab, here are some highly recommended tutorials and learning resources from reputable sources.
1οΈβ£ Dataquest's Beginner Tutorial
Step-by-step guide to creating and managing Jupyter Notebooks
Covers essential components and best practices
2οΈβ£ DataCamp's Ultimate Guide
Comprehensive overview of Jupyter's structure and functionalities
Explains markdown, cells, and advanced features
3οΈβ£ GeeksforGeeks: How to Use Jupyter Notebook
Installation, basic operations, and key shortcuts
4οΈβ£ YouTube Video: Jupyter Notebook Tutorial
Interactive walkthrough of Jupyterβs interface and features
1οΈβ£ Google's Official Colab Guide
Introduction to Google Colabβs cloud-based Python environment
How to write and execute Python code in a browser
2οΈβ£ GeeksforGeeks: How to Use Google Colab
Covers interface navigation, running code, and collaboration
3οΈβ£ Marqoβs Beginner Guide to Google Colab
Overview of Colabβs capabilities, including GPU usage and file management
4οΈβ£ YouTube Video: Google Colab for Beginners
Step-by-step video tutorial on using Colab effectively
β
Jupyter Notebooks are great for local Python development with high flexibility.
β
Google Colab provides a cloud-based alternative with free resources and easy sharing.
β
Both platforms support interactive computing, data visualization, and AI workflows.
With these resources, you can quickly master Jupyter and Colab to enhance your SFPPy experience! π
π More details π SFPPy GitHub Repository