Write all muons from McTracks to Muons.
972480
def filter_muons(blob):
    """"""
    tracks = blob['McTracks']
    muons = tracks[tracks.type == -13]    # PDG particle code
    blob["Muons"] = Table(muons)
    return blob
158033
def write(self, addr, data):
        '''
        '''
        logger.debug(
            "Dummy SiTransferLayer.write addr: %s data: %s" % (hex(addr), data))
        for curr_addr, d in enumerate(data, start=addr):
            self.mem[curr_addr] = array.array('B', [d])[0]
997293
private void writeMultipleExp(String arg0, Map result) throws FileNotFoundException, IOException {

        arg0 = revisePath(arg0);
        ArrayList<HashMap> expArr = getObjectOr(result, "experiments", new ArrayList());
        ArrayList<HashMap> soilArr = getObjectOr(result, "soils", new ArrayList());
        ArrayList<HashMap> wthArr = getObjectOr(result, "weathers", new ArrayList());

        // Setup output file
        Calendar cal = Calendar.getInstance();
        if (!expArr.isEmpty() && soilArr.isEmpty() && wthArr.isEmpty()) {
            outputFile = new File(arg0 + "AGMIP_DSSAT_EXPERIMENTS_" + cal.getTimeInMillis() + ".zip");
        } else if (expArr.isEmpty() && !soilArr.isEmpty() && wthArr.isEmpty()) {
            outputFile = new File(arg0 + "AGMIP_DSSAT_SOILS_" + cal.getTimeInMillis() + ".zip");
        } else if (expArr.isEmpty() && soilArr.isEmpty() && !wthArr.isEmpty()) {
            outputFile = new File(arg0 + "AGMIP_DSSAT_WEATHERS_" + cal.getTimeInMillis() + ".zip");
        } else {
            outputFile = new File(arg0 + "AGMIP_DSSAT_" + cal.getTimeInMillis() + ".zip");
        }

        // Write files
        String soil_id;
        String wth_id;
        expArr = combineExps(expArr);
        for (HashMap expData : expArr) {
            ArrayList<HashMap> rootArr = getObjectOr(expData, "dssat_root", new ArrayList());
            if (rootArr.isEmpty()) {
                soil_id = getObjectOr(expData, "soil_id", "");
                wth_id = getObjectOr(expData, "wst_id", "");
                expData.put("soil", getSectionDataWithNocopy(soilArr, "soil_id", soil_id));
                expData.put("weather", getSectionDataWithNocopy(wthArr, "wst_id", wth_id));
                recordSWData(expData, new DssatSoilOutput());
                recordSWData(expData, new DssatWeatherOutput());
            } else {
                ArrayList<HashMap> soilArrTmp = new ArrayList();
                ArrayList<HashMap> wthArrTmp = new ArrayList();
                for (HashMap rootData : rootArr) {
                    soil_id = getObjectOr(rootData, "soil_id", "");
                    wth_id = getObjectOr(rootData, "wst_id", "");
                    HashMap soilTmp = new HashMap();
                    HashMap wthTmp = new HashMap();
                    soilTmp.put("soil", getSectionDataWithNocopy(soilArr, "soil_id", soil_id));
                    soilTmp.put("soil_id", soil_id);
                    soilTmp.put("exname", rootData.get("exname"));
                    soilTmp.put("id", rootData.get("id"));
                    wthTmp.put("weather", getSectionDataWithNocopy(wthArr, "wst_id", wth_id));
                    wthTmp.put("wst_id", wth_id);
                    recordSWData(soilTmp, new DssatSoilOutput());
                    recordSWData(wthTmp, new DssatWeatherOutput());
                    soilArrTmp.add((HashMap) soilTmp.get("soil"));
                    wthArrTmp.add(wthTmp);
                    rootData.put("wst_id", getObjectOr(wthTmp, "wst_id", wth_id));
                    rootData.put("soil_id", getObjectOr(soilTmp, "soil_id", wth_id));
                }
                expData.put("soil", soilArrTmp);
                expData.put("weather", wthArrTmp);
            }
            String exname = getValueOr(expData, "exname", "N/A");
            //            DssatCommonOutput[] outputs = {
//                new DssatXFileOutput(),
//                new DssatAFileOutput(),
//                new DssatTFileOutput(),
//                new DssatCulFileOutput(),};
            writeSingleExp(arg0, expData, new DssatXFileOutput(), exname + "_X");
            writeSingleExp(arg0, expData, new DssatAFileOutput(), exname + "_A");
            writeSingleExp(arg0, expData, new DssatTFileOutput(), exname + "_T");
            writeSingleExp(arg0, expData, new DssatCulFileOutput(), exname + "_Cul");
        }

        // If experiment data is included
        if (!expArr.isEmpty()) {
            // Write all batch files
            futFiles.put("DSSBatch.v45", executor.submit(new DssatTranslateRunner(new DssatBatchFileOutput(DssatVersion.DSSAT45), expArr, arg0)));
            futFiles.put("DSSBatch.v46", executor.submit(new DssatTranslateRunner(new DssatBatchFileOutput(DssatVersion.DSSAT46), expArr, arg0)));
            futFiles.put("Run45.bat", executor.submit(new DssatTranslateRunner(new DssatRunFileOutput(DssatVersion.DSSAT45), expArr, arg0)));
            futFiles.put("Run46.bat", executor.submit(new DssatTranslateRunner(new DssatRunFileOutput(DssatVersion.DSSAT46), expArr, arg0)));
        } // If only weather or soil data is included
        else {
            for (HashMap sData : soilArr) {
                HashMap tmp = new HashMap();
                tmp.put("soil", sData);
                tmp.put("soil_id", getObjectOr(sData, "soil_id", ""));
                recordSWData(tmp, new DssatSoilOutput());
            }
            for (HashMap wData : wthArr) {
                HashMap tmp = new HashMap();
                tmp.put("weather", wData);
                tmp.put("wst_id", getObjectOr(wData, "wst_id", ""));
                recordSWData(tmp, new DssatWeatherOutput());
            }
        }

        // Write soil and weather files
        writeWthFiles(arg0);
        writeSoilFiles(arg0);

        // compress all output files into one zip file
        //createZip();
    }
