コード例 #1
0
def FrisPy_Animation(config_filename):
	#Parse the configuration file
	#First check for necessary files for the animation
	conf = config.read_config_file(config_filename)
	if 'params_file_name' not in conf:
		raise Exception("Missing "+\
				"params_file_name in config_name")
	if 'initial_conditions_file_name' not in conf:
		raise Exception("Missing "+\
				"initial_conditions_file_name"+\
				" in config_name")

	#Read in the parameters (aka coefficients) and the initial conditions
	params_file_name = conf['params_file_name']
	initial_conditions_file_name = conf['initial_conditions_file_name']
	params,initial_conditions = setup.read_params_and_initial_conditions\
				    (params_file_name,
				     initial_conditions_file_name)

	#Pass the parameters and conditions to the driver routine
	positions, n_times = driver_interface_animation.get_positions(initial_conditions,params)

	#Write positions to a file. This will be commented out
        #when testing is not underway
        output_trajectory.write_trajectory_to_file(positions,n_times)

	#Pass the positions and number of times to the animation routines
	make_visualizations.make_plots(positions,n_times)

	print "\nCompleting Animation\n"
	return
コード例 #2
0
ファイル: FrisPy_MCMC.py プロジェクト: tmcclintock/FrisPy
def FrisPy_MCMC(config_filename):
	#Parse config file
	conf = config.read_config_file(config_filename)
	if 'params_file_name' not in conf:
		raise Exception("Missing "+\
				"params_file_name in config_name")
	if 'flight_data_file_name' not in conf:
		raise Exception("Missing "+\
				"flight_data_file_name in config_name")

	#Read in the flight data
	params_file_name = conf['params_file_name']
	flight_data_file_name = conf['flight_data_file_name']
        initial_conditions_file_name = conf['initial_conditions_file_name']
	params,flight_data =setup.read_params_and_flight_data(params_file_name,flight_data_file_name)
        initial_conditions = setup.read_initial_conditions(initial_conditions_file_name)
	
	#flight_data is a numpy.ndarray with names,
        #while params is an array, so the flight
	#data names need to be extracted
	names = flight_data.dtype.names

	#Perform the MCMC
	samples,likelihoods = start_mcmc.perform_mcmc(\
		names,flight_data,initial_conditions,params)

	#Create plots
	mcmc_analysis.analysis(samples,likelihoods,names,flight_data,params)

	print "\nCompleting MCMC\n"
	return