Beispiel #1
0
    def galaxy_props(self, input_dict):

        # Make sure all of the kwargs are given.
        gal_props_checker(input_dict)

        self._galaxy_props = input_dict
Beispiel #2
0
    def create_table(self, bubbles, galaxy_props):
        '''
        Create a Table from a list of bubbles
        '''

        # Check to make sure all of the properties are there
        gal_props_checker(galaxy_props)

        # Create columns of the bubble properties
        props = {"pa": [u.deg, "Position angle of the bubble"],
                 "bubble_type": [u.dimensionless_unscaled, "Type of bubble"],
                 "velocity_center": [u.km / u.s, "Center velocity"],
                 "velocity_width": [u.km / u.s, "Range of velocities bubble"
                                                " is detected."],
                 "eccentricity": [u.dimensionless_unscaled,
                                  "Shape eccentricity"],
                 "expansion_velocity": [u.km / u.s, "Expansion velocity"],
                 "avg_shell_flux_density": [u.K * u.km / u.s,
                                            "Average flux density in bubble "
                                            "shell"],
                 "total_shell_flux_density": [u.K * u.km / u.s,
                                              "Total flux density in bubble "
                                              "shell"],
                 "shell_column_density": [u.cm ** -2,
                                          "Average column density in the "
                                          "shell"],
                 "hole_contrast": [u.dimensionless_unscaled,
                                   "Average intensity difference between hole"
                                   " and shell."],
                 "diameter_physical": [u.pc, "Physical diameter"],
                 "major_physical": [u.pc, "Physical major radius"],
                 "minor_physical": [u.pc, "Physical minor radius"],
                 "diameter_angular": [u.deg, "Angular diameter"],
                 "major_angular": [u.deg, "Angular major radius"],
                 "minor_angular": [u.deg, "Angular minor radius"],
                 "galactic_radius": [u.kpc, "Galactic radius of the"
                                            " center."],
                 "galactic_pa": [u.deg, "Galactic PA of the center."],
                 "shell_fraction": [u.dimensionless_unscaled,
                                    "Fraction of shell enclosing the hole."],
                 "is_closed": [u.dimensionless_unscaled, "Closed or partial "
                               "shell (shell fraction > 0.9 is closed)"]}

        prop_funcs = {"tkin": [u.Myr, "Kinetic age of the bubble.", {}],
                      "shell_volume_density":
                      [u.cm ** -3,
                       "Average hydrogen volume "
                       "density in the shell.",
                       {"scale_height": galaxy_props["scale_height"],
                        "inclination": galaxy_props["inclination"]}],
                      "volume":
                      [u.pc ** 3, "Volume of the hole.",
                       {"scale_height": galaxy_props["scale_height"]}],
                      "hole_mass":
                      [u.Msun, "Inferred mass of the hole from the shell"
                               " volume density.",
                       {"scale_height": galaxy_props["scale_height"],
                        "inclination": galaxy_props["inclination"]}],
                      "formation_energy":
                      [u.erg, "Energy required to create the hole.",
                       {"scale_height": galaxy_props["scale_height"],
                        "inclination": galaxy_props["inclination"]}]}

        columns = []

        # The center coordinates are different, since they're SkyCoords
        columns.append(SkyCoord([bub.center_coordinate for bub in bubbles]))

        # Same for is_closed
        columns.append(Column([bub.is_closed for bub in bubbles],
                              unit=u.dimensionless_unscaled,
                              description="Closed or partial shell.",
                              name="closed_shell"))

        # Add the properties
        for name in props:
            unit, descrip = props[name]
            columns.append(Column(_has_nan([getattr(bub, name).to(unit).value
                                            for bub in bubbles], name),
                                  name=name, description=descrip,
                                  unit=unit.to_string()))

        # Add the functions
        for name in prop_funcs:
            unit, descrip, imps = prop_funcs[name]
            columns.append(
                Column(_has_nan([getattr(bub, name)(**imps).to(unit).value
                                 for bub in bubbles], name), name=name,
                       description=descrip,
                       unit=unit.to_string()))

        # all_names = ["center_coordinate"] + props.keys() + prop_funcs.keys()

        self.table = Table(columns)