80560
def copy_all_lines_from_to(inputFile, outputFile):
    """"""
    currentLine = inputFile.readline()
    while currentLine:
        outputFile.write(currentLine)
        currentLine = inputFile.readline()
376847
public void writeMediumShortArray( short[] values ) {
        int byteSize = values.length * 2 + 2;
        this.addUnsignedShort( values.length );
        doWriteShortArray( values, byteSize );
    }
567068
def sendall(self, data, **kws):
        """"""
        return SendAll(self, data, timeout=self._timeout, **kws)
720313
def write_multi(self, frames, encoded_frames=None):
    """"""
    if encoded_frames is None:
      # Infinite iterator.
      encoded_frames = iter(lambda: None, 1)
    for (frame, encoded_frame) in zip(frames, encoded_frames):
      self.write(frame, encoded_frame)
866340
def write(self, s, level=0, color=None):
        """"""
        if level > self.level:
            return
        if self.timestamps:
            timestamp = time.strftime(u'%H:%M:%S ')
        else:
            timestamp = u''
        with lock:
            if self.context:
                self.stream.write(u'%s%s> ' % (timestamp, self.context))
            elif self.context is None:
                self.stream.write(u'%s%s> ' % (timestamp, get_threadname()))
            self.stream.write(u'%s' % s, color=color)
            try:
                text_type = unicode
            except NameError:
                text_type = str
            self.stream.write(text_type(os.linesep))
            self.stream.flush()
915405
def autosave_all(self):
        """"""
        for index in range(self.stack.get_stack_count()):
            self.autosave(index)
1285418
def write_to_files_rec(instances, tokenizer, max_seq_length,
                       max_predictions_per_seq, output_files):
    """"""
    writers = []
    for output_file in output_files:
        writers.append(
            mx.recordio.MXIndexedRecordIO(
                os.path.splitext(output_file)[0] + '.idx', output_file, 'w'))

    writer_index = 0
    total_written = 0
    for (inst_index, instance) in enumerate(instances):
        features = transform(instance, tokenizer, max_seq_length, max_predictions_per_seq)
        example = features

        writers[writer_index].write_idx(inst_index, json.dumps(example).encode('UTF-8'))
        writer_index = (writer_index + 1) % len(writers)
        total_written += 1

    for writer in writers:
        writer.close()

    logging.info('Wrote %d total instances', total_written)
615110
def write(self, ulBuffer, pSrc, unBytes):
        """"""

        fn = self.function_table.write
        result = fn(ulBuffer, pSrc, unBytes)
        return result
