def get_positive_velocity_clouds(input_catalog, max_descendants=10):

    catalog = input_catalog.copy(copy_data=True)

    # narrow down how we select clouds
    disqualified_location = (
        (catalog['v_cen'] < 10) |
        (catalog['x_cen'] > 280) |
        (catalog['x_cen'] < 205) |
        (catalog['on_edge'] == 1) |
        (catalog['x_sol'] < -7) 
    )

    disqualified_tree = (
        (catalog['n_descendants'] > max_descendants) |
        (catalog['fractional_gain'] > 0.9))

    pre_output_catalog = catalog[~disqualified_tree & ~disqualified_location]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(d, pre_output_catalog)

    # these objects already have mass, size etc computed so that's fine
    final_qualified = (almost_output_catalog['mass'] > 3e3)
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
def compile_thirdquad_catalog(input_catalog):

    positive_v_catalog = get_positive_velocity_clouds(input_catalog)

    composite_unreduced_catalog = astropy.table.vstack([positive_v_catalog])

    composite_reduced_catalog = reduce_catalog(d, composite_unreduced_catalog)

    return composite_reduced_catalog
Esempio n. 3
0
def get_negative_velocity_clouds(input_catalog,
                                 max_descendants=10,
                                 dendrogram=d):
    """
    Extracts clouds from the negative-velocity region of the first quad.

    This is the 1Q's Outer Galaxy.
    Here, the KDA does not apply. We first define clouds based on 
    (a) position in velocity space, 
    (b) a cloud is not on an edge, 
    (c) a cloud has less than `max_descendants` descendants, 
    (d) the `fractional_gain` is below 0.9.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure and their physical properties are computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^3 solar masses; this is what's returned.

    Note that the mass criterion is an order of magnitude lower here 
    than in the positive-velocity region; this is mainly because
    (a) less confusion means these lower mass clouds are easy to 
        definitely identify, and
    (b) clouds here are overall lower-mass intrinsically, so we'd have a 
        low count if we didn't include them.

    """

    catalog = input_catalog.copy(copy_data=True)

    # narrow down how we select clouds
    disqualified_location = (
        (catalog['v_cen'] > -5) |
        # (catalog['mass'] < 10 ** 3.5 * u.solMass) |
        # (catalog['disparate'] == 0) |
        (catalog['on_edge'] == 1))

    disqualified_tree = ((catalog['n_descendants'] > max_descendants) |
                         (catalog['fractional_gain'] > 0.9))

    # this step excludes the weird tail near the galactic center
    disqualified_extreme_negative_velocities_near_GC = (
        (catalog['v_cen'] < -10) & (catalog['x_cen'] < 20))

    pre_output_catalog = catalog[
        ~disqualified_tree & ~disqualified_location
        & ~disqualified_extreme_negative_velocities_near_GC]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(dendrogram, pre_output_catalog)

    # these objects already have mass, size etc computed so that's fine
    final_qualified = (almost_output_catalog['mass'] > 3e3)
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
def get_positive_velocity_clouds(input_catalog, max_descendants=10):
    """
    Extracts clouds from the positive-velocity region of the fourth quad.

    This is the 4Q's Outer Galaxy.
    Here, the KDA does not apply. We fourth define clouds based on 
    (a) position in velocity space, 
    (b) a cloud is not on an edge, 
    (c) a cloud has less than `max_descendants` descendants, 
    (d) the `fractional_gain` is below 0.81.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure and their physical properties are computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^3 solar masses; this is what's returned.

    Note that the mass criterion is an order of magnitude lower here 
    than in the positive-velocity region; this is mainly because
    (a) less confusion means these lower mass clouds are easy to 
        definitely identify, and
    (b) clouds here are overall lower-mass intrinsically, so we'd have a 
        low count if we didn't include them.

    """

    catalog = input_catalog.copy(copy_data=True)

    # narrow down how we select clouds
    disqualified_location = (
        ((catalog['v_cen'] < 10) & (catalog['x_cen'] > 340)) |
        ((catalog['v_cen'] < 0) & (catalog['x_cen'] < 340)) |
        (catalog['v_cen'] > 100) |
        (catalog['on_edge'] == 1)
    )

    disqualified_tree = (
        (catalog['n_descendants'] > max_descendants) |
        (catalog['fractional_gain'] > 0.9))

    # this step excludes the weird tail near the galactic center
    disqualified_extreme_positive_velocities_near_GC = (
        (catalog['v_cen'] > 10) & (catalog['x_cen'] > 340))

    pre_output_catalog = catalog[~disqualified_tree &
        ~disqualified_location & ~disqualified_extreme_positive_velocities_near_GC]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(d, pre_output_catalog)

    # these objects already have mass, size etc computed so that's fine
    final_qualified = (almost_output_catalog['mass'] > 3e3)
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
Esempio n. 5
0
def get_positive_velocity_clouds(input_catalog,
                                 max_descendants=10,
                                 dendrogram=d):
    """
    Extracts clouds from the positive-velocity region of the first quad.

    This is the 1Q's inner Galaxy.
    Here, the KDA applies to most structures, so we first define
    clouds based on (a) position in velocity space, (b) a cloud is not
    on an edge, (c) line widths between 1-10 km/s, (d) a cloud has less
    than `max_descendants` descendants, (e) the `fractional_gain` is
    below 0.9.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and their physical properties are 
    computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^4 solar masses; this is what's returned.

    """

    catalog = input_catalog.copy(copy_data=True)

    # one. grab the clouds we think are real
    disqualified = ((catalog['v_cen'] < 20) | (catalog['on_edge'] == 1) |
                    (catalog['v_rms'] <= 1) | (catalog['v_rms'] > 10) |
                    (catalog['max_vsplit'] > 3))

    qualified = ((catalog['n_descendants'] < max_descendants) &
                 (catalog['fractional_gain'] < 0.9))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(dendrogram, pre_output_catalog)

    # disambiguate distances here
    assign_distance_columns(
        almost_output_catalog,
        *distance_disambiguator(almost_output_catalog,
                                ambiguous_threshold=0.05))

    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = ((almost_output_catalog['mass'] > 3e4) |
                       ((almost_output_catalog['KDA_resolution'] == 'A') &
                        (almost_output_catalog['far_mass'] > 3e4)))
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
def compile_carina_catalog(input_catalog):

    negative_v_catalog = get_negative_velocity_clouds(input_catalog)
    positive_v_catalog = get_positive_velocity_clouds(input_catalog)

    composite_unreduced_catalog = astropy.table.vstack([negative_v_catalog, positive_v_catalog])

    composite_reduced_catalog = reduce_catalog(d, composite_unreduced_catalog)

    return composite_reduced_catalog
