4545from pyNastran .op2 .op2 import OP2
4646from pyNastran .utils import print_bad_path
4747try :
48- from pyNastran .f06 .dev .flutter .utils import load_f06_op2 , get_png_filename
49- IS_DEV = True
48+ from pyNastran .f06 .dev .flutter .utils import (
49+ load_f06_op2 , get_png_filename , get_plot_file )
5050except ImportError :
51- IS_DEV = False
51+ pass
52+ IS_DEV = pyNastran .DEV
5253
5354DIRNAME = os .path .dirname (__file__ )
5455PKG_PATH = Path (pyNastran .__path__ [0 ])
@@ -182,15 +183,28 @@ def test_f06_pt145(self):
182183 """tests read_f06_trim"""
183184 log = get_logger (log = None , level = None , encoding = 'utf-8' )
184185 f06_filename = AERO_PATH / 'pt145.f06'
185- #trim_results = read_f06_trim(f06_filename,
186- # log=None, nlines_max=1_000_000, debug=None)
187- #assert len(trim_results.aero_force.keys()) == 0
188- #assert len(trim_results.aero_pressure.keys()) == 0
189- #assert len(trim_results.controller_state.keys()) == 0
190- #assert len(trim_results.trim_variables.keys()) == 0
191- #assert len(trim_results.structural_monitor_loads.keys()) == 4
192- argv = ['f06' , 'plot_145' , str (f06_filename ), '--tas' ,
193- '--out_units' , 'english_in' ]
186+
187+ plot_methods = [
188+ '--eas' , '--tas' , '--rho' , '--alt' ,
189+ '--mach' , '--q' , '--index' ,
190+ ]
191+ for plot_method in plot_methods :
192+ argv = ['f06' , 'plot_145' , str (f06_filename ),
193+ plot_method ]
194+ cmd_line_plot_flutter (argv = argv , plot = False ,
195+ show = False , log = log )
196+
197+ argv = [
198+ 'f06' , 'plot_145' , str (f06_filename ),
199+ '--tas' ,
200+ '--in_units' , 'si' ,
201+ '--out_units' , 'english_in' ,
202+ '--freq_tol' , '0.02' ,
203+ '--freq_tol_remove' , '0.01' ,
204+ '--vd_limit' , '100.' ,
205+ '--ylimfreq' , '0:' ,
206+ '--damping_limit' , '0.001' ,
207+ ]
194208 cmd_line_plot_flutter (argv = argv , plot = IS_MATPLOTLIB ,
195209 show = False , log = log )
196210
@@ -224,8 +238,22 @@ def test_plot_flutter_0012_dev(self):
224238 log = SimpleLogger (level = 'warning' )
225239 dirname = AERO_PATH / '2_mode_flutter'
226240 f06_filename = dirname / '0012_flutter.f06'
227- load_f06_op2 (f06_filename , log ,
241+ model , responses = load_f06_op2 (f06_filename , log ,
228242 in_units = 'si' , out_units = 'si' , use_rhoref = False )
243+ assert model is None , model
244+ assert len (responses ) == 1 , responses
245+
246+ f06_filename2 = 'cat.f06'
247+ model , responses = load_f06_op2 (f06_filename2 , log )
248+ assert model is None , model
249+ assert len (responses ) == 0 , responses
250+
251+ f06_filename2 = 'cat.op2'
252+ model , responses = load_f06_op2 (f06_filename2 , log )
253+ assert model is None , model
254+ assert len (responses ) == 0 , responses
255+
256+ out = get_plot_file ()
229257
230258 base = 'base'
231259 x_plot_type = 'eas'
@@ -237,10 +265,10 @@ def test_plot_flutter_0012_dev(self):
237265 assert png_filename0 == 'base_Vg.png' , png_filename0
238266 assert png_filename == 'base_Vg.png' , png_filename
239267 png_filename0 , png_filename = get_png_filename (
240- base , 'x-' + x_plot_type , plot_type ,
268+ base , x_plot_type , 'x-' + plot_type ,
241269 export_to_png )
242- assert png_filename0 == 'base_Vg .png' , png_filename0
243- assert png_filename == 'base_Vg .png' , png_filename
270+ assert png_filename0 == 'base_eas-Vg .png' , png_filename0
271+ assert png_filename == 'base_eas-Vg .png' , png_filename
244272
245273 png_filename0 , png_filename = get_png_filename (
246274 base , 'x-' + x_plot_type , plot_type ,
@@ -742,15 +770,18 @@ def test_zona_gafa(self):
742770
743771
744772class TestF06Utils (unittest .TestCase ):
773+ @unittest .skipIf (not IS_DEV , 'skipping plot_sol_200' )
745774 def test_opt_aerobeam (self ):
746775 """tests optimization"""
747776 log = SimpleLogger ('warning' )
748777 f06_filename = AERO_PATH / 'aerobeam.f06'
749778 png_filename = AERO_PATH / 'aerobeam.png'
750779 plot_sol_200 (f06_filename , png_filename = png_filename ,
751780 show = True , log = log )
752- #read_sol_200(f06_filename)
781+ argv = ['f06' , 'plot_200' , str (f06_filename )]
782+ cmd_line_f06 (argv , plot = False , show = False , log = log )
753783
784+ @unittest .skipIf (not IS_DEV , 'skipping plot_sol_200' )
754785 def test_opt_mdb200 (self ):
755786 """tests optimization"""
756787 f06_filename = MODEL_PATH / 'other' / 'mdb200.f06'
@@ -786,6 +817,7 @@ def test_f06_trim_bwb(self):
786817 f06_filename , aerobox_caero_filename ,
787818 loads_filename ,
788819 log = None , nlines_max = 1_000_000 , debug = None )
820+
789821 # set the file names?
790822 trim_results = f06_to_pressure_loads (
791823 f06_filename , aerobox_caero_filename ,
@@ -872,10 +904,12 @@ def test_split_float_colon(self):
872904 a = split_float_colons ('1:' )
873905 b = split_float_colons ('1:5' )
874906 c = split_float_colons (':4' )
907+ d = split_float_colons (None )
875908
876909 assert a == [1.0 , None ], a
877910 assert b == [1.0 , 5.0 ], b
878911 assert c == [None , 4.0 ], c
912+ assert d is None , d
879913 with self .assertRaises (AssertionError ):
880914 split_float_colons ('1:5:2' )
881915
@@ -897,8 +931,11 @@ def test_split_int_colon(self):
897931 d = split_int_colon ('1:5,10:15' )
898932 assert d == [1 , 2 , 3 , 4 , 5 , 10 , 11 , 12 , 13 , 14 , 15 ], d
899933
900- d = split_int_colon ('10:15,1:5' )
901- assert d == [1 , 2 , 3 , 4 , 5 , 10 , 11 , 12 , 13 , 14 , 15 ], d
934+ e = split_int_colon ('10:15,1:5' )
935+ assert e == [1 , 2 , 3 , 4 , 5 , 10 , 11 , 12 , 13 , 14 , 15 ], e
936+
937+ f = split_int_colon ('1,3,5' )
938+ assert f == [1 , 3 , 5 ], f
902939
903940
904941if __name__ == '__main__' : # pragma: no cover
0 commit comments