1082287
private void writeToFile(MemoryCommitResult mcr) {
        // Rename the current file so it may be used as a backup during the next read
        if (mFile.exists()) {
            if (!mcr.changesMade) {
                // If the file already exists, but no changes were
                // made to the underlying map, it's wasteful to
                // re-write the file.  Return as if we wrote it
                // out.
                mcr.setDiskWriteResult(true);
                return;
            }
            if (!mBackupFile.exists()) {
                if (!mFile.renameTo(mBackupFile)) {
                    System.out.println( "Couldn't rename file " + mFile
                            + " to backup file " + mBackupFile);
                    mcr.setDiskWriteResult(false);
                    return;
                }
            } else {
                mFile.delete();
            }
        }

        // Attempt to write the file, delete the backup and return true as atomically as
        // possible.  If any exception occurs, delete the new file; next time we will restore
        // from the backup.
        try {
            FileOutputStream str = createFileOutputStream(mFile);
            if (str == null) {
                mcr.setDiskWriteResult(false);
                return;
            }
            XmlUtils.writeMapXml(mcr.mapToWriteToDisk, str);
            FileUtils.sync(str);
            str.close();
            setFilePermissionsFromMode(mFile.getPath(), mMode, 0);
            if (mFile.canRead()) {
                synchronized (this) {
                    mStatTimestamp = mFile.lastModified();
                    mStatSize = mFile.length();
                }
            }
            // Writing was successful, delete the backup file if there is one.
            mBackupFile.delete();
            mcr.setDiskWriteResult(true);
            return;
        } catch (IOException e) {
            System.out.println("writeToFile: Got exception:" + e);
        }
        // Clean up an unsuccessfully written file
        if (mFile.exists()) {
            if (!mFile.delete()) {
                System.out.println("Couldn't clean up partially-written file " + mFile);
            }
        }
        mcr.setDiskWriteResult(false);
    }
648466
protected void writeFull() {
        byte[] imageData = rawImage.getData();
        int numOfComponents = frameHeader.getNf();
        int[] pixes = new int[numOfComponents * DCTSIZE2];
        int blockIndex = 0;
        int startCoordinate = 0, scanlineStride = numOfComponents * rawImage.getWidth(), row = 0;

        x = 0;
        y = 0;

        for (int m = 0; m < MCUsPerColumn * MCUsPerRow; m++) {
            blockIndex = 0;

            // one MCU
            for (int v = 0; v < maxVSampleFactor; v++) {
                for (int h = 0; h < maxHSampleFactor; h++) {
                    row = y + 1;
                    startCoordinate = (y * rawImage.getWidth() + x) * numOfComponents;

                    // one block
                    for (int k = blockIndex * DCTSIZE2, i = 0; k < blockIndex * DCTSIZE2 + DCTSIZE2; k++) {
                        pixes[i++] = allMCUDatas[0][m][k];

                        if (numOfComponents > 1) {
                            pixes[i++] = allMCUDatas[1][m][k];
                            pixes[i++] = allMCUDatas[2][m][k];
                        }

                        if (numOfComponents > 3) {
                            pixes[i++] = allMCUDatas[3][m][k];
                        }

                        x++;

                        if (x % 8 == 0) {
                            y++;
                            x -= 8;
                        }
                    }

                    colorConvertor.convertBlock(pixes, 0, imageData, numOfComponents, startCoordinate, row,
                                                scanlineStride);

                    blockIndex++;

                    x += 8;
                    y -= 8;
                }

                x -= maxHSampleFactor * 8;
                y += 8;
            }

            x += maxHSampleFactor * 8;
            y -= maxVSampleFactor * 8;

            if (x >= rawImage.getWidth()) {
                x = 0;
                y += maxVSampleFactor * 8;
            }

        }
    }
915654
def write(self, data):
        """"""
        cnpj, data = data

        path = os.path.join(self.output, '%s.json' % cnpj)
        with open(path, 'w') as f:
            json.dump(data, f, encoding='utf-8')
1158258
public function write()
    {
        $data = array();
        $dumper = new ArrayDumper();

        foreach ($this->getCanonicalPackages() as $package) {
            $data[] = $dumper->dump($package);
        }

        $this->file->write($data);
    }
1123187
def write_long(self, n):
        """"""
        if n < 0 or n >= 4294967296:
            raise FrameSyntaxError(
                'Octet {0!r} out of range 0..2**31-1'.format(n))
        self._flushbits()
        self.out.write(pack('>I', n))
946417
public void moveAll(ParticleEmitter emitter, float x, float y) {
		ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter);
		for (int i=0;i<pool.particles.length;i++) {
			if (pool.particles[i].inUse()) {
				pool.particles[i].move(x, y);
			}
		}
	}