def analyze_one(flight, output_path, profile, requested_params, available_nodes): # , test_param_names, test_node_mgr, test_process_order): '''analyze one flight''' #precomputed_parameters = flight.parameters.copy() precomputed_parameters = get_precomputed_parameters(flight) available_nodes_copy = available_nodes #copy.deepcopy(available_nodes) #if flight.parameters.keys() != test_param_names: #rats, have to redo this node_mgr = node.NodeManager( flight.start_datetime, flight.duration, precomputed_parameters.keys(), #flight.parameters.keys(), requested_params, available_nodes_copy, flight.aircraft_info, achieved_flight_record=flight.achieved_flight_record) #pdb.set_trace() process_order, gr_st = dependency_order(node_mgr, draw=False) res, params = derive_parameters_series(flight, node_mgr, process_order, precomputed_parameters) #post-process: save for k in res['series'].keys(): flight.parameters[k] = res['series'][k] if profile == 'base': flight.save_to_hdf5(output_path) dump_pickles(output_path, params, res['kti'], res['kpv'], res['phase'], res['approach'], res['attr'], logger) return flight, res, params
def get_base_nodemanager(flt): '''return a NodeManager for the current Flight object and profile definition normally myvars will be set myvars=vars() from a notebook ''' # full set of computable nodes all_nodes = helper.get_derived_nodes(settings.NODE_MODULES) #all the FDS derived nodes requested_nodes = all_nodes.copy() # get Nodes defined in the current namespace if requested_nodes.get('Configuration'): del requested_nodes['Configuration'] for k,v in flt.series.items(): #hdf5 series all_nodes[k]=v node_mgr = node.NodeManager( flt.start_datetime, flt.duration, flt.series.keys(), #ff.valid_param_names(), requested_nodes.keys(), all_nodes, # computable flt.aircraft_info, achieved_flight_record={'Myfile':flt.filepath, 'Mydict':dict()} ) return node_mgr
def get_profile_nodemanager(flt, myvars): '''return a NodeManager for the current flight and profile definition normally myvars will be set myvars=vars() from a notebook ''' # full set of computable nodes requested_nodes = get_profile_nodes(myvars) # get Nodes defined in the current namespace all_nodes = helper.get_derived_nodes(settings.NODE_MODULES) #all the FDS derived nodes for k,v in requested_nodes.items(): # nodes in this profile all_nodes[k]=v ### ???? remove those??? for k,v in flt.series.items(): #hdf5 series all_nodes[k]=v node_mgr = node.NodeManager( flt.start_datetime, flt.duration, flt.series.keys(), #ff.valid_param_names(), requested_nodes.keys(), all_nodes, # computable flt.aircraft_info, achieved_flight_record={'Myfile':flt.filepath, 'Mydict':dict()} ) return node_mgr
def graph_one_node(parameter_class, flight): '''Pass in a profile parameter node class to view its dependency graph sample call: node_graph(SimpleKPV)''' single_request = {parameter_class.__name__: parameter_class } # full set of computable nodes base_nodes = helper.get_derived_nodes(settings.NODE_MODULES) all_nodes = base_nodes.copy() for k,v in single_request.items(): all_nodes[k]=v for k,v in flight.series.items(): all_nodes[k]=v single_mgr = node.NodeManager( flight.start_datetime, flight.duration, flight.series.keys(), single_request.keys(), all_nodes, flight.aircraft_info, achieved_flight_record={'Myfile':flight.filepath, 'Mydict':dict()} ) single_order, single_graph = helper.dependency_order(single_mgr, draw=False) graph_show(single_graph, font_size=12)
def derive_one(flight, parameter_class, precomputed={}): '''Pass in a single profile parameter node class to derive sample call: node_graph(SimpleKPV)''' single_request = {parameter_class.__name__: parameter_class } # full set of computable nodes base_nodes = helper.get_derived_nodes(settings.NODE_MODULES) all_nodes = base_nodes.copy() for k,v in single_request.items(): all_nodes[k]=v for k,v in flight.series.items(): #flight.series.items(): all_nodes[k]=v single_mgr = node.NodeManager( flight.start_datetime, flight.duration, flight.series.keys(), single_request.keys(), all_nodes, flight.aircraft_info, achieved_flight_record={'Myfile': flight.filepath, 'Mydict':dict()} ) single_order, single_graph = helper.dependency_order(single_mgr, draw=False) res, params= helper.derive_parameters_series(flight, single_mgr, single_order, precomputed=flight.parameters) return params