Skip to content

Commit 512c890

Browse files
committed
update way to check None in bands
1 parent fa764af commit 512c890

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

solsticepy/gen_yaml.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,11 @@ def gen_yaml(sun, hst_pos, hst_foc, hst_aims, hst_w, hst_h
310310
#
311311
### Section (5)
312312

313-
if bands.any()==None:
313+
if None in bands:
314314
if one_heliostat:
315315
bands=np.array([hst_foc, hst_foc, hst_foc])
316316
bands=bands.reshape(1,3)
317+
print('One heliostats: band', bands)
317318
else:
318319
dist=(hst_w+hst_h)/2.
319320
min_foc=np.min(hst_foc)
@@ -475,33 +476,33 @@ def gen_yaml(sun, hst_pos, hst_foc, hst_aims, hst_w, hst_h
475476
iyaml+='\n- entity:\n'
476477
iyaml+=' name: %s\n' % name_e
477478
iyaml+=' ' + yamltransform(pos=[hst_x[i], hst_y[i], hst_z[i]],rot=[0,0,0]) + '\n'
478-
iyaml+=' children: [ *%d ]\n' % name_hst_t
479+
iyaml+=' children: [ *%s ]\n' % name_hst_t
479480

480481
else: # single facet, paraboloid
481482
for i in range(len(bands)):
482-
foc=bands[i,1]
483-
name_hst_g = 'hst_g_band_'+str(i)
484-
iyaml+='- geometry: &%s\n' % name_hst_g
485-
if isinstance(slope_error, float):
486-
iyaml+=' - material: *%s\n' % 'material_mirror'
487-
else:
488-
idx_f=np.argmin(abs(hst_foc-foc))
489-
iyaml+=' - material: *%s\n' % 'material_mirror_%d'%idx_f
490-
491-
if shape=='parabolic-cylinder':
492-
iyaml+=" parabolic-cylinder:\n"
493-
iyaml+=' focal: %e\n' % foc
494-
elif shape=='sphere':
495-
iyaml+=" hemisphere:\n"
496-
iyaml+=" radius: %e\n"%(foc*2.)
497-
else:# shape=='paraboloid':
498-
iyaml+=' parabol: \n'
499-
iyaml+=' focal: %e\n' % foc
500-
501-
iyaml+=' clip: \n'
502-
iyaml+=' - operation: AND \n'
503-
iyaml+=' vertices: [ [%e, %e], [%e, %e], [%e, %e], [%e, %e] ]\n' % (-hst_w*0.5, -hst_h*0.5, -hst_w*0.5, hst_h*0.5, hst_w*0.5, hst_h*0.5, hst_w*0.5,-hst_h*0.5)
504-
iyaml+=' slices: %d\n\n' % slices
483+
foc=bands[i,1]
484+
name_hst_g = 'hst_g_band_'+str(i)
485+
iyaml+='- geometry: &%s\n' % name_hst_g
486+
if isinstance(slope_error, float):
487+
iyaml+=' - material: *%s\n' % 'material_mirror'
488+
else:
489+
idx_f=np.argmin(abs(hst_foc-foc))
490+
iyaml+=' - material: *%s\n' % 'material_mirror_%d'%idx_f
491+
print(i, 'focal', foc)
492+
if shape=='parabolic-cylinder':
493+
iyaml+=" parabolic-cylinder:\n"
494+
iyaml+=' focal: %e\n' % foc
495+
elif shape=='sphere':
496+
iyaml+=" hemisphere:\n"
497+
iyaml+=" radius: %e\n"%(foc*2.)
498+
else:# shape=='paraboloid':
499+
iyaml+=' parabol: \n'
500+
iyaml+=' focal: %e\n' % foc
501+
502+
iyaml+=' clip: \n'
503+
iyaml+=' - operation: AND \n'
504+
iyaml+=' vertices: [ [%e, %e], [%e, %e], [%e, %e], [%e, %e] ]\n' % (-hst_w*0.5, -hst_h*0.5, -hst_w*0.5, hst_h*0.5, hst_w*0.5, hst_h*0.5, hst_w*0.5,-hst_h*0.5)
505+
iyaml+=' slices: %d\n\n' % slices
505506

506507

507508
summary=np.array(['x','y','z', 'band foc'])

0 commit comments

Comments
 (0)