PyMODINIT_FUNC initjit(void) { PyThunk_Init(); initialize_thunk_methods(); initialize_operation(); initialize_thunk_as_number(); initialize_thunk_as_sequence(); initialize_parser(); initialize_compiler(); initialize_scheduler(); initialize_thunk_as_mapping(); //initialize module PyObject *m = Py_InitModule3("jit", module_methods, module_docstring); if (m == NULL) return; create_threads(); }
bool PostKriging::initialize( const Parameters_handler* parameters, Error_messages_handler* errors ) { std::cout << "initializing algorithm PostKriging \n"; this->extract_parameters(parameters); std::string harddata_grid_name = parameters->value( "Hard_Data.value" ); errors->report( harddata_grid_name.empty(), "Hard_Data", "No hard data specified" ); if( !harddata_grid_name.empty() ) { grid_ = 0; bool ok = geostat_utils::create( grid_, harddata_grid_name, "Grid_Name", errors ); if( !ok || !grid_ ) return false; } else return false; is_non_param_cdf_ = parameters->value( "is_non_param_cdf.value" ) == "1"; if(is_non_param_cdf_) { std::vector< std::string > prop_name = String_Op::decompose_string( parameters->value( "props.value" ), ";" ); for(std::vector< std::string >::iterator it_str = prop_name.begin(); it_str != prop_name.end(); it_str++ ) props.push_back(grid_->property( *it_str )); std::vector< float > thresh = String_Op::to_numbers<float>( parameters->value( "marginals.value" ) ); errors->report( thresh.size() != props.size() , "marginals.value", "The marginal must have the same lengths than the indicator properties" ); non_param_cdf_ = new Non_param_cdf<>(thresh.begin(),thresh.end()); //Set the tail extrapolation functions geostat_utils::set_cdf_extrapolation_tail(parameters,errors, *non_param_cdf_,"lowerTailCdf", "upperTailCdf"); } else { std::string prop_name = parameters->value( "gaussian_mean_prop.value" ); props.push_back( grid_->property( prop_name )); errors->report( props[0] == NULL , "mean_prop.value", "That property does not exist" ); prop_name = parameters->value( "gaussian_var_prop.value" ); props.push_back( grid_->property( prop_name ) ); errors->report( props[1] == NULL , "var_prop.value", "That property does not exist" ); gaussian_cdf_ = new Gaussian_cdf(); } mean_ = parameters->value( "mean.value" ) == "1"; iqr_ = parameters->value( "iqr.value" ) == "1"; cond_var_ = parameters->value( "cond_var.value" ) == "1"; quantile_ = parameters->value( "quantile.value" ) == "1"; prob_above_ = parameters->value( "prob_above.value" ) == "1"; prob_below_ = parameters->value( "prob_below.value" ) == "1"; if(mean_) check_input_string(errors,parameters,"mean_prop"); if(cond_var_) check_input_string(errors,parameters,"cond_var_prop"); if(iqr_) check_input_string(errors,parameters,"iqr_prop"); if(quantile_){ check_input_string(errors,parameters,"quantile_prop",0.,1.); check_input_string(errors,parameters,"quantile_vals",0.,1.); } if(prob_above_) { check_input_string( errors,parameters,"prob_above_prop"); check_input_string(errors,parameters,"prob_above_vals"); } if(prob_below_) { check_input_string( errors,parameters,"prob_below_prop"); check_input_string(errors,parameters,"prob_below_vals"); } if( !errors->empty() ) return false; if(mean_) initialize_operation(mean_prop_,errors,parameters,"mean"); if(cond_var_) initialize_operation(cond_var_prop_,errors,parameters,"cond_var"); if(iqr_) initialize_operation(iqr_prop_,errors,parameters,"iqr"); if(quantile_) { initialize_operation( quantile_props_, quantile_vals_,errors,parameters,"quantile"); std::sort(quantile_vals_.begin(),quantile_vals_.end()); if( quantile_vals_.front() < 0 && quantile_vals_.back() > 1 ) errors->report("quantile","Quantiles must be between 0 and 1"); } if(prob_above_) initialize_operation( prob_above_props_, prob_above_vals_,errors,parameters,"prob_above"); if(prob_below_) initialize_operation( prob_below_props_, prob_below_vals_,errors,parameters,"prob_below"); if( !errors->empty() ) return false; return true; }