Set the box size for the molecular assembly
8884
def _set_box(self):
        
        net_volume = 0.0
        for idx, mol in enumerate(self.mols):
            length = max([np.max(mol.cart_coords[:, i])-np.min(mol.cart_coords[:, i])
                           for i in range(3)]) + 2.0
            net_volume += (length**3.0) * float(self.param_list[idx]['number'])
        length = net_volume**(1.0/3.0)
        for idx, mol in enumerate(self.mols):
            self.param_list[idx]['inside box'] = '0.0 0.0 0.0 {} {} {}'.format(
                length, length, length)
1144541
private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
        for (IAtomContainer mol : mols) {
            if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
                final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
                GeometryUtil.scaleMolecule(mol, factor);
            }
        }
    }
179022
def _SetPacketSizeForFollowingConnections(cursor):
  """"""
  cur_packet_size = int(_ReadVariable("max_allowed_packet", cursor))

  if cur_packet_size < MAX_PACKET_SIZE:
    logging.warning(
        "MySQL max_allowed_packet of %d is required, got %d. Overwriting.",
        MAX_PACKET_SIZE, cur_packet_size)
    _SetGlobalVariable("max_allowed_packet", MAX_PACKET_SIZE, cursor)
877352
def assemble(self,roboset=None,color=None,format=None,bgset=None,sizex=300,sizey=300):
        

        # Allow users to manually specify a robot 'set' that they like.
        # Ensure that this is one of the allowed choices, or allow all
        # If they don't set one, take the first entry from sets above.

        if roboset == 'any':
            roboset = self.sets[self.hasharray[1] % len(self.sets) ]
        elif roboset in self.sets:
            roboset = roboset
        else:
            roboset = self.sets[0]


        # Only set1 is setup to be color-seletable. The others don't have enough pieces in various colors.
        # This could/should probably be expanded at some point..
        # Right now, this feature is almost never used. ( It was < 44 requests this year, out of 78M reqs )

        if roboset == 'set1':
            if color in self.colors:
                roboset = 'set1/' + color
            else:
                randomcolor = self.colors[self.hasharray[0] % len(self.colors) ]
                roboset = 'set1/' + randomcolor

        # If they specified a background, ensure it's legal, then give it to them.
        if bgset in self.bgsets:
            bgset = bgset
        elif bgset == 'any':
            bgset = self.bgsets[ self.hasharray[2] % len(self.bgsets) ]

        # If we set a format based on extension earlier, use that. Otherwise, PNG.
        if format is None:
            format = self.format

        # Each directory in our set represents one piece of the Robot, such as the eyes, nose, mouth, etc.

        # Each directory is named with two numbers - The number before the # is the sort order.
        # This ensures that they always go in the same order when choosing pieces, regardless of OS.

        # The second number is the order in which to apply the pieces.
        # For instance, the head has to go down BEFORE the eyes, or the eyes would be hidden.

        # First, we'll get a list of parts of our robot.


        roboparts = self._get_list_of_files(self.resourcedir + 'sets/' + roboset)
        # Now that we've sorted them by the first number, we need to sort each sub-category by the second.
        roboparts.sort(key=lambda x: x.split("#")[1])
        if bgset is not None:
                bglist = []
                backgrounds = natsort.natsorted(os.listdir(self.resourcedir + 'backgrounds/' + bgset))
                backgrounds.sort()
                for ls in backgrounds:
                        if not ls.startswith("."):
                                bglist.append(self.resourcedir + 'backgrounds/' + bgset + "/" + ls)
                background = bglist[self.hasharray[3] % len(bglist)]

        # Paste in each piece of the Robot.
        roboimg = Image.open(roboparts[0])
        roboimg = roboimg.resize((1024,1024))
        for png in roboparts:
                img = Image.open(png)
                img = img.resize((1024,1024))
                roboimg.paste(img,(0,0),img)

        # If we're a BMP, flatten the image.
        if format == 'bmp':
                #Flatten bmps
                r, g, b, a = roboimg.split()
                roboimg = Image.merge("RGB", (r, g, b))

        if bgset is not None:
                bg = Image.open(background)
                bg = bg.resize((1024,1024))
                bg.paste(roboimg,(0,0),roboimg)
                roboimg = bg

        self.img = roboimg.resize((sizex,sizey),Image.ANTIALIAS)
        self.format = format
