parameters: (self)
docstring: Opens the output stream(s).
docstring_summary: Opens the output stream(s).
docstring_tokens: Opens the output stream ( s ) .
function: def open_stream(self):
        """Opens the output stream(s)."""
  
        if getkey(self.what) in [ "positions", "velocities", "forces", "extras" ]:
           # must write out trajectories for each bead, so must create b streams
           self.out = []
           for b in range(self.simul.beads.nbeads):
              # zero-padded bead number
              padb = ( ("%0" + str(int(1 + np.floor(np.log(self.simul.beads.nbeads)/np.log(10)))) + "d") % (b) )
              try:
                 if (self.ibead < 0 or self.ibead == b):
                    if getkey(self.what) == "extras":
                       self.out.append(open(self.filename + "_" + padb, "a"))
                    else:
                       self.out.append(open(self.filename + "_" + padb + "." + self.format, "a"))
                 else:
                    self.out.append(None) # creates null outputs if a
                                          # single bead output is chosen
              except:
                 raise ValueError("Could not open file " + self.filename + "_" + padb + "." + self.format + " for output")
        else:
           try:
              self.out = ( open(self.filename + "." + self.format, "a") )
           except:
              raise ValueError("Could not open file " + self.filename + "." + self.format + " for output")
function_tokens: def open_stream ( self ) : if getkey ( self . what ) in [ "positions" , "velocities" , "forces" , "extras" ] : # must write out trajectories for each bead, so must create b streams self . out = [ ] for b in range ( self . simul . beads . nbeads ) : # zero-padded bead number padb = ( ( "%0" + str ( int ( 1 + np . floor ( np . log ( self . simul . beads . nbeads ) / np . log ( 10 ) ) ) ) + "d" ) % ( b ) ) try : if ( self . ibead < 0 or self . ibead == b ) : if getkey ( self . what ) == "extras" : self . out . append ( open ( self . filename + "_" + padb , "a" ) ) else : self . out . append ( open ( self . filename + "_" + padb + "." + self . format , "a" ) ) else : self . out . append ( None ) # creates null outputs if a # single bead output is chosen except : raise ValueError ( "Could not open file " + self . filename + "_" + padb + "." + self . format + " for output" ) else : try : self . out = ( open ( self . filename + "." + self . format , "a" ) ) except : raise ValueError ( "Could not open file " + self . filename + "." + self . format + " for output" )