def get_negative_velocity_clouds(input_catalog, max_descendants=10):
    """
    Extracts clouds from the negative-velocity region of the Carina survey.

    This is the 4Q's inner Galaxy.
    Here, the KDA might apply to some structures, so we first define
    clouds based on (a) position in velocity space, (b) a cloud is not
    on an edge, (c) line widths between 1-10 km/s, (d) a cloud has less
    than `max_descendants` descendants, (e) the `fractional_gain` is
    below 0.81.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and their physical properties are 
    computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^4 solar masses; this is what's returned.

    """

    catalog = input_catalog.copy(copy_data=True)

    # one. grab the clouds we think are real
    disqualified = (
        (catalog['v_cen'] > -15) |
        (catalog['on_edge'] == 1) |
        (catalog['v_rms'] <= 1) |
        (catalog['v_rms'] > 10) |
        (catalog['x_cen'] < 280)
    )

    qualified = (
        (catalog['n_descendants'] < max_descendants) &
        (catalog['fractional_gain'] < 0.9))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(d, pre_output_catalog)

    # disambiguate distances here
    assign_distance_columns(almost_output_catalog, *distance_disambiguator(almost_output_catalog, ambiguous_threshold=0.05))

    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = ((almost_output_catalog['mass'] > 3e4) | 
                       ((almost_output_catalog['KDA_resolution']=='A') & (almost_output_catalog['far_mass'] > 3e4) ) )
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
def compile_carina_catalog(input_catalog):

    negative_v_catalog = get_negative_velocity_clouds(input_catalog)
    positive_v_catalog = get_positive_velocity_clouds(input_catalog)

    composite_unreduced_catalog = astropy.table.vstack(
        [negative_v_catalog, positive_v_catalog])

    composite_reduced_catalog = reduce_catalog(d, composite_unreduced_catalog)

    return composite_reduced_catalog
def compile_firstquad_catalog(input_catalog, dendrogram=d):

    negative_v_catalog = get_negative_velocity_clouds(input_catalog, dendrogram=dendrogram)
    positive_v_catalog = get_positive_velocity_clouds(input_catalog, dendrogram=dendrogram)
    low_v_catalog = get_low_velocity_perseus_clouds(input_catalog, dendrogram=dendrogram)

    composite_unreduced_catalog = astropy.table.vstack([negative_v_catalog, positive_v_catalog, low_v_catalog])

    composite_reduced_catalog = reduce_catalog(dendrogram, composite_unreduced_catalog)

    return composite_reduced_catalog
