Example #1
0
def angle_rmsZ(parm, sites_cart, ignore_hd, get_deltas=False):
    if ignore_hd:
        angles = parm.angles_without_h
    else:
        angles = itertools(parm.angles_inc_h, parm.angles_without_h)
    angle_Zs = []
    # save coordinates here since calling parm.coordinates is time consumming
    parm_coordinates = parm.coordinates
    for i, angle in enumerate(angles):
        atom1_idx = angle.atom1.idx
        atom2_idx = angle.atom2.idx
        atom3_idx = angle.atom3.idx
        natoms = len(sites_cart)
        if atom1_idx >= natoms or atom2_idx >= natoms or atom3_idx >= natoms:
            continue
        atom1 = parm_coordinates[atom1_idx]
        atom2 = parm_coordinates[atom2_idx]
        atom3 = parm_coordinates[atom3_idx]
        a = [atom1[0] - atom2[0], atom1[1] - atom2[1], atom1[2] - atom2[2]]
        b = [atom3[0] - atom2[0], atom3[1] - atom2[1], atom3[2] - atom2[2]]
        a = flex.double(a)
        b = flex.double(b)
        Z = sqrt(angle.type.k) * (angle.type.theteq -
                                  acos(a.dot(b) /
                                       (a.norm() * b.norm())) * 180 / pi)
        angle_Zs.append(Z)
    angle_Zs = flex.double(angle_Zs)
    a_sq = angle_Zs * angle_Zs
    a_ave = sqrt(flex.mean_default(a_sq, 0))
    a_max = sqrt(flex.max_default(a_sq, 0))
    a_min = sqrt(flex.min_default(a_sq, 0))
    if not get_deltas:
        return (a_min, a_max, a_ave)
    else:
        return (a_min, a_max, a_ave), angle_Zs
Example #2
0
    def mask_to_string(mask):
        """
        Converts a bitmask of events to a human-readable string.

        :param mask: the bitmask of events
        :type mask: int
        :returns: a string in the form EVENT1 | EVENT2 | EVENT3 ...
        """
        events = []
        for attr in itertools(["CHANGE"], INotify.__dict__.keys()):
            if attr == "WATCH_MASK" or attr[0] not in string.ascii_uppercase:
                continue
            event = getattr(INotify, attr)
            if mask & event == event:
                events.append(attr)
                mask &= ~event
        return " | ".join(events)
Example #3
0
    def mask_to_string(mask):
        """
        Converts a bitmask of events to a human-readable string.

        :param mask: the bitmask of events
        :type mask: int
        :returns: a string in the form EVENT1 | EVENT2 | EVENT3 ...
        """
        events = []
        for attr in itertools(['CHANGE'], INotify.__dict__.keys()):
            if attr == 'WATCH_MASK' or attr[0] not in string.ascii_uppercase:
                continue
            event = getattr(INotify, attr)
            if mask & event == event:
                events.append(attr)
                mask &= ~event
        return ' | '.join(events)
Example #4
0
def simple_product(i, j):
    return itertools(range(i), range(j))
def cumulativeSum(input):
    print ("Sum :", list(itertools(input)))
Example #6
0
## do nlp on words to identify nouns.


## do decorate, sort, undecorate



for row in ws.values.tolist():
    print row
    words = row[0].split()
    prob = row[1]
    for w in words:
        ks[w] += prob

k = collections.defaultdict(float)
for w in itertools(*wss):
    k[w] += 


k = dict.fromkeys(itertools.chain(*wss), 0)






x = {}
import itertools
dict.fromkeys(itertools.chain(*wss))

ws = xx[xx['label']==0][['word','prob']]