Exemple #1
0
int main(int argc, char **argv){
fprintf(stderr, "Computing the Chi^2 distribution for the given halo sample.\n");

	initialize_internal_variables(argv);

	Cosmo.err=0.3;  Cosmo.OmegaM=1.;

	read_halo_file();

	read_profiles_file();

	calculate_and_sort_chi2();

return 0;
}
Exemple #2
0
int main( int argc, char *argv[] ) {  
  int argindex = treat_options( argc, argv );
  if( argindex != argc - 2 ){
    perr( "You must provide two filenames as arguments\n" );
    usage();
  }
  perr( "Reading input profiles into hashmap...\n" );
  read_profiles_file( argv[ argindex + 1 ] );  
  perr( "Generalizing...\n" );
  sim_file = open_file_read( argv[ argindex ] );
  sim_index = get_index_column_name( sim_file, score_name );
  if( sim_index < 4 ) {
    fprintf( stderr, "Column named \"%s\" not found!\nYou must ", score_name );
    perr( "specify a valid -s option. Chose among SIM-FILE column headers.\n");
    perr( "Remember that the 1st 4 fields cannot be used as scores.\n" ); 
    usage();  
  }
  if( nb_threads > 1 ) {
    run_multi_threaded( &read_sim_and_generalize, nb_threads );    
  }
  else {
    perr( "Not using threads\n" );
    read_sim_and_generalize_serial();
  }
  // Clean and free to avoid memory leaks
  perr( "Finished, cleaning up...\n" );
  fclose( sim_file );
  g_hash_table_destroy( c_dict );  
  g_hash_table_destroy( t_dict );
  if( t_filter ) {
    g_hash_table_destroy( t_filter );
  }
  if( n_filter ) {
    g_hash_table_destroy( n_filter );
  }
  if( c_filter ) {
    g_hash_table_destroy( c_filter );
  }
  return 0;
}
Exemple #3
0
int main(int argc, char **argv)
{
	INFO_MSG("Computing halo statistical properties at fixed z");

	initialize_internal_variables(argv);
	initialize_halo_storage();

#ifdef WITH_MPI
	MPI_Init(&argc, &argv);
	MPI_Comm_rank(MPI_COMM_WORLD, &ThisTask);
	MPI_Comm_size(MPI_COMM_WORLD, &NTask);

	init_comm_structures();
	init_cpu_struct();	

	MPI_Bcast(&Settings, sizeof(struct general_settings), MPI_BYTE, 0, MPI_COMM_WORLD);
		
	generate_url_for_tasks();	
#endif	
			get_halo_files_urls();
			
			set_halo_url();

			read_halo_file();

			read_profiles_file();
	
			fit_and_store_nfw_parameters();
			
#ifdef GAS
			fit_and_store_gas_parameters();
#endif
			free_halo_profiles();

#ifdef WITH_MPI

		MPI_Barrier(MPI_COMM_WORLD);

		gather_halo_structures();

	//	free_comm_structures();
	
	if(ThisTask==0)
	{
#endif
	
		omp_set_num_threads(OMP_THREADS);	
	
		HALO_INDEX=0;
		MF_INDEX=0;
		PK_INDEX=0;

		initialize_halo_properties_structure();

		find_substructure();

		compute_halo_properties();
		print_numerical_mass_function();
		print_all_halo_properties_to_one_file();
		print_all_haloes();

#ifdef GAS
		average_gas_profiles();
#endif
		average_nfw_profile();
		print_average_profiles();

		print_halo_best_fit_results();

	//	sort_axis_alignment();
	//	print_axis_alignment();

	//	compute_subhalo_properties();
	//	print_all_subhalo_properties_to_one_file();
	// Redo all of the above for subhaloes

		// FIXME
		free_halo_properties();
	
#ifdef WITH_MPI
	}

	MPI_Barrier(MPI_COMM_WORLD);

	if(ThisTask == 0)
#endif
	INFO_MSG("Computed halo statistical properties at fixed z");

#ifdef WITH_MPI
	MPI_Finalize();
#endif

return 0;
}