1009007
def resize_bytes(self, size):
        
        Buffer.resize_bytes(self, size)
        self._size = size // self.itemsize
934293
def set_buf_size(fd):
    """"""
    if OS_PIPE_SZ and hasattr(fcntl, 'F_SETPIPE_SZ'):
        fcntl.fcntl(fd, fcntl.F_SETPIPE_SZ, OS_PIPE_SZ)
103455
def bin_atoms(self):
        ''''''

        # Create the atom bins
        low_point = numpy.array([self.min_x, self.min_y, self.min_z])
        high_point = numpy.array([self.max_x, self.max_y, self.max_z])
        atom_bin_dimensions = numpy.ceil((high_point - low_point) / self.bin_size)
        self.atom_bin_dimensions = (int(atom_bin_dimensions[0]) - 1, int(atom_bin_dimensions[1]) - 1, int(atom_bin_dimensions[2]) - 1)
        atom_bins = []
        for x in range(int(atom_bin_dimensions[0])):
            atom_bins.append([])
            for y in range(int(atom_bin_dimensions[1])):
                atom_bins[x].append([])
                for z in range(int(atom_bin_dimensions[2])):
                    atom_bins[x][y].append(Bin(x, y, z))

        # Assign each Atom to a bin
        for serial_number, atom in self.atoms.iteritems():
            bin_location = numpy.trunc((atom.point - low_point) / self.bin_size)
            bin = atom_bins[int(bin_location[0])][int(bin_location[1])][int(bin_location[2])]
            bin.append(atom)
            atom.set_bin(bin)

        # Sanity_check
        if self.safe_mode:
            num_atoms = 0
            for x in range(int(atom_bin_dimensions[0])):
                for y in range(int(atom_bin_dimensions[1])):
                    for z in range(int(atom_bin_dimensions[2])):
                        num_atoms += len(atom_bins[x][y][z])
            assert(num_atoms == len(self.atoms))

        # Snip empty sections (saves a little space after garbage collection - space savings increase with the number of empty arrays in the matrix)
        blank_section = ()
        for x in range(int(atom_bin_dimensions[0])):
            for y in range(int(atom_bin_dimensions[1])):
                for z in range(int(atom_bin_dimensions[2])):
                    if not atom_bins[x][y][z]:
                        atom_bins[x][y][z] = blank_section

        self.atom_bins = atom_bins
173885
void setMol(IAtomContainer mol) {
        this.mol = mol;
        Arrays.fill(amap, -1);
        numMapped = 0;
        this.avisit = new boolean[mol.getAtomCount()];
        sptr = 0;
        store(0, null);
    }
1366661
def set_size(self, w, h):
        
        self.attributes['width'] = str(w)
        self.attributes['height'] = str(h)
886626
@Override
    public void setExpectedMaxSize( int numRows , int numCols ) {
        super.setExpectedMaxSize(numRows,numCols);

        // if the matrix that is being decomposed is smaller than the block we really don't
        // see the B matrix.
        if( numRows < blockWidth)
            B = new DMatrixRMaj(0,0);
        else
            B = new DMatrixRMaj(blockWidth,maxWidth);

        chol = new CholeskyBlockHelper_DDRM(blockWidth);
    }