def get_positive_velocity_clouds(input_catalog, max_descendants=30):
    """
    This extracts clouds from the positive-velocity region of the first quad.

    Here, the KDA applies to most structures, so we first define
    clouds based on (a) position in velocity space, (b) a cloud is not
    on an edge, (c) line widths between 1-10 km/s, (d) a cloud has less
    than `max_descendants` descendants, (e) the `fractional_gain` is 
    below 0.81.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and 

    """


    catalog = input_catalog.copy(copy_data=True)

    # one. grab the clouds we think are real
    disqualified = (
        (catalog['v_cen'] < 20) |
        #        (catalog['mass'] < 10**3.5 * u.solMass) |
        # (catalog['disparate'] == 0) |
        (catalog['on_edge'] == 1) |
        (catalog['v_rms'] <= 1) |
        (catalog['v_rms'] > 10)
        # (np.abs(catalog['fractional_gain'] - 0.5) > 0.05)
    )

    qualified = (
        (catalog['n_descendants'] < max_descendants) &
        (catalog['fractional_gain'] < 0.81))  # &
    # (catalog['mass'] > 10**5 * u.solMass))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(d, pre_output_catalog)

    # disambiguate distances here
    best_distance = distance_disambiguator(almost_output_catalog)
    almost_output_catalog['distance'] = best_distance
    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = (almost_output_catalog['mass'] > 3e4)
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
Esempio n. 11
0
def get_positive_velocity_clouds(input_catalog, max_descendants=30):
    """
    This extracts clouds from the positive-velocity region of the first quad.

    Here, the KDA applies to most structures, so we first define
    clouds based on (a) position in velocity space, (b) a cloud is not
    on an edge, (c) line widths between 1-10 km/s, (d) a cloud has less
    than `max_descendants` descendants, (e) the `fractional_gain` is 
    below 0.81.

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and 

    """

    catalog = input_catalog.copy(copy_data=True)

    # one. grab the clouds we think are real
    disqualified = (
        (catalog['v_cen'] < 20) |
        #        (catalog['mass'] < 10**3.5 * u.solMass) |
        # (catalog['disparate'] == 0) |
        (catalog['on_edge'] == 1) | (catalog['v_rms'] <= 1) |
        (catalog['v_rms'] > 10)
        # (np.abs(catalog['fractional_gain'] - 0.5) > 0.05)
    )

    qualified = ((catalog['n_descendants'] < max_descendants) &
                 (catalog['fractional_gain'] < 0.81))  # &
    # (catalog['mass'] > 10**5 * u.solMass))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(d, pre_output_catalog)

    # disambiguate distances here
    best_distance = distance_disambiguator(almost_output_catalog)
    almost_output_catalog['distance'] = best_distance
    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = (almost_output_catalog['mass'] > 3e4)
    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
Esempio n. 12
0
def compile_firstquad_catalog(input_catalog, dendrogram=d):

    negative_v_catalog = get_negative_velocity_clouds(input_catalog,
                                                      dendrogram=dendrogram)
    positive_v_catalog = get_positive_velocity_clouds(input_catalog,
                                                      dendrogram=dendrogram)
    low_v_catalog = get_low_velocity_perseus_clouds(input_catalog,
                                                    dendrogram=dendrogram)

    composite_unreduced_catalog = astropy.table.vstack(
        [negative_v_catalog, positive_v_catalog, low_v_catalog])

    composite_reduced_catalog = reduce_catalog(dendrogram,
                                               composite_unreduced_catalog)

    return composite_reduced_catalog
Esempio n. 13
0
def export_firstquad_catalog(args=None, **kwargs):
    """ 
    Uses the above functions to create a "polished" and "final" cloud catalog from this quadrant.

    """

    if args is None:
        d, catalog, header, metadata = first_quad_dendrogram()
    else:
        d, catalog, header, metadata = args

    negative_v_catalog = extract_negative_velocity_clouds(catalog, **kwargs)
    positive_v_catalog = extract_positive_velocity_clouds(catalog, **kwargs)
    low_v_catalog = extract_low_velocity_clouds(catalog, **kwargs)

    composite_unreduced_catalog = astropy.table.vstack(
        [negative_v_catalog, positive_v_catalog, low_v_catalog])

    composite_reduced_catalog = reduce_catalog(d, composite_unreduced_catalog)

    return composite_reduced_catalog
