Skip to content

Commit 0f44f9d

Browse files
committed
Various IPAC related modelling and POF Videos etc
1 parent dcfc02d commit 0f44f9d

File tree

12 files changed

+915
-113
lines changed

12 files changed

+915
-113
lines changed

animation/change_gap_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def __init__(self, drawobj, my_wrdobj, count, mod_params):
208208

209209
self.show()
210210
scshframe = _screenshot()
211-
image.write_png('d:\Profile\oqb\Desktop\presentations\POF2025\Animation\gap_apple\ivue32_{}_g{}_s{}.png'.format(mod_params.shiftmode,mod_params.gap,mod_params.rowshift), scshframe)
211+
image.write_png('d:\Profile\oqb\Desktop\presentations\POF2025\Animation\gap_plain_apple\ivue32_{}_g{}_s{}.png'.format(mod_params.shiftmode,mod_params.gap,mod_params.rowshift), scshframe)
212212
self.close()
213213

214214

@@ -268,8 +268,8 @@ def on_draw(self, event):
268268
#create ID
269269

270270
#shift loop
271-
for mode in ['circular', 'linear']:
272-
for shift in range(32,33,16):
271+
for mode in ['circular']:
272+
for shift in range(0,17,16):
273273
for gap in range (6, 326,1):
274274
ggap = (gap-6)/8+6
275275
rd.UtiDelAll()
@@ -286,7 +286,7 @@ def on_draw(self, event):
286286

287287
#a = ArbAPPLE(model_parameters = a_param)
288288

289-
a = id1.compensatedAPPLEv2(model_parameters = a_param)
289+
a = id1.plainAPPLE(model_parameters = a_param)
290290

291291
#rd.ObjDrwOpenGL(a.cont.radobj)
292292

animation/create_vid.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@
77
import os
88
import numpy as np
99

10-
image_folder = 'd:\Profile\oqb\Desktop\presentations\POF2025\Animation\shift_plain_apple'
11-
video_name = 'circ_shift_plain.avi'
10+
image_folder = 'd:\Profile\oqb\Desktop\presentations\POF2025\Animation\gap_plain_apple'
11+
video_name = 'v_gap_plain.avi'
1212

1313

14-
image_ref = '{}\ivue32_circular_0.png'.format(image_folder)
14+
image_ref = '{}\ivue32_circular_g6.0_s16.png'.format(image_folder)
1515
frame = cv2.imread(image_ref)
1616
height, width, layers = frame.shape
1717

1818
video = cv2.VideoWriter(os.path.join(image_folder,video_name), 0, 40 , (width,height))
1919

20-
for i in np.arange(362):
20+
for i in np.arange(326):
2121
print(i)
22-
image = 'ivue32_circular_{}.png'.format(i)
22+
gap = (i-6)/8+6
23+
image = 'ivue32_circular_g{}_s16.png'.format(gap)
2324
video.write(cv2.imread(os.path.join(image_folder, image)))
2425

2526
cv2.destroyAllWindows()

animation/create_vid_force_vectors.py

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,33 @@
77
import os
88
import numpy as np
99

10-
image_folder = 'd:\Profile\oqb\Desktop\presentations\POF2025\Schaefer\pics'
10+
image_folder = 'd:\Profile\oqb\Desktop\presentations\POF2025\Forces\Plots'
1111

12-
vids = 'interpolate'
1312

14-
if vids == 'non_interpolate':
13+
14+
for result in ['forcevectorsapple_h',
15+
'forcevectorsapple_v',
16+
'forcevectorscompapple_h',
17+
'forcevectorscompapple_v']:
1518

16-
for result in ['bfield',
17-
'flux_density',
18-
'trajectory']:
19-
20-
21-
22-
image_ref = '{}/{}_gap_6.00_shift_0.00.png'.format(image_folder, result)
23-
frame = cv2.imread(image_ref)
24-
height, width, layers = frame.shape
25-
26-
27-
for s in ['0.00','-16.00','16.00','32.00','-32.00']:
28-
video_name = '{}_s{}_gap.avi'.format(result,s)
29-
video = cv2.VideoWriter(os.path.join(image_folder,'vids',video_name), 0, 0.625, (width,height))
30-
31-
for i in ['6.00','15.26','24.53','33.79','43.05']:
32-
image = '{}/{}_gap_{}_shift_{}.png'.format(image_folder,result,i, s)
33-
frame = cv2.imread(image)
34-
resized_frame = cv2.resize(frame,(width,height))
35-
#cv2.imwrite('')
36-
print('{} gives frame size {}, originally {}'.format(i,resized_frame.shape, frame.shape))
37-
video.write(resized_frame)
3819

39-
cv2.destroyAllWindows()
40-
video.release()
4120

42-
else:
43-
for result in ['flux_density_distribution',
44-
'power_distro']:
45-
46-
47-
48-
image_ref = '{}/{}_gap_6.00_shift_0.00_interpolated.png'.format(image_folder, result)
49-
frame = cv2.imread(image_ref)
50-
height, width, layers = frame.shape
51-
52-
53-
for s in ['0.00','-16.00','16.00','32.00','-32.00']:
54-
video_name = '{}_s{}_gap_interpolated.avi'.format(result,s)
55-
video = cv2.VideoWriter(os.path.join(image_folder,'vids',video_name), 0, 0.625, (width,height))
56-
57-
for i in ['6.00','15.26','24.53','33.79','43.05']:
58-
image = '{}/{}_gap_{}_shift_{}_interpolated.png'.format(image_folder,result,i, s)
59-
frame = cv2.imread(image)
60-
resized_frame = cv2.resize(frame,(width,height))
61-
#cv2.imwrite('')
62-
print('{} gives frame size {}, originally {}'.format(i,resized_frame.shape, frame.shape))
63-
video.write(resized_frame)
21+
image_ref = '{}\\forcevectorsapple_v6.png'.format(image_folder, result)
22+
frame = cv2.imread(image_ref)
23+
height, width, layers = frame.shape
6424

65-
cv2.destroyAllWindows()
66-
video.release()
67-
25+
26+
video_name = '{}gap.avi'.format(result)
27+
video = cv2.VideoWriter(os.path.join(image_folder,video_name), 0, 5, (width,height))
28+
29+
for i in range(41):
30+
image = '{}\\{}{}.png'.format(image_folder,result,i+6)
31+
frame = cv2.imread(image)
32+
# resized_frame = cv2.resize(frame,(width,height))
33+
#cv2.imwrite('')
34+
# print('{} gives frame size {}, originally {}'.format(i,resized_frame.shape, frame.shape))
35+
video.write(frame)
36+
37+
cv2.destroyAllWindows()
38+
video.release()
39+

animation/create_vid_stefan.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

animation/create_vid_stefan2.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'''
2+
Created on Apr 7, 2025
3+
4+
@author: oqb
5+
'''
6+
import cv2
7+
import os
8+
import numpy as np
9+
10+
image_folder = 'd:\\Profile\\oqb\\Desktop\\presentations\\POF2025\\Schaefer\\final_plots'
11+
12+
fin_plots = {
13+
'bfields' : 'bfield',
14+
'flux_densities' : 'fd',
15+
'flux_density_distributions' : 'fdd',
16+
'power_distributions' : 'pd',
17+
'trajectories': 'traj'
18+
}
19+
20+
for result in fin_plots:
21+
22+
23+
24+
image_ref = '{}\\{}\\{}_gap_7.00_shift_0.00.png'.format(image_folder, result, fin_plots[result])
25+
frame = cv2.imread(image_ref)
26+
height, width, layers = frame.shape
27+
28+
29+
for s in ['0.00','-8.00','8.00','-16.00','16.00']:
30+
video_name = '{}_s{}_gap.avi'.format(result,s)
31+
video = cv2.VideoWriter(os.path.join(image_folder,'final_vids',video_name), 0, 5, (width,height))
32+
33+
for i in range(7,48):
34+
image = '{}\\{}\\{}_gap_{}.00_shift_{}.png'.format(image_folder,result,fin_plots[result],i, s)
35+
frame = cv2.imread(image)
36+
resized_frame = cv2.resize(frame,(width,height))
37+
#cv2.imwrite('')
38+
print('{} gives frame size {}, originally {}'.format(i,resized_frame.shape, frame.shape))
39+
video.write(resized_frame)
40+
41+
cv2.destroyAllWindows()
42+
43+
video.release()

0 commit comments

Comments
 (0)