474327
@Override
	public void trimToSize(){

		if ( atoms instanceof ArrayList<?>) {
			ArrayList<Atom> myatoms = (ArrayList<Atom>) atoms;
			myatoms.trimToSize();
		}
		if ( altLocs instanceof ArrayList<?>){
			ArrayList<Group> myAltLocs = (ArrayList<Group>) altLocs;
			myAltLocs.trimToSize();
		}

		if ( hasAltLoc()) {
			for (Group alt : getAltLocs()){
				alt.trimToSize();
			}
		}

		// now let's fit the hashmaps to size
		properties = new HashMap<String, Object>(properties);

		if ( atomNameLookup != null)
			atomNameLookup = new HashMap<String,Atom>(atomNameLookup);

	}
997885
function setBox(){
    if(my.container){
      my.box = {
        x: 0,
        y: 0,
        width: my.container.clientWidth,
        height: my.container.clientHeight
      };
    }
  }
1283844
protected void setLayout() {

		int sizeEnsemble = this.ensembleSizeOption.getValue();

		distributorP = new BoostingDistributorProcessor();
		distributorP.setSizeEnsemble(sizeEnsemble);
		this.builder.addProcessor(distributorP, 1);
	
		//instantiate classifier
		classifier = this.baseLearnerOption.getValue();
		classifier.init(builder, this.dataset, sizeEnsemble);
		
		BoostingPredictionCombinerProcessor predictionCombinerP= new BoostingPredictionCombinerProcessor();
		predictionCombinerP.setSizeEnsemble(sizeEnsemble);
		this.builder.addProcessor(predictionCombinerP, 1);
		
		//Streams
		resultStream = this.builder.createStream(predictionCombinerP);
		predictionCombinerP.setOutputStream(resultStream);

		for (Stream subResultStream:classifier.getResultStreams()) {
			this.builder.connectInputKeyStream(subResultStream, predictionCombinerP);
		}
		
		/* The testing stream. */
		Stream testingStream = this.builder.createStream(distributorP);
		this.builder.connectInputKeyStream(testingStream, classifier.getInputProcessor());
	
		/* The prediction stream. */
		Stream predictionStream = this.builder.createStream(distributorP);
		this.builder.connectInputKeyStream(predictionStream, classifier.getInputProcessor());
		
		distributorP.setOutputStream(testingStream);
		distributorP.setPredictionStream(predictionStream);
                
    // Addition to Bagging: stream to train
    /* The training stream. */
		Stream trainingStream = this.builder.createStream(predictionCombinerP);
		predictionCombinerP.setTrainingStream(trainingStream);
		this.builder.connectInputKeyStream(trainingStream, classifier.getInputProcessor());
                
	}
758025
private void resizeBuf(int size)
    {
        int capacity;
        if (size >= _capacity * 2)
        {
            capacity = size;
        }
        else
        {
            capacity = 1;
            while (capacity < size)
            {
                capacity <<= 1;
            }
        }
        byte[] buf = new byte[capacity];
        if (_size > 0)
        {
            System.arraycopy(_buf, 0, buf, 0, _size);
        }
        _buf = buf;
        _capacity = capacity;
    }
587865
def generate_bio_assembly(data_api, struct_inflator):
    """"""
    bioassembly_count = 0
    for bioassembly in data_api.bio_assembly:
        bioassembly_count += 1
        for transform in bioassembly["transformList"]:
            struct_inflator.set_bio_assembly_trans(bioassembly_count,
                                                   transform["chainIndexList"],
                                                   transform["matrix"])
126544
def setup(self, workers=1, qsize=0):
        """"""
        if workers <= 0:
            raise ValueError("workers have to be greater then zero")
        if qsize < 0:
            raise ValueError("qsize have to be greater or equal zero")
        self.qsize = qsize # output que size
        self.workers = workers
        return self
536436
public void setSize(UnsignedInteger64 size) {
		this.size = size;

		// Set the flag
		if (size != null) {
			flags |= SSH_FILEXFER_ATTR_SIZE;
		} else {
			flags ^= SSH_FILEXFER_ATTR_SIZE;
		}
	}