def export_firstquad_catalog(args=None, **kwargs):
    """ 
    Uses the above functions to create a "polished" and "final" cloud catalog from this quadrant.

    """

    if args is None:
        d, catalog, header, metadata = first_quad_dendrogram()
    else:
        d, catalog, header, metadata = args

    negative_v_catalog = extract_negative_velocity_clouds(catalog, **kwargs)
    positive_v_catalog = extract_positive_velocity_clouds(catalog, **kwargs)
    low_v_catalog = extract_low_velocity_clouds(catalog, **kwargs)

    composite_unreduced_catalog = astropy.table.vstack(
        [negative_v_catalog, positive_v_catalog, low_v_catalog])

    composite_reduced_catalog = reduce_catalog(d, composite_unreduced_catalog)

    return composite_reduced_catalog
Esempio n. 15
0
def get_low_velocity_perseus_clouds(input_catalog,
                                    max_descendants=10,
                                    dendrogram=d):
    """
    Extracts clouds from the low-velocity Perseus region of Q1.

    This is the 1Q's Perseus Arm at low velocities.
    Here, the KDA applies to some structures, and we are targeting clouds 
    that might overlap with local emission...
    so we first define clouds based on 
    (a) position in velocity space AND LATITUDE,
    (b) a cloud is not on an edge,
    (c) line widths between 1-10 km/s, 
    (d) a cloud has less than `max_descendants` descendants, 
    (e) the `fractional_gain` is below 0.9,

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and their physical properties are 
    computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^4 solar masses AND a distance consistent with 
    the Perseus Arm; this is what's returned.

    """

    catalog = input_catalog.copy(copy_data=True)

    disqualified = ((catalog['v_cen'] < -5) | (catalog['v_cen'] > 20) |
                    (np.abs(catalog['y_cen'] > 1)) | (catalog['x_cen'] < 35) |
                    (catalog['on_edge'] == 1) | (catalog['v_rms'] <= 1) |
                    (catalog['v_rms'] > 10))

    qualified = ((catalog['n_descendants'] < max_descendants) &
                 (catalog['fractional_gain'] < 0.9))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(dendrogram, pre_output_catalog)

    # disambiguate distances here
    assign_distance_columns(
        almost_output_catalog,
        *distance_disambiguator(almost_output_catalog,
                                ambiguous_threshold=0.05))

    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = ((almost_output_catalog['mass'] > 3e4) &
                       (almost_output_catalog['distance'] > 5) &
                       (almost_output_catalog['distance'] < 14))

    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog
def get_low_velocity_perseus_clouds(input_catalog, max_descendants=10, dendrogram=d):
    """
    Extracts clouds from the low-velocity Perseus region of Q1.

    This is the 1Q's Perseus Arm at low velocities.
    Here, the KDA applies to some structures, and we are targeting clouds 
    that might overlap with local emission...
    so we first define clouds based on 
    (a) position in velocity space AND LATITUDE,
    (b) a cloud is not on an edge,
    (c) line widths between 1-10 km/s, 
    (d) a cloud has less than `max_descendants` descendants, 
    (e) the `fractional_gain` is below 0.9,

    Structures that meet the above criteria go into a pre-candidate-cloud
    list, and that list is "flattened" or "reduced" to remove degenerate
    substructure.

    Then the KDA is disambiguated for the relevant structures using the
    function `distance_disambiguator` and their physical properties are 
    computed.

    A final list of clouds is generated by taking structures with a mass
    greater than 3 x 10^4 solar masses AND a distance consistent with 
    the Perseus Arm; this is what's returned.

    """

    catalog = input_catalog.copy(copy_data=True)

    disqualified = (
        (catalog['v_cen'] < -5) |
        (catalog['v_cen'] > 20) |
        (np.abs(catalog['y_cen'] > 1)) |
        (catalog['x_cen'] < 35) |
        (catalog['on_edge'] == 1) |
        (catalog['v_rms'] <= 1) |
        (catalog['v_rms'] > 10)
    )

    qualified = (
        (catalog['n_descendants'] < max_descendants) &
        (catalog['fractional_gain'] < 0.9))

    pre_output_catalog = catalog[~disqualified & qualified]

    # now it's just got clouds that COULD be real
    almost_output_catalog = reduce_catalog(dendrogram, pre_output_catalog)

    # disambiguate distances here
    assign_distance_columns(almost_output_catalog, *distance_disambiguator(almost_output_catalog, ambiguous_threshold=0.05))

    assign_properties(almost_output_catalog)

    # now let's do a thing
    final_qualified = (
        (almost_output_catalog['mass'] > 3e4) &
        (almost_output_catalog['distance'] > 5) &
        (almost_output_catalog['distance'] < 14)
        )

    output_catalog = almost_output_catalog[final_qualified]

    return output_catalog