Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SFR-Mstars plane python script #21

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

angel-chandro
Copy link
Contributor

@angel-chandro angel-chandro commented Oct 24, 2024

Python script that generates the SFR vs stellar mass plane at z=0,1,2 with some additional observational data.

Summary by Sourcery

New Features:

  • Introduce a Python script to generate the Star Formation Rate (SFR) versus stellar mass plane at redshifts z=0, 1, and 2, incorporating observational data.

Copy link

sourcery-ai bot commented Oct 24, 2024

Reviewer's Guide by Sourcery

This PR adds a new Python script that generates plots showing the relationship between Star Formation Rate (SFR) and stellar mass at different redshifts (z=0,1,2). The script creates a panel of three plots, each representing a different redshift, and includes observational data and theoretical fits for comparison. The implementation uses matplotlib for visualization and includes statistical utilities for data processing.

Class diagram for the SFR-Mstars plane script

classDiagram
    class SFRMstarsPanel {
        +observation
        +logger
        +GyrToYr
        +Zsun
        +XH
        +MpcToKpc
        +mlow
        +mupp
        +dm
        +mbins
        +xmf
        +imf
        +mlow2
        +mupp2
        +dm2
        +mbins2
        +xmf2
        +mlow3
        +mupp3
        +dm3
        +mbins3
        +xmf3
        +ssfrlow
        +ssfrupp
        +dssfr
        +ssfrbins
        +xssfr
        +sfrlow
        +sfrupp
        +dsfr
        +sfrbins
        +xsfr
        +size1
        +size2
        +stext
        +fsize
        +saxis
        +linw1
        +linw2
        +linw3
        +linw4
        +spad
        +spadx
        +spady
        +col
        +logMstars
        +sfms_fit_popesso23(t)
        +sfms_fit_schreiber15(m, z)
        +plot_sfms(plt, outdir, h0, omega_m, omega_b, obsdir, mainseqsf_1)
        +prepare_data(hdf5_data, index, mainseqsf)
        +main(modeldir, outdir, redshift_table, subvols, obsdir)
    }
Loading

File-Level Changes

Change Details Files
Implementation of the main plotting functionality for SFR vs stellar mass
  • Created a panel of three plots using matplotlib GridSpec
  • Added plotting of model predictions with error bands
  • Implemented comparison with observational data from multiple sources
  • Added theoretical fit lines from Popesso+23 and other studies
standard_plots/sfr_mstars_panel.py
Data processing and statistical analysis implementation
  • Added functions to prepare and bin the simulation data
  • Implemented statistical calculations for median and percentile bands
  • Created helper functions for theoretical SFR-mass relations
standard_plots/sfr_mstars_panel.py
Configuration and initialization setup
  • Defined constants and configuration parameters
  • Set up mass function initialization parameters
  • Added plot styling constants
  • Implemented command-line argument parsing
standard_plots/sfr_mstars_panel.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @angel-chandro - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider moving the plotting constants (sizes, line widths, colors, etc.) to a configuration file to improve maintainability and make the visualization parameters more easily adjustable.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

standard_plots/sfr_mstars_panel.py Show resolved Hide resolved
standard_plots/sfr_mstars_panel.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant