class TestSimArray(unittest.TestCase): ''' Test functionality connected with the application of boundary conditions. ''' def setUp(self): self.sim_pstudy = SimPStudy( sim_model = SimModel() ) def test_save( self ): '''Calculate a study and save it ''' res = self.sim_pstudy.sim_array[0,:,:,:] print('fraction cached', self.sim_pstudy.sim_array.fraction_cached) filename = path.join( mkdtemp(), 'foo_file.pst' ) self.sim_pstudy.save( filename ) self.sim_pstudy.new() print('fraction cached', self.sim_pstudy.sim_array.fraction_cached) self.sim_pstudy.load( filename ) print('fraction cached', self.sim_pstudy.sim_array.fraction_cached) print('FIRST BEFORE', self.sim_pstudy.sim_array.output_table[0]) self.sim_pstudy.sim_array.clear_cache() print('fraction cached', self.sim_pstudy.sim_array.fraction_cached) print('FIRST AFTER', self.sim_pstudy.sim_array.output_table[0])
class TestSimArray(unittest.TestCase): ''' Test functionality connected with the application of boundary conditions. ''' def setUp(self): self.sim_pstudy = SimPStudy( sim_model = SimModel() ) def test_save( self ): '''Calculate a study and save it ''' res = self.sim_pstudy.sim_array[0,:,:,:] print 'fraction cached', self.sim_pstudy.sim_array.fraction_cached filename = path.join( mkdtemp(), 'foo_file.pst' ) self.sim_pstudy.save( filename ) self.sim_pstudy.new() print 'fraction cached', self.sim_pstudy.sim_array.fraction_cached self.sim_pstudy.load( filename ) print 'fraction cached', self.sim_pstudy.sim_array.fraction_cached print 'FIRST BEFORE', self.sim_pstudy.sim_array.output_table[0] self.sim_pstudy.sim_array.clear_cache() print 'fraction cached', self.sim_pstudy.sim_array.fraction_cached print 'FIRST AFTER', self.sim_pstudy.sim_array.output_table[0]
#-------------------- if test_series == 'BT-12c': path = join(simdb.exdata_dir, 'bending_tests', 'four_point', '2012-04-03_BT-4PT-12c-6cm-0-TU', 'BT-4PT-12c-6cm-SH4') tests = [ 'BT-4PT-12c-6cm-SH4-V1.DAT' ] # , 'BT-4PT-12c-6cm-SH4-V2.DAT' ] for t in tests: ex_path = join(path, t) ex_run = ExRun(ex_path) ex_run.ex_type._plot_force_deflection_center(p, offset_w=-0.017) # ex_run.ex_type._plot_ironed_force_deflection_avg(p) # ex_run.ex_type._plot_force_deflection_thirdpoints( p ) path = join(simdb.exdata_dir, 'bending_tests', 'four_point', '2012-04-03_BT-4PT-12c-6cm-0-TU', 'BT-4PT-12c-6cm-SH4FF') tests = [ 'BT-4PT-12c-6cm-SH4FF-V1.DAT', 'BT-4PT-12c-6cm-SH4FF-V2.DAT' ] for t in tests: ex_path = join(path, t) ex_run = ExRun(ex_path) ex_run.ex_type._plot_force_deflection_center(p) # plot sim curve as time new roman within the predefined limits # # format_plot(p, xlim = 34, ylim = 54, xlabel = 'displacement [mm]', ylabel = 'force [kN]') p.show() if do == 'pstudy': sim_ps = SimPStudy(sim_model=sim_model) sim_ps.configure_traits()
def setUp(self): self.sim_pstudy = SimPStudy( sim_model = SimModel() )
# f-w-diagram_center-edge # # file_name = 'f_w_diagram_ce_' + param_key + '.pickle' # pickle_file_path = join(pickle_path, file_name) # file = open(pickle_file_path, 'r') # trace = load(file) # p.plot(trace.xdata, trace.ydata, color = 'red') #------------------------------ # experiment: #------------------------------ path = join(simdb.exdata_dir, 'bending_tests', 'four_point', '2012-04-03_BT-4PT-12c-6cm-0-TU', 'BT-4PT-12c-6cm-SH4') tests = ['BT-4PT-12c-6cm-SH4-V1.DAT', 'BT-4PT-12c-6cm-SH4-V2.DAT'] for t in tests: ex_path = join(path, t) ex_run = ExRun(ex_path) # ex_run.ex_type._plot_smoothed_force_deflection_center( p ) ex_run.ex_type._plot_ironed_orig_force_deflection_center(p) # plot sim curve as time new roman black and white plot # # format_plot(p, xlim = 34, ylim = 54, xlabel = 'displacement [mm]', ylabel = 'force [kN]') p.show() if do == 'pstudy': sim_ps = SimPStudy(sim_model=sim_model) sim_ps.configure_traits()