Esempio n. 1
0
def markgal(group, max_temp, min_rho) :
    """Mark all the gas particles in group that have temperatures less
    than or equal to max_temp and densities greater than or equal to
    min_rho. This command can be used to mark those gas particles that
    are likely to be in galaxies."""

    # check if simulation loaded
    if charm.getGroups() == None :
        raise StandardError('Simulation not loaded')
    
    # get opposing boundaries from simulation values
    max_rho = charm.getAttributeRange('gas', 'density')[1]
    min_temp = charm.getAttributeRange('gas', 'temperature')[0]
    
    # play the createGroup shuffle
    charm.createGroup_Family('tmp_group_fam', group, 'gas')
    charm.createGroup_AttributeRange('tmp_group1', 'tmp_group_fam', 'density',
                                     min_rho, max_rho)
    charm.createGroup_AttributeRange('tmp_group2', 'tmp_group1',
                                     'temperature', min_temp, max_temp)
    charm.markParticlesGroup('tmp_group2')
    
    # remove the temporary groups to avoid clutter
    charm.deleteGroup('tmp_group_fam')
    charm.deleteGroup('tmp_group1')
    charm.deleteGroup('tmp_group2')
Esempio n. 2
0
def markbox(group) :
    """Mark the contents of group. Marked particles are indicated by a "mark"
    attribute being set to non-zero."""

    # check if simulation loaded
    if charm.getGroups() == None :
        raise StandardError('Simulation not loaded')
    
    charm.markParticlesGroup(group)