Beispiel #3
0
    def create_table(self, bubbles, galaxy_props):
        '''
        Create a Table from a list of bubbles
        '''

        # Check to make sure all of the properties are there
        gal_props_checker(galaxy_props)

        # Create columns of the bubble properties
        props = {
            "pa": [u.deg, "Position angle of the bubble"],
            "bubble_type": [u.dimensionless_unscaled, "Type of bubble"],
            "velocity_center": [u.km / u.s, "Center velocity"],
            "velocity_width":
            [u.km / u.s, "Range of velocities bubble"
             " is detected."],
            "eccentricity": [u.dimensionless_unscaled, "Shape eccentricity"],
            "expansion_velocity": [u.km / u.s, "Expansion velocity"],
            "avg_shell_flux_density":
            [u.K * u.km / u.s, "Average flux density in bubble "
             "shell"],
            "total_shell_flux_density":
            [u.K * u.km / u.s, "Total flux density in bubble "
             "shell"],
            "shell_column_density":
            [u.cm**-2, "Average column density in the "
             "shell"],
            "hole_contrast": [
                u.dimensionless_unscaled,
                "Average intensity difference between hole"
                " and shell."
            ],
            "diameter_physical": [u.pc, "Physical diameter"],
            "major_physical": [u.pc, "Physical major radius"],
            "minor_physical": [u.pc, "Physical minor radius"],
            "diameter_angular": [u.deg, "Angular diameter"],
            "major_angular": [u.deg, "Angular major radius"],
            "minor_angular": [u.deg, "Angular minor radius"],
            "galactic_radius": [u.kpc, "Galactic radius of the"
                                " center."],
            "galactic_pa": [u.deg, "Galactic PA of the center."],
            "shell_fraction": [
                u.dimensionless_unscaled,
                "Fraction of shell enclosing the hole."
            ],
            "is_closed": [
                u.dimensionless_unscaled, "Closed or partial "
                "shell (shell fraction > 0.9 is closed)"
            ]
        }

        prop_funcs = {
            "tkin": [u.Myr, "Kinetic age of the bubble.", {}],
            "shell_volume_density": [
                u.cm**-3, "Average hydrogen volume "
                "density in the shell.", {
                    "scale_height": galaxy_props["scale_height"],
                    "inclination": galaxy_props["inclination"]
                }
            ],
            "volume": [
                u.pc**3, "Volume of the hole.", {
                    "scale_height": galaxy_props["scale_height"]
                }
            ],
            "hole_mass": [
                u.Msun, "Inferred mass of the hole from the shell"
                " volume density.", {
                    "scale_height": galaxy_props["scale_height"],
                    "inclination": galaxy_props["inclination"]
                }
            ],
            "formation_energy": [
                u.erg, "Energy required to create the hole.", {
                    "scale_height": galaxy_props["scale_height"],
                    "inclination": galaxy_props["inclination"]
                }
            ]
        }

        columns = []

        # The center coordinates are different, since they're SkyCoords
        columns.append(SkyCoord([bub.center_coordinate for bub in bubbles]))

        # Same for is_closed
        columns.append(
            Column([bub.is_closed for bub in bubbles],
                   unit=u.dimensionless_unscaled,
                   description="Closed or partial shell.",
                   name="closed_shell"))

        # Add the properties
        for name in props:
            unit, descrip = props[name]
            columns.append(
                Column(_has_nan(
                    [getattr(bub, name).to(unit).value for bub in bubbles],
                    name),
                       name=name,
                       description=descrip,
                       unit=unit.to_string()))

        # Add the functions
        for name in prop_funcs:
            unit, descrip, imps = prop_funcs[name]
            columns.append(
                Column(_has_nan([
                    getattr(bub, name)(**imps).to(unit).value
                    for bub in bubbles
                ], name),
                       name=name,
                       description=descrip,
                       unit=unit.to_string()))

        # all_names = ["center_coordinate"] + props.keys() + prop_funcs.keys()

        self.table = Table(columns)
Beispiel #4
0
    def galaxy_props(self, input_dict):

        # Make sure all of the kwargs are given.
        gal_props_checker(input_dict)

        self._galaxy_props = input_dict