| 1 | # Import necessary module
|
|---|
| 2 | from chimerax.core.commands import run
|
|---|
| 3 |
|
|---|
| 4 | # Define your map model number
|
|---|
| 5 | map_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
|
|---|
| 9 | threshold_start = 0.1
|
|---|
| 10 | threshold_end = 1.0
|
|---|
| 11 | threshold_step = 0.1
|
|---|
| 12 |
|
|---|
| 13 | # Define the number of frames for each threshold value
|
|---|
| 14 | frames_per_threshold = 10
|
|---|
| 15 |
|
|---|
| 16 | # Start recording the movie
|
|---|
| 17 | run(session, 'movie record')
|
|---|
| 18 |
|
|---|
| 19 | # Loop through the threshold values
|
|---|
| 20 | current_threshold = threshold_start
|
|---|
| 21 | while 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
|
|---|
| 32 | run(session, 'movie stop')
|
|---|
| 33 |
|
|---|
| 34 | # Encode the movie to an MP4 file
|
|---|
| 35 | run(session, 'movie encode output my_movie.mp4')
|
|---|