CosmicFish  Reference documentation for version 1.0
Looking into future Cosmology
fisher_matrix_calculator.f90
Go to the documentation of this file.
1 !----------------------------------------------------------------------------------------
2 !
3 ! This file is part of CosmicFish.
4 !
5 ! Copyright (C) 2015-2016 by the CosmicFish authors
6 !
7 ! The CosmicFish code is free software;
8 ! You can use it, redistribute it, and/or modify it under the terms
9 ! of the GNU General Public License as published by the Free Software Foundation;
10 ! either version 3 of the License, or (at your option) any later version.
11 ! The full text of the license can be found in the file LICENSE at
12 ! the top level of the CosmicFish distribution.
13 !
14 !----------------------------------------------------------------------------------------
15 
19 
21 
23 
24  use precision
26  use init_from_file
27  use modelparams
28  use amlutils
29  use inifile
37 
38  implicit none
39 
40  Type(cambparams) :: P
41  Type(cosmicfish_params) :: FP
42  character(LEN=Ini_max_string_len) paramfile
43 
44  integer :: num_param, num_derived
45  real(dl), allocatable, dimension(:,:) :: Fisher_matrix, Derived_Matrix
46  real(dl), allocatable, dimension(:) :: fiducial_params
47 
48  ! feedback:
49  call cosmicfish_write_header( name=' CosmicFish Fisher matrix calculator. ' )
50 
51  ! read the parameter file name:
52  paramfile = ''
53  if (getparamcount() /= 0) paramfile = getparam(1)
54  if (paramfile == '') stop 'No parameter input file'
55  ! initialize parameters:
56  call init_cosmicfish_from_file( p, fp, paramfile )
57  ! get the number of parameters:
58  call num_param_fisher(p, fp, num_param)
59  ! allocation:
60  allocate( fisher_matrix(num_param,num_param) )
61 
62  fisher_matrix = 0._dl
63 
64  ! Cls Fisher matrix:
65  if ( fp%cosmicfish_want_cls ) then
66  ! compute the Fisher matrix:
67  call fisher_cls( p, fp, num_param, fisher_matrix, outroot=fp%outroot )
68  ! save it to file:
69  call save_fisher_to_file( p, fp, num_param, fisher_matrix, filename=fp%outroot//'fisher_matrix_cls.dat' )
70  ! save the parameter names to file:
71  call save_paramnames_to_file( p, fp, num_param, filename=fp%outroot//'fisher_matrix_cls.paramnames' )
72  end if
73 
74  if ( fp%cosmicfish_want_SN ) then
75  ! compute the Fisher matrix:
76  call fisher_sn( p, fp, num_param, fisher_matrix, outroot=fp%outroot )
77  ! save it to file:
78  call save_fisher_to_file( p, fp, num_param, fisher_matrix, filename=fp%outroot//'fisher_matrix_SN.dat' )
79  ! save the parameter names to file:
80  call save_paramnames_to_file( p, fp, num_param, filename=fp%outroot//'fisher_matrix_SN.paramnames' )
81  end if
82 
83  if ( fp%cosmicfish_want_RD ) then
84  ! compute the Fisher matrix:
85  call fisher_rd( p, fp, num_param, fisher_matrix, outroot=fp%outroot)
86  ! save it to file:
87  call save_fisher_to_file( p, fp, num_param, fisher_matrix, filename=fp%outroot//'fisher_matrix_RD.dat' )
88  ! save the parameter names to file:
89  call save_paramnames_to_file( p, fp, num_param, filename=fp%outroot//'fisher_matrix_RD.paramnames' )
90  end if
91 
92  if ( fp%cosmicfish_want_Mpk ) write(*,*) 'Not yet implemented'
93 
94  if (fp%cosmicfish_want_derived ) then
95  ! get number of derived parameters:
96  call dimension_derived_parameters( p, fp, num_derived )
97  ! allocate the derived parameters matrix:
98  allocate( derived_matrix(num_param, num_derived) )
99  ! compute the Fisher matrix:
100  call fisher_derived( p, fp, num_param, num_derived, derived_matrix, outroot=fp%outroot )
101  ! save it to file:
102  call save_derived_fisher_to_file( p, fp, num_param, num_derived, derived_matrix, filename=fp%outroot//'fisher_matrix_derived.dat' )
103  ! save the parameter names to file:
104  call save_derived_paramnames_to_file( p, fp, num_param, num_derived, filename=fp%outroot//'fisher_matrix_derived.paramnames' )
105  end if
106 
107 end program fisher_matrix_calculator
subroutine, public save_derived_fisher_to_file(P_in, FP_in, num_params, num_derived, matrix, filename)
This subroutine saves the Fisher derived matrix to file taking care of putting into the file all the ...
subroutine, public cosmicfish_write_header(name)
This subroutine writes to the terminal the CosmicFish header. To be called at the beginning of the ap...
subroutine, public save_derived_paramnames_to_file(P_in, FP_in, num_params, num_derived, filename)
This subroutine saves a file containing the parameter names for the derived Fisher matrix run...
subroutine, public dimension_derived_parameters(P, FP, num)
This subroutine returns the number of derived parameters.
subroutine, public save_fisher_to_file(P, FP, fish_dim, fisher_matrix, filename)
This subroutine saves the Fisher matrix to file taking care of putting into the file all the relevant...
subroutine, public fisher_rd(P, FP, num_param, Fisher_Matrix, outroot)
This subroutine computes the Fisher matrix for redshift drift.
subroutine, public init_cosmicfish_from_file(P, FP, filename, param_out_name)
This subroutine initializes camb parameters from a parameter file.
This module contains the subroutine and functions to initialize camb and cosmicfish from a parameter ...
This module contains the definitions of derived data types used to store the informations about the f...
This module contains the interface layer between CosmicFish and CAMB.
This module contains several general purpose utilities.
This module contains the code that computes the matrix that can be used to compute the the Fisher mat...
subroutine, public num_param_fisher(P, FP, num_param)
This subroutine returns the number of parameters in the Fisher matrix based on the input parameters...
subroutine, public save_paramnames_to_file(P, FP, fish_dim, filename)
This subroutine saves a file containing the parameter names for the Fisher matrix run...
subroutine, public fisher_cls(P, FP, num_param, Fisher_Matrix, outroot)
This subroutine computes the Fisher matrix for Cls.
This module contains the subroutine and functions to carry out Fisher matrix manipulations.
program fisher_matrix_calculator
This module contains the code that computes the Fisher matrix for Cls.
subroutine, public fisher_sn(P, FP, num_param, Fisher_Matrix, outroot)
This subroutine computes the SN Fisher matrix.
This module contains the code that computes the Fisher matrix for Redshift Drift. ...
subroutine, public fisher_derived(P_in, FP_in, num_param, num_derived, Derived_Matrix, outroot)
This subroutine computes the Fisher matrix for derived parameters.
This module contains the code that computes the Fisher matrix for Supernovae measurements.
This derived data type contains all the informations that the cosmicfish code needs to run...