Skip to content

Reading in config files #15

@matthewkirby

Description

@matthewkirby

So we talked today about making the config file not a .py file. Something that I suggested was throwing everything into a .ini file that we can then parse as needed using configparser. This loads all of the contents of the ini file into a nice structured dictionary that can be broken up into sections. This object can then be passed around and is more transparent than what is currently in place.

I drew up a sample ini file combining the current contents of the .job file and the config.py files. So far, this is only prepped for running the nfwfit portion of the code.

[General]
# Todo: Some of these things must be able to be removed
# Todo: outputExt should be pkl??
catname = /Users/matthewkirby/research/CLMassMod/data/mxxl/halo_54_100_0
outbasename = outputs/halo_54_100_0
workbase = null
outputExt = .out
# Number of configuration files to include
number_configurations = 1


[Input Files]
number_inputfiles = 4
infile1 = /Users/matthewkirby/research/CLMassMod/data/mxxl/halo_54_100_0.convergence_map
infile2 = /Users/matthewkirby/research/CLMassMod/data/mxxl/halo_54_100_0.shear_1_map
infile3 = /Users/matthewkirby/research/CLMassMod/data/mxxl/halo_54_100_0.shear_2_map
infile4 = /Users/matthewkirby/research/CLMassMod/data/mxxl/halo_54_100_0.answer


[Config1]
# Todo: List options for each of these
# Todo: More useful names
profilebuilder = profilebuilder 
rescale_cluster = no_redshift_rescaling
beta_calcer = fixed_redshift

binner = gaussian_fixed_bins
profilecol = r_mpc
binspacing = linear
nbins = 12

density_picker = density_picker
nperarcmin = 20

shearnoise = gaussian_shape_noise
shapenoise = 0.25

fovpicker = ACS_mask
binnoiser = no_bin_noise

simreader = MXXL

model = NFW
fitter = MCMC

profile_min = 0.25
profile_max = 0.8

center_generator = no_offset
# This one may be a little more complicated. Need to look more in depth though first
#galaxypicker=simutils.Composite(densitypicker,fovpicker)
galaxy_picker = composite
zsource = 2.0

To make this, I only pasted together what was there so names and format is a little lacking. The general idea though is you load this object and then you can access each section by
cfgin['General']['number_of_configurations']

You would be able to set multiple configurations by just making a section [Config2], [Config3], etc and it can simply be looped over. Let me know what you guys think, if you think it would be a good use of time, I can go through and make the changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions