Skip to content

Commit

Permalink
structure for varying alpha made. Missing theoretical expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
matmartinelli committed Jun 2, 2017
1 parent 9a4c314 commit 1277924
Show file tree
Hide file tree
Showing 11 changed files with 783 additions and 16 deletions.
12 changes: 12 additions & 0 deletions apps/fisher_matrix_calculator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ program fisher_matrix_calculator
use Fisher_calculator_Cls
use Fisher_calculator_SN
use Fisher_calculator_RD
use Fisher_calculator_alpha
use Fisher_calculator_Derived
use Fisher_manipulation
use cosmicfish_utilities
Expand Down Expand Up @@ -89,6 +90,17 @@ program fisher_matrix_calculator
call save_paramnames_to_file( P, FP, num_param, filename=FP%outroot//'fisher_matrix_RD.paramnames' )
end if

!varalpha mod ----------------------
if ( FP%cosmicfish_want_varalpha ) then
! compute the Fisher matrix:
call Fisher_alpha( P, FP, num_param, Fisher_Matrix, outroot=FP%outroot)
! save it to file:
call save_Fisher_to_file( P, FP, num_param, Fisher_Matrix, filename=FP%outroot//'fisher_matrix_varalpha.dat' )
! save the parameter names to file:
call save_paramnames_to_file( P, FP, num_param, filename=FP%outroot//'fisher_matrix_varalpha.paramnames' )
end if
!-----------------------------------

if ( FP%cosmicfish_want_Mpk ) write(*,*) 'Not yet implemented'

if (FP%cosmicfish_want_derived ) then
Expand Down
36 changes: 36 additions & 0 deletions examples/experiments/alpha/mockname.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#----------------------------------------------------------------------------------------
#
# This file is part of CosmicFish.
#
# Copyright (C) 2015-2017 by the CosmicFish authors
#
# The CosmicFish code is free software;
# You can use it, redistribute it, and/or modify it under the terms
# of the GNU General Public License as published by the Free Software Foundation;
# either version 3 of the License, or (at your option) any later version.
# The full text of the license can be found in the file LICENSE at
# the top level of the CosmicFish distribution.
#
#----------------------------------------------------------------------------------------

# This is only a test

#Fiducial value for the alpha coupling
alpha_coupling = 1.e-5


#Experimental specifications
number_alpha_redshifts = 4

alpha_redshift(1) = 0
alpha_redshift(2) = 1
alpha_redshift(3) = 2
alpha_redshift(4) = 3



alpha_error(1) = 1.e-6
alpha_error(2) = 1.e-6
alpha_error(3) = 1.e-6
alpha_error(4) = 1.e-6

91 changes: 91 additions & 0 deletions examples/parameters/3_varying_alpha.camb.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#----------------------------------------------------------------------------------------
#
# This file is part of CosmicFish.
#
# Copyright (C) 2015-2017 by the CosmicFish authors
#
# The CosmicFish code is free software;
# You can use it, redistribute it, and/or modify it under the terms
# of the GNU General Public License as published by the Free Software Foundation;
# either version 3 of the License, or (at your option) any later version.
# The full text of the license can be found in the file LICENSE at
# the top level of the CosmicFish distribution.
#
#----------------------------------------------------------------------------------------

# output_root is prefixed to output file names
output_root = raw_results/3_varying_alpha

# common run parameters:
#in these files you can set the standard (EFT-/MG-)CAMB parameters and settings
#the values of the cosmological parameters chosen in here will be the fisher's fiducial
DEFAULT(./parameters/common/common_params_fisher.ini)
DEFAULT(./parameters/common/common_params_camb.ini)
DEFAULT(./parameters/common/common_params_eft.ini)

l_max_scalar = 2500


DEFAULT(./experiments/alpha/mockname.ini)
#alpha_coupling = 1.e-5

# CosmicFish parameters to run:

param[ombh2] = T
param[omch2] = T
param[omnuh2] = F
param[hubble] = T
param[Ye] = F
param[nom_nu] = F
param[w0_ppf] = T
param[wa_ppf] = T
param[cs_ppf] = F
param[cT] = F
param[As] = T
param[ns] = T
param[nsrun] = F
param[nt] = F
param[r] = F
param[tau] = F
param[bias] = F
param[alpha_SN] = F
param[beta_SN] = F
param[M0_SN] = F

param[alpha_coupling] = T


###################### Parameters for CosmicFish derived ######################

param[omegab] = F
param[omegac] = F
param[omegan] = F
param[omegav] = F
param[omegak] = F
param[omegam] = T
param[theta] = F
param[mnu] = F
param[zre] = F
param[neff] = F

param[sigma8] = T
param[loghubble] = F
param[logDA] = F
param[S8] = F

FD_num_redshift = 1
FD_redshift(1) = 0.0


# what to do:
cosmicfish_want_cls = F
cosmicfish_want_varalpha = T
cosmicfish_want_derived = T

#with these settings we are using T,E,B spectra
Fisher_want_CMB_T = F
Fisher_want_CMB_E = F
Fisher_want_CMB_B = F
Fisher_want_CMB_lensing = F
Fisher_want_LSS_lensing = F
Fisher_want_LSS_counts = F
4 changes: 3 additions & 1 deletion examples/script/makefile_target.make
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
-@bash $(SCRIPT_DIR)/run_params.sh $(PARAMETER_DIR)/1_Planck_Pre_Launch.camb.ini $(PARAMETER_ANALYSIS_DIR)/1_Planck_Pre_Launch.camb.ini
2_DESGC_Planck.camb:
-@bash $(SCRIPT_DIR)/run_params.sh $(PARAMETER_DIR)/2_DESGC_Planck.camb.ini $(PARAMETER_ANALYSIS_DIR)/2_DESGC_Planck.camb.ini
all_targets: 1_Planck_Pre_Launch.camb 2_DESGC_Planck.camb
3_varying_alpha.camb:
-@bash $(SCRIPT_DIR)/run_params.sh $(PARAMETER_DIR)/3_varying_alpha.camb.ini $(PARAMETER_ANALYSIS_DIR)/3_varying_alpha.camb.ini
all_targets: 1_Planck_Pre_Launch.camb 2_DESGC_Planck.camb 3_varying_alpha.camb
39 changes: 29 additions & 10 deletions sources/004_cosmicfish_types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module cosmicfish_types
logical :: want_alpha_SN !< Decide wether to include alpha_SN in the Fisher parameters.
logical :: want_beta_SN !< Decide wether to include beta_SN in the Fisher parameters.
logical :: want_M0_SN !< Decide wether to include M0_SN in the Fisher parameters.
logical :: want_alpha_coupling !< Decide wether to include alpha_coupling in the Fisher parameters.
! ppf parameters (only with camb):
#ifdef COSMICFISH_CAMB
logical :: want_w0_ppf !< Decide wether to include w0_ppf in the Fisher parameters.
Expand Down Expand Up @@ -195,6 +196,22 @@ module cosmicfish_types

end type cosmicfish_fisher_RD


!----------------------------------------------------------------------------------------
!> This derived data type contains all the informations that the cosmicfish code needs to
!! compute the Fisher matrix for alpha variation measurements.
type cosmicfish_fisher_alpha

!alpha specifications
integer :: number_alpha_redshifts
integer, dimension(:), allocatable :: alpha_error !< Error on delta alpha/alpha at each redshift
real(dl), dimension(:), allocatable :: alpha_redshift !< center of redshift bins

! fiducial alpha variation parameters:
real(dl) :: alpha_coupling !< fiducial value of the alpha coupling

end type cosmicfish_fisher_alpha

!----------------------------------------------------------------------------------------
!> This derived data type contains all the informations that the cosmicfish code needs to
!! compute the Fisher matrix for derived parameters.
Expand Down Expand Up @@ -246,21 +263,23 @@ module cosmicfish_types
!! 2 = extended feedback
!! 3 = debug feedback

logical :: cosmicfish_want_cls !< Decide wether to compute the Fisher matrix for cls.
logical :: cosmicfish_want_SN !< Decide wether to compute the Fisher matrix for supernovae.
logical :: cosmicfish_want_Mpk !< Decide wether to compute the Fisher matrix for the matter power spectrum.
logical :: cosmicfish_want_RD !< Decide wether to compute the Fisher matrix for redshift drift.
logical :: cosmicfish_want_derived !< Decide wether to compute derived parameters.
logical :: cosmicfish_want_cls !< Decide wether to compute the Fisher matrix for cls.
logical :: cosmicfish_want_SN !< Decide wether to compute the Fisher matrix for supernovae.
logical :: cosmicfish_want_Mpk !< Decide wether to compute the Fisher matrix for the matter power spectrum.
logical :: cosmicfish_want_RD !< Decide wether to compute the Fisher matrix for redshift drift.
logical :: cosmicfish_want_varalpha !< Decide wether to compute the Fisher matrix for alpha variation.
logical :: cosmicfish_want_derived !< Decide wether to compute derived parameters.

! other parameters:
real(dl) :: output_factor !< Overall factor for the Cls.

! Specifications for the Cls Fisher matrix:
type(cosmicfish_param_fisher) :: fisher_par !< contains what is needed to choose the parameters to run
type(cosmicfish_fisher_cls) :: fisher_cls !< contains what is needed for Cls Fisher matrix
type(cosmicfish_fisher_SN) :: fisher_SN !< contains what is needed for SN Fisher matrix
type(cosmicfish_fisher_RD) :: fisher_RD !< contains what is needed for RD Fisher matrix
type(cosmicfish_fisher_derived) :: fisher_der !< contains what is needed for derived Fisher matrix
type(cosmicfish_param_fisher) :: fisher_par !< contains what is needed to choose the parameters to run
type(cosmicfish_fisher_cls) :: fisher_cls !< contains what is needed for Cls Fisher matrix
type(cosmicfish_fisher_SN) :: fisher_SN !< contains what is needed for SN Fisher matrix
type(cosmicfish_fisher_RD) :: fisher_RD !< contains what is needed for RD Fisher matrix
type(cosmicfish_fisher_alpha) :: fisher_alpha !< contains what is needed for alpha variation Fisher matrix
type(cosmicfish_fisher_derived) :: fisher_der !< contains what is needed for derived Fisher matrix

! Output root:
character(len=:), allocatable :: outroot !< Root for all the filenames that will be produced by CosmicFish
Expand Down
37 changes: 32 additions & 5 deletions sources/005_init_from_file.f90
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,12 @@ subroutine init_cosmicfish_from_file( P, FP, filename, param_out_name )
FP%adaptivity = Ini_Read_Logical('adaptivity',.false.)
FP%cosmicfish_feedback = Ini_Read_Int('cosmicfish_feedback',0)

FP%cosmicfish_want_cls = Ini_Read_Logical('cosmicfish_want_cls',.false.)
FP%cosmicfish_want_SN = Ini_Read_Logical('cosmicfish_want_SN' ,.false.)
FP%cosmicfish_want_Mpk = Ini_Read_Logical('cosmicfish_want_Mpk',.false.)
FP%cosmicfish_want_RD = Ini_Read_Logical('cosmicfish_want_RD' ,.false.)
FP%cosmicfish_want_derived = Ini_Read_Logical('cosmicfish_want_derived',.false.)
FP%cosmicfish_want_cls = Ini_Read_Logical('cosmicfish_want_cls',.false.)
FP%cosmicfish_want_SN = Ini_Read_Logical('cosmicfish_want_SN' ,.false.)
FP%cosmicfish_want_Mpk = Ini_Read_Logical('cosmicfish_want_Mpk',.false.)
FP%cosmicfish_want_RD = Ini_Read_Logical('cosmicfish_want_RD' ,.false.) !varalpha mod
FP%cosmicfish_want_varalpha = Ini_Read_Logical('cosmicfish_want_varalpha',.false.)
FP%cosmicfish_want_derived = Ini_Read_Logical('cosmicfish_want_derived',.false.)

FP%output_factor = Ini_Read_Double('CMB_outputscale',1.d0)

Expand Down Expand Up @@ -594,6 +595,8 @@ subroutine init_cosmicfish_from_file( P, FP, filename, param_out_name )
FP%fisher_par%want_lambda = Ini_Read_Logical( 'param[lambda]' ,.false. )
#endif

FP%fisher_par%want_alpha_coupling = Ini_Read_Logical( 'param[alpha_coupling]',.false.) !varalpha mod

! read Cls parameters:
if ( FP%cosmicfish_want_cls ) then

Expand Down Expand Up @@ -757,6 +760,29 @@ subroutine init_cosmicfish_from_file( P, FP, filename, param_out_name )
end if
end if

!varalpha mod------------------------------------------------------------------
! reading varalpha parameters
if ( FP%cosmicfish_want_varalpha) then
write(*,*) '-------------------------'
write(*,*) '|WARNING WARNING WARNING|'
write(*,*) '-------------------------'
write(*,*) 'alpha variation implemented only for direct measurements'
write(*,*) 'effects on other observables (e.g. CMB and SN) is not considered'
write(*,*) 'Avoid using this in combination with observables affected by alpha'

FP%fisher_alpha%alpha_coupling = Ini_Read_Double('alpha_coupling' , 0._dl )

FP%fisher_alpha%number_alpha_redshifts = Ini_Read_Int( 'number_alpha_redshifts', 0 )
allocate(FP%fisher_alpha%alpha_redshift(FP%fisher_alpha%number_alpha_redshifts))
allocate(FP%fisher_alpha%alpha_error(FP%fisher_alpha%number_alpha_redshifts))
do i =1,FP%fisher_alpha%number_alpha_redshifts
write(red_ind,*) i
FP%fisher_alpha%alpha_redshift(i) = Ini_Read_Double( 'alpha_redshift('//trim(adjustl(red_ind))//')')
FP%fisher_alpha%alpha_error(i) = Ini_Read_Double( 'alpha_error('//trim(adjustl(red_ind))//')')
end do
end if
!------------------------------------------------------------------------------

! read derived parameters:
if ( FP%cosmicfish_want_derived ) then
! fixed parameters:
Expand Down Expand Up @@ -834,6 +860,7 @@ subroutine check_parameters_consistency( P, FP )
& .not. FP%cosmicfish_want_SN .and. &
& .not. FP%cosmicfish_want_RD .and. &
& .not. FP%cosmicfish_want_Mpk .and. &
& .not. FP%cosmicfish_want_varalpha .and. & !varalpha mod
& .not. FP%cosmicfish_want_derived ) then
write(*,*) 'WARNING: you want no Fisher!.'
end if
Expand Down
22 changes: 22 additions & 0 deletions sources/006_cosmicfish_camb_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ subroutine num_param_Fisher(P, FP, num_param)
if ( FP%fisher_par%want_beta_SN ) num_param = num_param + 1 ! beta_SN
if ( FP%fisher_par%want_M0_SN ) num_param = num_param + 1 ! M0_SN

!Coupling parameter for alpha variation
if ( FP%fisher_par%want_alpha_coupling ) num_param = num_param + 1 ! alpha coupling

#ifdef COSMICFISH_CAMB
! ppf parameters
if ( FP%fisher_par%want_w0_ppf ) num_param = num_param + 1 ! w0_ppf
Expand Down Expand Up @@ -365,6 +368,11 @@ subroutine Fisher_param_names(P, FP, param_number, param_name, param_name_latex)
if ( num_param == param_number ) then; param_name = 'M0_SN'; if ( present(param_name_latex) ) param_name_latex = 'M_0^{\rm SN}'; return ;
end if

!Parameter for alpha variation
if ( FP%fisher_par%want_alpha_coupling ) num_param = num_param + 1 ! alpha coupling
if ( num_param == param_number ) then; param_name = 'alpha_coupling'; if ( present(param_name_latex) ) param_name_latex = '\zeta'; return ;
end if

#ifdef COSMICFISH_CAMB
! ppf parameters
if ( FP%fisher_par%want_w0_ppf ) num_param = num_param + 1 ! w0_ppf
Expand Down Expand Up @@ -942,6 +950,13 @@ subroutine CAMB_params_to_params_array( P, FP, num_param, params_array )
ind = ind +1
end if

!Parameter for alpha variation
!alpha_coupling
if ( FP%fisher_par%want_alpha_coupling ) then
params_array(ind) = FP%fisher_alpha%alpha_coupling
ind = ind +1
end if

#ifdef COSMICFISH_CAMB
! ppf parameters:
! w0_ppf
Expand Down Expand Up @@ -1391,6 +1406,13 @@ subroutine params_array_to_CAMB_param( P, FP, num_param, params_array )
ind = ind +1
end if

! parameter for alpha variation
! alpha_coupling
if ( FP%fisher_par%want_alpha_coupling ) then
FP%fisher_alpha%alpha_coupling = params_array(ind)
ind = ind +1
end if

#ifdef COSMICFISH_CAMB
! ppf parameters:
! w0_ppf
Expand Down
Loading

0 comments on commit 1277924

Please sign in to comment.