Ticket #14386: thresholding_movie.py

File thresholding_movie.py, 969 bytes (added by d.dannecker@…, 21 months ago)

Added by email2trac

Line 
1# Import necessary module
2from chimerax.core.commands import run
3
4# Define your map model number
5map_model_number = 1
6
7# Define the range of threshold values you want to cycle through
8# For example, from 0.1 to 1.0 in steps of 0.1
9threshold_start = 0.1
10threshold_end = 1.0
11threshold_step = 0.1
12
13# Define the number of frames for each threshold value
14frames_per_threshold = 10
15
16# Start recording the movie
17run(session, 'movie record')
18
19# Loop through the threshold values
20current_threshold = threshold_start
21while current_threshold <= threshold_end:
22 # Set the threshold for the map
23 run(session, f'volume #{map_model_number} level {current_threshold}')
24
25 # Wait for the given number of frames
26 run(session, f'wait {frames_per_threshold}')
27
28 # Increment the threshold
29 current_threshold += threshold_step
30
31# Stop recording the movie
32run(session, 'movie stop')
33
34# Encode the movie to an MP4 file
35run(session, 'movie encode output my_movie.mp4')