Commit 5f397973 authored by Médéric Boquien's avatar Médéric Boquien

Add the option to build the database with the high resolution BC03 models...

Add the option to build the database with the high resolution BC03 models rather than the low resolution ones.
parent 019e9f64
......@@ -8,6 +8,7 @@
- Allow the models to be computed by blocks in `savefluxes`. This can be useful when computing a very large grid and/or to split the results file into various smaller files as large files can be difficult to handle. The number of blocks is set with the `blocks` parameters in the pcigale.ini. (Médéric Boquien)
- Allow the observations to be analysed by blocks of models in `pdf\_analysis`. This is useful when computing a very large grid of models that would not fit in memory. The number of blocks is set with the `blocks` parameters in the pcigale.ini. (Médéric Boquien)
- The integrated stellar luminosity is now provided as `stellar.lum`. (Médéric Boquien)
- The high resolution BC03 models have been added. They can be activated when building the database by adding `--bc03res=hr` to the build command. In that case the low resolution models are not built. (Médéric Boquien)
### Changed
- Make the timestamp more readable when moving the out/ directory. (Médéric Boquien)
......
......@@ -313,8 +313,8 @@ def build_m2005(base):
mass_table, flux_age))
def build_bc2003(base):
bc03_dir = os.path.join(os.path.dirname(__file__), 'bc03//')
def build_bc2003(base, res):
bc03_dir = os.path.join(os.path.dirname(__file__), 'bc03/')
# Time grid (1 Myr to 14 Gyr with 1 Myr step)
time_grid = np.arange(1, 14000)
......@@ -330,12 +330,14 @@ def build_bc2003(base):
}
for key, imf in itertools.product(metallicity, ["salp", "chab"]):
base_filename = bc03_dir + "bc2003_lr_" + key + "_" + imf + "_ssp"
ssp_filename = base_filename + ".ised_ASCII"
color3_filename = base_filename + ".3color"
color4_filename = base_filename + ".4color"
ssp_filename = "{}bc2003_{}_{}_{}_ssp.ised_ASCII".format(bc03_dir, res,
key, imf)
color3_filename = "{}bc2003_lr_{}_{}_ssp.3color".format(bc03_dir, key,
imf)
color4_filename = "{}bc2003_lr_{}_{}_ssp.4color".format(bc03_dir, key,
imf)
print("Importing %s..." % base_filename)
print("Importing {}...".format(ssp_filename))
# Read the desired information from the color files
color_table = []
......@@ -738,7 +740,7 @@ def build_schreiber2016(base):
base.add_schreiber2016(models)
def build_base():
def build_base(bc03res='lr'):
base = Database(writable=True)
base.upgrade_base()
......@@ -755,7 +757,7 @@ def build_base():
print('#' * 78)
print("3- Importing Bruzual and Charlot 2003 SSP\n")
build_bc2003(base)
build_bc2003(base, bc03res)
print("\nDONE\n")
print('#' * 78)
......
......@@ -9,10 +9,23 @@ from setuptools import find_packages, setup
class custom_build(build):
user_options = [
('bc03res=', None, 'Resolution of the BC03 models, hr or lr.'),
]
description = 'Build the pcigale database.'
def initialize_options(self):
build.initialize_options(self)
self.bc03res = 'lr'
def finalize_options(self):
assert self.bc03res in ('lr', 'hr'), 'bc03res must be hr or lr!'
build.finalize_options(self)
def run(self):
# Build the database.
import database_builder
database_builder.build_base()
database_builder.build_base(self.bc03res)
# Proceed with the build
build.run(self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment