Dump a frame to the trajectory file

           Arguments:
            | ``title``  --  the title of the frame
            | ``coordinates``  --  a numpy array with coordinates in atomic units
553085
def dump(self, title, coordinates):
        
        print("% 8i" % len(self.symbols), file=self._f)
        print(str(title), file=self._f)
        for symbol, coordinate in zip(self.symbols, coordinates):
            print("% 2s % 12.9f % 12.9f % 12.9f" % ((symbol, ) + tuple(coordinate/self.file_unit)), file=self._f)
1029465
def save_json(self, frames):
        
        if self.json_save_path is None: return
        path = os.path.join(self.json_save_path, '%s.json' % self.id)
        if not os.path.isdir(self.json_save_path):
            os.mkdir(self.json_save_path)
        with open(path, 'w') as f:
            json.dump(frames, f)
        self.json_data = frames
350487
def load_remote_trajectory(url, format=None):
    '''
    
    '''
    from urllib import urlretrieve
    filename, headers = urlretrieve(url)
    load_trajectory(filename, format)
220280
def serialize_skycoord(o):
    
    representation = o.representation.get_name()
    frame = o.frame.name

    r = o.represent_as('spherical')

    d = dict(
        _type='astropy.coordinates.SkyCoord',
        frame=frame,
        representation=representation,
        lon=r.lon,
        lat=r.lat)

    if len(o.distance.unit.to_string()):
        d['distance'] = r.distance

    return d
260715
def visual(title, X, name):
    
    assert len(X.shape) == 4
    X = X.transpose((0, 2, 3, 1))
    X = np.clip((X - np.min(X))*(255.0/(np.max(X) - np.min(X))), 0, 255).astype(np.uint8)
    n = np.ceil(np.sqrt(X.shape[0]))
    buff = np.zeros((int(n*X.shape[1]), int(n*X.shape[2]), int(X.shape[3])), dtype=np.uint8)
    for i, img in enumerate(X):
        fill_buf(buff, i, img, X.shape[1:3])
    buff = buff[:, :, ::-1]
    plt.imshow(buff)
    plt.title(title)
    plt.savefig(name)
1248686
def as_frame(self):
        
        sids, frames = self.response_map.keys(), self.response_map.values()
        frame = pd.concat(frames, keys=sids, axis=1)
        return frame
1171400
def format_xyz(title = "Aims Geoemtry")
      output = self.atoms.size.to_s + "\n"
      output << "#{title} \n"
      self.atoms.each{ |a| 
        output << [a.species, a.x.to_s, a.y.to_s, a.z.to_s].join("\t") + "\n"
      }
      output
    end
535857
def CaptureFrameLocals(self, frame):
    
    # Capture all local variables (including method arguments).
    variables = {n: self.CaptureNamedVariable(n, v, 1,
                                              self.default_capture_limits)
                 for n, v in six.viewitems(frame.f_locals)}

    # Split between locals and arguments (keeping arguments in the right order).
    nargs = frame.f_code.co_argcount
    if frame.f_code.co_flags & inspect.CO_VARARGS: nargs += 1
    if frame.f_code.co_flags & inspect.CO_VARKEYWORDS: nargs += 1

    frame_arguments = []
    for argname in frame.f_code.co_varnames[:nargs]:
      if argname in variables: frame_arguments.append(variables.pop(argname))

    return (frame_arguments, list(six.viewvalues(variables)))
862940
def get_title():
    ''' 
    '''
    MAX_LEN = 256
    buffer_ = create_unicode_buffer(MAX_LEN)
    kernel32.GetConsoleTitleW(buffer_, MAX_LEN)
    log.debug('%s', buffer_.value)
    return buffer_.value
694494
def dump(self, content, filepath, indent=4):
        
        with open(filepath, 'w') as fp:
            pyaml.dump(content, dst=fp, indent=indent)
1034522
def dump(self, dump_filename, pickle_protocol=pickle.HIGHEST_PROTOCOL):
        
        result = self.result()

        with open(dump_filename, 'wb') as f:
            pickle.dump((self.__class__, result), f, pickle_protocol)
528685
def set_linetrace_on_frame(f, localtrace=None):
    
    traceptr, _, _ = get_frame_pointers(f)
    if localtrace is not None:
        # Need to incref to avoid the frame causing a double-delete
        ctypes.pythonapi.Py_IncRef(localtrace)
        # Not sure if this is the best way to do this, but it works.
        addr = id(localtrace)
    else:
        addr = 0

    traceptr.contents = ctypes.py_object.from_address(addr)
1201495
def _parse_title(line_iter, cur_line, conf):
    
    title = []
    conf['title'].append(title)
    title.append(('title_name', cur_line.split('title', 1)[1].strip()))
    while (True):
        line = next(line_iter)
        if line.startswith("title "):
            return line

        cmd, opt = _parse_cmd(line)
        title.append((cmd, opt))
96397
def dump(self):
        
        import tempfile

        with tempfile.NamedTemporaryFile(delete=False, mode="w") as fobj:
            json.dump(self.info, fobj)
            return fobj.name
1238612
def dump(obj, fp):
    '''
    '''
    encoder = ArffEncoder()
    generator = encoder.iter_encode(obj)

    last_row = next(generator)
    for row in generator:
        fp.write(last_row + u'\n')
        last_row = row
    fp.write(last_row)

    return fp
25920
def shot_save(self, ):
        
        if not self.cur_shot:
            return

        desc = self.shot_desc_pte.toPlainText()
        start = self.shot_start_sb.value()
        end = self.shot_end_sb.value()
        handle = self.shot_handle_sb.value()
        self.cur_shot.description = desc
        self.cur_shot.startframe = start
        self.cur_shot.endframe = end
        self.cur_shot.handlesize = handle
        self.cur_shot.save()
290138
def frame_to_sample(self, frame_index):
        
        start = frame_index * self.hop_size
        end = start + self.frame_size
        return start, end