Code Monkey home page Code Monkey logo

cigale's Introduction

CIGALE means Code Investigating GALaxy Emission. The code has been developed to study the evolution of galaxies by comparing modelled galaxy spectral energy distributions (SEDs) to observed ones from the X-rays and far ultraviolet to the far infra-red and radio. The git repository is on our Gitlab but you can use Github for discussions and bug reports if you desire.

cigale's People

Stargazers

jiang dong avatar Jongin Park avatar Rohan Naidu avatar Louise Edwards avatar Wenjun Chang avatar Rafał Potempa avatar nmatsumoto avatar Médéric Boquien avatar Guang avatar Masato Onodera avatar

Watchers

Médéric Boquien avatar James Cloos avatar Michael Rutkowski avatar Guang avatar Ollie Pye avatar  avatar

cigale's Issues

SED plotting for savefluxes mode

Hi there, I would like to plot the SED for my simulated models but I am running into an error. The first error is

IORegistryError: Format could not be identified based on the file name or contents, please provide a 'format' argument.

I am using the simulate_bzk ini file provided in the examples but setting save_sed to True, and I am running pcigale run; pcigale-plots sed

Might I need to change some other settings?

Thanks

Format of parameters_file in savefluxes mode

Hi. I'm using CIGALE with savefluxes mode to simulate the SED.
I want to input the free parameters through parameters_file instead of directly editing the pcigale.ini file.
I made the attached parameters_file and try "pcigale genconf" command, but the following error occurs.
Is the format of my parameters_file wrong?

$ pcigale genconf
╭────────────────────────────────────────────────────────────────────────────────╮
│ Code Investigating GALaxy Emission │
│ Boquien et al. (2019) (https://cigale.lam.fr) │
│ CIGALE version: 2023.0.dev0 — Python version: 3.10.10 — Platform: linux-x86_64 │
╰────────────────────────────────────────────────────────────────────────────────╯
[INFO] The configuration file has been updated. Please complete the various module parameters and the data file columns to use in the analysis.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/tsujita/miniconda3/envs/py310/bin/pcigale:33 in │
│ │
│ 30 │
│ 31 if name == 'main': │
│ 32 │ sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0]) │
│ ❱ 33 │ sys.exit(load_entry_point('pcigale', 'console_scripts', 'pcigale')()) │
│ 34 │
│ │
│ /home/tsujita/Research/ALCS/cigale/pcigale/init.py:139 in main │
│ │
│ 136 │ │ if args.parser == "init": │
│ 137 │ │ │ init(config) │
│ 138 │ │ elif args.parser == "genconf": │
│ ❱ 139 │ │ │ genconf(config) │
│ 140 │ │ elif args.parser == "check": │
│ 141 │ │ │ check(config) │
│ 142 │ │ elif args.parser == "run": │
│ │
│ /home/tsujita/Research/ALCS/cigale/pcigale/init.py:50 in genconf │
│ │
│ 47 │ │
│ 48 │ # Pass config rather than configuration as the file cannot be auto-filled. │
│ 49 │ info = Info(config.config) │
│ ❱ 50 │ info.print_tables() │
│ 51 │
│ 52 │
│ 53 def check(config): │
│ │
│ /home/tsujita/Research/ALCS/cigale/pcigale/utils/info.py:50 in print_tables │
│ │
│ 47 │ │ """Print the summary CIGALE info table and the SED modules table.""" │
│ 48 │ │ │
│ 49 │ │ console.print("\n") │
│ ❱ 50 │ │ self.print_summaryinfo_table() │
│ 51 │ │ │
│ 52 │ │ console.print("\n") │
│ 53 │ │ self.print_sedmodules_table() │
│ │
│ /home/tsujita/Research/ALCS/cigale/pcigale/utils/info.py:84 in print_summaryinfo_table │
│ │
│ 81 │ │ if len(self.config["data_file"]) == 0: │
│ 82 │ │ │ fname_data = "[warning]None[/warning]" │
│ 83 │ │ │ ntargets = "[warning]None[/warning]" │
│ ❱ 84 │ │ │ z = self.config["sed_modules_params"]["redshifting"]["redshift"] │
│ 85 │ │ │ if len(z) == 0: │
│ 86 │ │ │ │ z = "Not indicated" │
│ 87 │ │ │ else: │
│ │
│ /home/tsujita/miniconda3/envs/py310/lib/python3.10/site-packages/configobj.py:554 in getitem
│ │
│ 551 │ │
│ 552 │ def getitem(self, key): │
│ 553 │ │ """Fetch the item and do string interpolation.""" │
│ ❱ 554 │ │ val = dict.getitem(self, key) │
│ 555 │ │ if self.main.interpolation: │
│ 556 │ │ │ if isinstance(val, six.string_types): │
│ 557 │ │ │ │ return self._interpolate(key, val) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'redshifting'`

pcigale.ini : https://drive.google.com/file/d/1V55waSX-M8HrIeZQGr0wSt7WrSEzJ8hk/view?usp=share_link
parameters_file : https://drive.google.com/file/d/15hptf_xwLDoMVr3OU892r7H7Upj2PUYb/view?usp=sharing

Fritz model

Error_Fritz.txt
Hello, I have been working with Cigale for a week and a half now and I created some SEDs with Cigale using the SKIRTOR model, but when I try to use the Fritz model I end up getting an error when I do pcigale check. I use Fritz2006 and the xray package

'The information agn.intrin_Lnu_2500A_30deg is already present in the SED. '

I even get this error when I don't change any parameters after the genconf.
Any help would be amazing, thank you

Issue with chunksize or ncores?

I'm not sure why, but I keep getting this error:
IndexError: index -501 is out of bounds for axis 0 with size 500

I'm using 128 cores, 128 chunks.

Here's the full traceback:

`╭───────────────────── Traceback (most recent call last) ─────────────────────╮

