#NEWLINE# @ bit_level #NEWLINE# @ pytest . mark . parametrize ( ( 'grid_type' , 'sample_sources_evenly' , 'multiple_densities' ) , list ( itertools . product ( GRID_TYPES , [ False , True ] , [ False , True ] ) ) ) #NEWLINE# def test_specific_energy( self , tmpdir , grid_type , sample_sources_evenly , multiple_densities , generate ) : #NEWLINE# #INDENT# np . random . seed ( 12345 ) #NEWLINE# m = Model ( ) #NEWLINE# m . set_grid ( self . grid [ output_file ] ) #NEWLINE# m . add_density_grid ( self . density [ grid_type ] , self . dust_file ) #NEWLINE# if multiple_densities : #NEWLINE# #INDENT# m . add_density_grid ( self . density_2 [ grid_type ] , self . dust_file ) #NEWLINE# m . add_density_grid ( self . density_3 [ grid_type ] , self . dust_file ) #NEWLINE# #UNINDENT# for i in range ( 5 ) : #NEWLINE# #INDENT# s = m . add_point_source ( ) #NEWLINE# s . luminosity = ( np . random . random ( ) * lsun ) #NEWLINE# s . temperature = np . random . uniform ( 2000.0 , 10000.0 ) #NEWLINE# s . position = np . random . uniform ( ( - pc ) , pc , 3 ) #NEWLINE# #UNINDENT# m . set_n_photons ( initial = 10000 , imaging = 0 ) #NEWLINE# m . set_sample_sources_evenly ( sample_sources_evenly ) #NEWLINE# m . conf . output . output_specific_energy = 'all' #NEWLINE# m . set_copy_input ( False ) #NEWLINE# m . write ( tmpdir . join ( random_id ( ) ) . strpath , copy = False , absolute_paths = True ) #NEWLINE# output_file = tmpdir . join ( random_id ( ) ) . strpath #NEWLINE# m . run ( output_file ) #NEWLINE# if generate : #NEWLINE# #INDENT# reference_file = os . path . join ( generate , ( function_name ( ) + '.rtout' ) ) #NEWLINE# shutil . copy ( output_file , reference_file ) #NEWLINE# pytest . skip ( 'Skipping test, since generating data' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reference_file = os . path . join ( DATA , ( function_name ( ) + '.rtout' ) ) #NEWLINE# assert_identical_results ( output_file , reference_file )