Supporting code for the research article Light-Driven Multidirectional Bending in Artificial Muscles (open access on Advanced Materials https://doi.org/10.1002/adma.202405917)
These instructions will guide you through getting a copy of the project up and running on your local machine for development and testing purposes.
This project requires Miniconda to manage dependencies and create an isolated environment. If you don't have Miniconda installed, follow the instructions on the Miniconda website to download and install it.
First, clone the repository to get a local copy of the project. Then, navigate to the project directory.
git clone https://github.com/p3d2/LTCAM.git
cd LTCAM This project comes with an env.yml file that specifies all the necessary dependencies and their versions. To create a Miniconda environment with these dependencies, use the following command:
mamba env create -f env.yml -p env/This command creates a new Conda environment named LTCAM and installs all the required packages listed in env.yml.
Activating the Environment Before running the scripts, ensure that the LTCAM environment is activated:
conda activate ./envBefore running the analysis scripts, it is essential to download the raw data files and place them in the appropriate directory within the project repository. The raw data for this project is hosted on Zenodo. Follow the steps below to prepare your data for analysis:
- Visit the Zenodo link https://zenodo.org/records/10695914
- Download the dataset to your local machine.
- Extract the files.
- Create a folder named
datain the root directory of your project repository. - Copy all the downloaded raw data files into the
datafolder. - Ensure the
dir_pathvariable in each Python script (LTCAMAnalysis.py,ButterflyTrack.py, andRotatingTrack.py) is set to the path of thedatafolder. This may look likedir_path = "./data"depending on your directory structure.
By following these steps, your data will be correctly positioned for analysis, and the scripts should run without issues related to data file locations.
In this project, multiple Python files are utilized to process raw data, track movements, and generate plots and videos. Below is an overview of what each script does:
- Functionality: This script initiates the data processing workflow by creating a "processed" folder, within which a subfolder named "LTCAM" is generated. Inside the "LTCAM" folder, it further creates subfolders named "Measurements", "Plots", and "Videos".
- Purpose: It analyzes raw data to make measurements and produce an infrared video, organizing the output into the respective subfolders.
- Configuration:
dir_pathUpdate this variable to point to the directory where the data files folder is located.c- This integer value should be set between 0 and 13, indicating the specific file to be processed for LTCAM analysis.
- Functionality: These scripts are designed to generate plots based on the measurement data obtained from running
LTCAMAnalysis.py.Plots 1.pyshould be run afterLTCAMAnalysis.pyhas been executed withcvalues ranging from 0 to 5.Plots 2.pyrequiresLTCAMAnalysis.pyto be run withcvalues from 6 to 13.
- Purpose: They store the generated plots in the "Plots" subfolder within the "LTCAM" directory, visually representing the analysis results.
- Configuration:
dir_pathUpdate this variable to point to the directory where the data files folder is located.
- Functionality: Similar to
LTCAMAnalysis.py, this script creates a "processed" folder with a specific subfolder named "Butterfly", which then contains "Measurements", "Plots", and "Videos" subfolders. - Purpose: It tracks the movement of a butterfly textile, producing a video that showcases this tracking alongside the relevant measurements and plots.
- Configuration:
dir_pathUpdate this variable to point to the directory where the data files folder is located.c- This integer value should be set between 0 and 1, indicating the specific file to be processed for RotatingTrack analysis.
- Functionality: This script processes raw data from videos of a LTCAM on a rotating platform. It creates a "processed" folder with a "Rotating" subfolder, which also includes "Measurements", "Plots", and "Videos" subfolders.
- Purpose: It performs circumnutation tracking measurements and generates an infrared video of the LTCAM's movement.
- Configuration:
dir_pathUpdate this variable to point to the directory where the data files folder is located.c- This integer value should be set between 0 and 5, indicating the specific file to be processed for RotatingTrack analysis.
- Functionality: Tailored to work with data from
RotatingTrack.py, this script needs to be run afterRotatingTrack.pyhas processed data withcvalues from 0 to 5. - Purpose: It analyzes the circumnutation movement, specifically focusing on the position of the LTCAM's end, and generates corresponding plots stored in the "Plots" subfolder of the "Rotating" directory.
- Configuration:
dir_pathUpdate this variable to point to the directory where the data files folder is located.
Before running the Python scripts, change the dir_path and c variables as mentioned in the configuration of each file. Then, the scripts can be run using the following command:
python PYTHONFILE.pyThis project is licensed under the MIT License - see the LICENSE.md file for details.
We acknowledge the computational resources provided by the Aalto Science-IT project.