│ /home/user/.local/bin/pcigale:11 in │
│ │
│ 8 if name == 'main': │
│ 9 │ sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0]) │
│ 10 │ sys.exit( │
│ ❱ 11 │ │ load_entry_point('pcigale==2022.1', 'console_scripts', 'pcigale │
│ 12 │ ) │
│ 13 │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/init.py:139 in │
│ main │
│ │
│ 136 │ │ elif args.parser == "check": │
│ 137 │ │ │ check(config) │
│ 138 │ │ elif args.parser == "run": │
│ ❱ 139 │ │ │ run(config) │
│ 140 │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/init.py:71 in │
│ run │
│ │
│ 68 │ │ console.print(f"{INFO} Start: {start.isoformat('/', 'seconds') │
│ 69 │ │ start = time.monotonic() # Simpler time for run duration │
│ 70 │ │ │
│ ❱ 71 │ │ analysis_module.process(configuration) │
│ 72 │ │ │
│ 73 │ │ end = dt.datetime.now() │
│ 74 │ │ console.print(f"{INFO} End: {end.isoformat('/', 'seconds')}") │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/analysis_modules/p │
│ df_analysis/init.py:235 in process │
│ │
│ 232 │ │ obs = ObservationsManager(conf, params) │
│ 233 │ │ obs.save("observations") │
│ 234 │ │ │
│ ❱ 235 │ │ results = self._compute(conf, obs, params) │
│ 236 │ │ console.print(f"{INFO} Sanity check of the analysis results.") │
│ 237 │ │ results.best.analyse_chi2() │
│ 238 │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/analysis_modules/p │
│ df_analysis/init.py:182 in _compute │
│ │
│ 179 │ │ │ # avoid recomputing the models when we do a mock analysis │
│ 180 │ │ │ if not hasattr(self, "_models"): │
│ 181 │ │ │ │ console.print(f"{INFO} Computing models.") │
│ ❱ 182 │ │ │ │ models = self._compute_models(conf, obs, params, ibloc │
│ 183 │ │ │ │ if nblocks == 1: │
│ 184 │ │ │ │ │ self._models = models │
│ 185 │ │ │ else: │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/analysis_modules/p │
│ df_analysis/init.py:113 in _compute_models │
│ │
│ 110 │ │ │ params.blocks[iblock], │
│ 111 │ │ │ initargs, │
│ 112 │ │ │ init_worker_sed, │
│ ❱ 113 │ │ │ conf["cores"] │
│ 114 │ │ ) │
│ 115 │ │ │
│ 116 │ │ # Print the final value as it may not otherwise be printed │
│ │
│ /home/user/.local/lib/python3.6/site-packages/pcigale/analysis_modules/p │
│ df_analysis/init.py:168 in _parallel_job │
│ │
│ 165 │ │ │ with mp.Pool( │
│ 166 │ │ │ │ processes=ncores, initializer=initializer, initargs=in │
│ 167 │ │ │ ) as pool: │
│ ❱ 168 │ │ │ │ pool.starmap(worker, enumerate(items), chunksize) │
│ 169 │ │ │ │
│ 170 │ │ │ # After the parallel processes have exited, it can be rest │
│ 171 │ │ │ counter.progress = progress │
│ │
│ /usr/lib64/python3.6/multiprocessing/pool.py:274 in starmap │
│ │
│ 271 │ │ be iterables as well and will be unpacked as arguments. Hence │
│ 272 │ │ func and (a, b) becomes func(a, b). │
│ 273 │ │ ''' │
│ ❱ 274 │ │ return self._map_async(func, iterable, starmapstar, chunksize) │
│ 275 │ │
│ 276 │ def starmap_async(self, func, iterable, chunksize=None, callback=N │
│ 277 │ │ │ error_callback=None): │
│ │
│ /usr/lib64/python3.6/multiprocessing/pool.py:644 in get │
│ │
│ 641 │ │ if self._success: │
│ 642 │ │ │ return self._value │
│ 643 │ │ else: │
│ ❱ 644 │ │ │ raise self._value │
│ 645 │ │
│ 646 │ def _set(self, i, obj): │
│ 647 │ │ self._success, self._value = obj │
╰──────────────────────────────────────────────────────────────────────────────╯
IndexError: index -501 is out of bounds for axis 0 with size 500`

sed.wavelength_grid=None

After running pcigale check in my data directory, I get the error: TypeError: unsupported operand type(s) for *=: 'NoneType' and 'float'.
I'm not sure why this wavelength_grid is being set to None, but the sed object seems to exist. This is occurring in pcigale/sed_modules/redshifting.py at line 188: sed.wavelength_grid *= 1. + redshift. I verified that the redshift variable is not None but a float.

Mismatch between 'best redshift' and probability distribution function for redshift

Hello!

I am having an issue when estimating redshift values using CIGALE. I get a mismatch between the 'best redshift' in the results.txt/SED plot and the highest peak redshift in the probability distribution function (PDF).

I am interested in obtaining a photometric redshift for certain sources, but I am first testing the program using sources for which I have trustworthy spectroscopic redshifts. I have yet to obtain a match between the spectroscopic redshift and the estimated redshift using CIGALE. However, when I check the PDF for 'universal.redshift', the highest peak is at the correct redshift. Is there a reason for this mismatch? Is there something I can do to improve it? Is it simply a bad SED fit? Or is there another parameter that is affecting the 'best redshift' result. See below:

PDF for redshift: 0_universe.redshift_pdf.pdf
SED fitting for same source (with 'best redshift'): 0_best_model.pdf

The actual redshift is z = 1.49004. The highest peak is near 1.5, but the PDF is also very wide, with multiple smaller peaks.

Thank you in advance!

Attribute error on SaveFluxes

Hi,

When switching from the pdfanalysis to savefluxes I ran into an attribute error:

AttributeError: 'NoneType' object has no attribute 'from_index'

I have went through the source code on gitlab and I think that I managed to find the culprit behind this.
On pdf_analysis/init.py we have:

# Store the grid of parameters in a manager to facilitate the
        # computation of the models
        params = ParametersManager(conf)

        # Store the observations in a manager which sanitises the data, checks
        # all the required fluxes are present, adding errors if needed,
        # discarding invalid fluxes, etc.
        obs = ObservationsManager(conf, params)
        obs.save("observations")

        results = self._compute(conf, obs, params)

On the other hand, "savefluxes" does not pass the "params" input parameter to "ObservationsManager":

observations = ObservationsManager(conf)

  # The parameters manager allows us to retrieve the models parameters
  # from a 1D index. This is useful in that we do not have to create
  # a list of parameters as they are computed on-the-fly. It also has
  # nice goodies such as finding the index of the first parameter to
  # have changed between two indices or the number of models.
  params = ParametersManager(conf)

  self._compute_models(conf, observations, params)

It seems that the straightforward fix to this is to update the savefluxes.SaveFluxes function to be like the former one:

       params = ParametersManager(conf)

observations = ObservationsManager(conf, params)
 self._compute_models(conf, observations, params)

However, I am not sure if this would break the logic behind the code. Would this work as a fix or am I missing something else?

Too many open files

CIGALE version: 2022.0 — Python version: 3.10.3 — Platform: linux-x86_64

When running pcigale with many blocks and cpu, the program stop after several blocks (depend of pcigale.ini parameters) with the unix message "Too many open files".

If I increase the limit (ex: ulimit -n 131000) in the terminal before running pcigale, it completes with no issue.

After investigating during a running pcigale run, I can see that /proc/$PID/fd folder is constantly increasing slightly. It looks like that some shared memory segments /dev/shm/pym-xxxxxx might not be deleted.

($PID is the process id of the running pcigale process)

Segfault triggers broken pipe in multiprocessors

Hello,

I found an issue that confused me. I was running CIGALE and received a segmentation fault during the model computation phase which triggered a broken pipe in the multiprocessors module. When this happens, the cores die off one by one and the multiprocessor is left waiting for the return from each CPU. This results in the system holding memory but with no models being computed.

One thing I found was that this occurred when I changed the parameter redshift_decimals from 2 to 3. However, due to the long time in the computation, it is hard to tell what triggers the error.

Has this kind of issue been brought up before?

Screen Shot 2023-09-05 at 17 09 23

Some info on the system.
Python 3.10.12
astropy 5.3.2
configobj 5.0.8
contourpy 1.1.0
cycler 0.11.0
fonttools 4.42.1
kiwisolver 1.4.5
markdown-it-py 3.0.0
matplotlib 3.7.2
mdurl 0.1.2
numpy 1.25.2
packaging 23.1
pcigale 2022.1
Pillow 10.0.0
pip 22.0.2
pyerfa 2.0.0.3
Pygments 2.16.1
pyparsing 3.0.9
python-dateutil 2.8.2
PyYAML 6.0.1
rich 13.5.2
scipy 1.11.2
setuptools 59.6.0
six 1.16.0

header too long

The following error appears when running cigale:

'ValueError: The header keyword 'param.restframe_subaru.suprime.V-vista.vircam.J' with its value is too long'

These could potentially be even longer with available filter names.

Manual link does not work

On cigale.lam.fr, I wanted to use the manual, but the link takes to a github page that can not be located

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.