Experimental clone attempt of http://sourceforge.net/projects/afterglow
        each datum is reduced as src -> event -> dst and the data are graphed.
        by default we have IP.src -> IP.dport -> IP.dst
337577
def afterglow(self, src=None, event=None, dst=None, **kargs):
        """"""
        if src is None:
            src = lambda x: x['IP'].src
        if event is None:
            event = lambda x: x['IP'].dport
        if dst is None:
            dst = lambda x: x['IP'].dst
        sl = {}
        el = {}
        dl = {}
        for i in self.res:
            try:
                s, e, d = src(i), event(i), dst(i)
                if s in sl:
                    n, lst = sl[s]
                    n += 1
                    if e not in lst:
                        lst.append(e)
                    sl[s] = (n, lst)
                else:
                    sl[s] = (1, [e])
                if e in el:
                    n, lst = el[e]
                    n += 1
                    if d not in lst:
                        lst.append(d)
                    el[e] = (n, lst)
                else:
                    el[e] = (1, [d])
                dl[d] = dl.get(d, 0) + 1
            except Exception:
                continue

        import math

        def normalize(n):
            return 2 + math.log(n) / 4.0

        def minmax(x):
            m, M = reduce(lambda a, b: (min(a[0], b[0]), max(a[1], b[1])),
                          ((a, a) for a in x))
            if m == M:
                m = 0
            if M == 0:
                M = 1
            return m, M

        mins, maxs = minmax(x for x, _ in six.itervalues(sl))
        mine, maxe = minmax(x for x, _ in six.itervalues(el))
        mind, maxd = minmax(six.itervalues(dl))

        gr = 'digraph "afterglow" {\n\tedge [len=2.5];\n'

        gr += "# src nodes\n"
        for s in sl:
            n, _ = sl[s]
            n = 1 + float(n - mins) / (maxs - mins)
            gr += '"src.%s" [label = "%s", shape=box, fillcolor="#FF0000", style=filled, fixedsize=1, height=%.2f,width=%.2f];\n' % (repr(s), repr(s), n, n)  # noqa: E501
        gr += "# event nodes\n"
        for e in el:
            n, _ = el[e]
            n = n = 1 + float(n - mine) / (maxe - mine)
            gr += '"evt.%s" [label = "%s", shape=circle, fillcolor="#00FFFF", style=filled, fixedsize=1, height=%.2f, width=%.2f];\n' % (repr(e), repr(e), n, n)  # noqa: E501
        for d in dl:
            n = dl[d]
            n = n = 1 + float(n - mind) / (maxd - mind)
            gr += '"dst.%s" [label = "%s", shape=triangle, fillcolor="#0000ff", style=filled, fixedsize=1, height=%.2f, width=%.2f];\n' % (repr(d), repr(d), n, n)  # noqa: E501

        gr += "###\n"
        for s in sl:
            n, lst = sl[s]
            for e in lst:
                gr += ' "src.%s" -> "evt.%s";\n' % (repr(s), repr(e))
        for e in el:
            n, lst = el[e]
            for d in lst:
                gr += ' "evt.%s" -> "dst.%s";\n' % (repr(e), repr(d))

        gr += "}"
        return do_graph(gr, **kargs)
939713
def dst_addr(self):
        
        try:
            return socket.inet_ntop(self._af, self.raw[self._dst_addr].tobytes())
        except (ValueError, socket.error):
            pass
38193
def from_datetime(self, dt):
        
        global _last_timestamp

        epoch = datetime(1970, 1, 1, tzinfo=dt.tzinfo)
        offset = epoch.tzinfo.utcoffset(epoch).total_seconds() if epoch.tzinfo else 0
        timestamp = (dt  - epoch).total_seconds() - offset

        node = None
        clock_seq = None

        nanoseconds = int(timestamp * 1e9)
        timestamp = int(nanoseconds // 100) + 0x01b21dd213814000

        if clock_seq is None:
            import random
            clock_seq = random.randrange(1 << 14)  # instead of stable storage
        time_low = timestamp & 0xffffffff
        time_mid = (timestamp >> 32) & 0xffff
        time_hi_version = (timestamp >> 48) & 0x0fff
        clock_seq_low = clock_seq & 0xff
        clock_seq_hi_variant = (clock_seq >> 8) & 0x3f
        if node is None:
            node = getnode()
        return pyUUID(fields=(time_low, time_mid, time_hi_version,
                            clock_seq_hi_variant, clock_seq_low, node), version=1)
349425
function (oldData) {
    var data = this.data;
    var diffData = diff(data, oldData);
    var light = this.light;
    var rendererSystem = this.rendererSystem;
    var self = this;

    // Existing light.
    if (light && !('type' in diffData)) {
      var shadowsLoaded = false;
      // Light type has not changed. Update light.
      Object.keys(diffData).forEach(function (key) {
        var value = data[key];

        switch (key) {
          case 'color': {
            light.color.set(value);
            rendererSystem.applyColorCorrection(light.color);
            break;
          }

          case 'groundColor': {
            light.groundColor.set(value);
            rendererSystem.applyColorCorrection(light.groundColor);
            break;
          }

          case 'angle': {
            light.angle = degToRad(value);
            break;
          }

          case 'target': {
            // Reset target if selector is null.
            if (value === null) {
              if (data.type === 'spot' || data.type === 'directional') {
                light.target = self.defaultTarget;
              }
            } else {
              // Target specified, set target to entity's `object3D` when it is loaded.
              if (value.hasLoaded) {
                self.onSetTarget(value, light);
              } else {
                value.addEventListener('loaded', bind(self.onSetTarget, self, value, light));
              }
            }
            break;
          }

          case 'castShadow':
          case 'shadowBias':
          case 'shadowCameraFar':
          case 'shadowCameraFov':
          case 'shadowCameraNear':
          case 'shadowCameraTop':
          case 'shadowCameraRight':
          case 'shadowCameraBottom':
          case 'shadowCameraLeft':
          case 'shadowCameraVisible':
          case 'shadowMapHeight':
          case 'shadowMapWidth':
          case 'shadowRadius':
            if (!shadowsLoaded) {
              self.updateShadow();
              shadowsLoaded = true;
            }
            break;

          default: {
            light[key] = value;
          }
        }
      });
      return;
    }

    // No light yet or light type has changed. Create and add light.
    this.setLight(this.data);
    this.updateShadow();
  }
736619
def plotdmt(data, circleinds=[], crossinds=[], edgeinds=[], url_path=None, fileroot=None,
            tools="hover,tap,pan,box_select,wheel_zoom,reset", plot_width=950, plot_height=500):
    

    fields = ['dm', 'time', 'sizes', 'colors', 'snrs', 'key']

    if not circleinds: circleinds = range(len(data['snrs']))

    # set ranges
    datalen = len(data['dm'])
    inds = circleinds + crossinds + edgeinds
    dm = [data['dm'][i] for i in inds]
    dm_min = min(min(dm), max(dm)/1.2)
    dm_max = max(max(dm), min(dm)*1.2)
    time = [data['time'][i] for i in inds]
    time_min = min(time)
    time_max = max(time)

    source = ColumnDataSource(data = dict({(key, tuple([value[i] for i in circleinds if i not in edgeinds])) 
                                           for (key, value) in data.iteritems() if key in fields}))
    dmt = Figure(plot_width=plot_width, plot_height=plot_height, toolbar_location="left", x_axis_label='Time (s; relative)',
                 y_axis_label='DM (pc/cm3)', x_range=(time_min, time_max), y_range=(dm_min, dm_max), 
                 output_backend='webgl', tools=tools)
    dmt.circle('time', 'dm', size='sizes', fill_color='colors', line_color=None, fill_alpha=0.2, source=source)

    if crossinds:
        sourceneg = ColumnDataSource(data = dict({(key, tuple([value[i] for i in crossinds]))
                                                  for (key, value) in data.iteritems() if key in fields}))
        dmt.cross('time', 'dm', size='sizes', fill_color='colors', line_alpha=0.3, source=sourceneg)

    if edgeinds:
        sourceedge = ColumnDataSource(data = dict({(key, tuple([value[i] for i in edgeinds]))
                                                   for (key, value) in data.iteritems() if key in fields}))
        dmt.circle('time', 'dm', size='sizes', line_color='colors', fill_color='colors', line_alpha=0.5, fill_alpha=0.2, source=sourceedge)
    hover = dmt.select(dict(type=HoverTool))
    hover.tooltips = OrderedDict([('SNR', '@snrs'), ('key', '@key')])

    if url_path and fileroot:
#        url = '{}/cands_{}_sc@scan-seg@seg-i@candint-dm@dmind-dt@dtind.png'.format(url_path, fileroot)
        url = '{}/cands_{}_@key.png'.format(url_path, fileroot)
        taptool = dmt.select(type=TapTool)
        taptool.callback = OpenURL(url=url)

    return dmt
1069831
public static void bufferedToPlanar_U8(DataBufferInt buffer, WritableRaster src, Planar<GrayU8> dst) {
		int[] srcData = buffer.getData();

		int srcStride = stride(src);
		int srcOffset = getOffset(src);

		int numBands = src.getNumBands();
		byte[] data1 = dst.getBand(0).data;
		byte[] data2 = dst.getBand(1).data;
		byte[] data3 = dst.getBand(2).data;

		if( numBands == 3 ) {
			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
			for (int y = 0; y < dst.height; y++) {
				int indexSrc = srcOffset + y*srcStride;
				int indexDst = dst.startIndex + y * dst.stride;
				for (int x = 0; x < dst.width; x++, indexDst++) {

					int rgb = srcData[indexSrc++];

					data1[indexDst] = (byte) (rgb >>> 16);
					data2[indexDst] = (byte) (rgb >>> 8);
					data3[indexDst] = (byte) rgb;
				}
			}
			//CONCURRENT_ABOVE });
		} else if( numBands == 4 ) {
			byte[] data4 = dst.getBand(3).data;

			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
			for (int y = 0; y < dst.height; y++) {
				int indexSrc = srcOffset + y*srcStride;
				int indexDst = dst.startIndex + y * dst.stride;
				for (int x = 0; x < dst.width; x++, indexDst++) {

					int rgb = srcData[indexSrc++];

					data1[indexDst] = (byte) (rgb >>> 24);
					data2[indexDst] = (byte) (rgb >>> 16);
					data3[indexDst] = (byte) (rgb >>> 8);
					data4[indexDst] = (byte) rgb;
				}
			}
			//CONCURRENT_ABOVE });
		}
	}
488707
public static void bufferedToGray(DataBufferByte buffer, WritableRaster src, GrayU8 dst) {
		byte[] srcData = buffer.getData();


		int numBands = src.getNumBands();

		int size = dst.getWidth() * dst.getHeight();

		int srcStride = stride(src);
		int srcOffset = getOffset(src);
		int srcStrideDiff = srcStride-src.getNumDataElements()*dst.width;

		if(BoofConcurrency.USE_CONCURRENT ) {
			if (numBands == 3) {
				ImplConvertRaster_MT.from_3BU8_to_U8(srcData, srcStride, srcOffset, dst);
			} else if (numBands == 1) {
				ImplConvertRaster_MT.from_1BU8_to_U8(srcData, size, srcStride, srcOffset, srcStrideDiff, dst);
			} else if (numBands == 4) {
				ImplConvertRaster_MT.from_4BU8_to_U8(srcData, srcStride, srcOffset, dst);
			} else {
				throw new RuntimeException("Unexpected number of bands found. Bands = " + numBands);
			}
		} else {
			if (numBands == 3) {
				ImplConvertRaster.from_3BU8_to_U8(srcData, srcStride, srcOffset, dst);
			} else if (numBands == 1) {
				ImplConvertRaster.from_1BU8_to_U8(srcData, size, srcStride, srcOffset, srcStrideDiff, dst);
			} else if (numBands == 4) {
				ImplConvertRaster.from_4BU8_to_U8(srcData, srcStride, srcOffset, dst);
			} else {
				throw new RuntimeException("Unexpected number of bands found. Bands = " + numBands);
			}
		}
	}
490940
@Override
    public boolean observesDaylightTime() {
        long current = System.currentTimeMillis();

        if (finalZone != null) {
            if (finalZone.useDaylightTime()) {
                return true;
            } else if (current >= finalStartMillis) {
                return false;
            }
        }

        // Return TRUE if DST is observed at any future time
        long currentSec = Grego.floorDivide(current, Grego.MILLIS_PER_SECOND);
        int trsIdx = transitionCount - 1;
        if (dstOffsetAt(trsIdx) != 0) {
            return true;
        }
        while (trsIdx >= 0) {
            if (transitionTimes64[trsIdx] <= currentSec) {
                break;
            }
            if (dstOffsetAt(trsIdx - 1) != 0) {
                return true;
            }
            trsIdx--;
        }
        return false;
    }
897108
function pathDataToString(path) {
    var str = [];
    var data = path.data;
    var dataLength = path.len();
    for (var i = 0; i < dataLength;) {
        var cmd = data[i++];
        var cmdStr = '';
        var nData = 0;
        switch (cmd) {
            case CMD.M:
                cmdStr = 'M';
                nData = 2;
                break;
            case CMD.L:
                cmdStr = 'L';
                nData = 2;
                break;
            case CMD.Q:
                cmdStr = 'Q';
                nData = 4;
                break;
            case CMD.C:
                cmdStr = 'C';
                nData = 6;
                break;
            case CMD.A:
                var cx = data[i++];
                var cy = data[i++];
                var rx = data[i++];
                var ry = data[i++];
                var theta = data[i++];
                var dTheta = data[i++];
                var psi = data[i++];
                var clockwise = data[i++];

                var dThetaPositive = Math.abs(dTheta);
                var isCircle = isAroundZero(dThetaPositive - PI2)
                    && !isAroundZero(dThetaPositive);

                var large = false;
                if (dThetaPositive >= PI2) {
                    large = true;
                }
                else if (isAroundZero(dThetaPositive)) {
                    large = false;
                }
                else {
                    large = (dTheta > -PI && dTheta < 0 || dTheta > PI)
                        === !!clockwise;
                }

                var x0 = round4(cx + rx * mathCos(theta));
                var y0 = round4(cy + ry * mathSin(theta));

                // It will not draw if start point and end point are exactly the same
                // We need to shift the end point with a small value
                // FIXME A better way to draw circle ?
                if (isCircle) {
                    if (clockwise) {
                        dTheta = PI2 - 1e-4;
                    }
                    else {
                        dTheta = -PI2 + 1e-4;
                    }

                    large = true;

                    if (i === 9) {
                        // Move to (x0, y0) only when CMD.A comes at the
                        // first position of a shape.
                        // For instance, when drawing a ring, CMD.A comes
                        // after CMD.M, so it's unnecessary to move to
                        // (x0, y0).
                        str.push('M', x0, y0);
                    }
                }

                var x = round4(cx + rx * mathCos(theta + dTheta));
                var y = round4(cy + ry * mathSin(theta + dTheta));

                // FIXME Ellipse
                str.push('A', round4(rx), round4(ry),
                    mathRound(psi * degree), +large, +clockwise, x, y);
                break;
            case CMD.Z:
                cmdStr = 'Z';
                break;
            case CMD.R:
                var x = round4(data[i++]);
                var y = round4(data[i++]);
                var w = round4(data[i++]);
                var h = round4(data[i++]);
                str.push(
                    'M', x, y,
                    'L', x + w, y,
                    'L', x + w, y + h,
                    'L', x, y + h,
                    'L', x, y
                );
                break;
        }
        cmdStr && str.push(cmdStr);
        for (var j = 0; j < nData; j++) {
            // PENDING With scale
            str.push(round4(data[i++]));
        }
    }
    return str.join(' ');
}
1206008
public static void bufferedToInterleaved(DataBufferInt buffer, WritableRaster src, InterleavedU8 dst) {
		int[] srcData = buffer.getData();

		int srcStride = stride(src);
		int srcOffset = getOffset(src);

		int numBands = src.getNumBands();
		if( numBands == 3 ) {
			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
			for (int y = 0; y < dst.height; y++) {
				int indexSrc = srcOffset + y*srcStride;
				int indexDst = dst.startIndex + y * dst.stride;
				for (int x = 0; x < dst.width; x++) {

					int rgb = srcData[indexSrc++];

					dst.data[indexDst++] = (byte) (rgb >>> 16);
					dst.data[indexDst++] = (byte) (rgb >>> 8);
					dst.data[indexDst++] = (byte) rgb;
				}
			}
			//CONCURRENT_ABOVE });
		} else if( numBands == 4 ) {

			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
			for (int y = 0; y < dst.height; y++) {
				int indexSrc = srcOffset + y*srcStride;
				int indexDst = dst.startIndex + y * dst.stride;
				for (int x = 0; x < dst.width; x++) {

					int rgb = srcData[indexSrc++];

					dst.data[indexDst++] = (byte) (rgb >>> 24);
					dst.data[indexDst++] = (byte) (rgb >>> 16);
					dst.data[indexDst++] = (byte) (rgb >>> 8);
					dst.data[indexDst++] = (byte) rgb;
				}
			}
			//CONCURRENT_ABOVE });
		}
	}
1326083
function setBrightnessOfLed(callback) {
    var ledIndex = 8;
    
    var setBrightnessOfLedInterval = setInterval(function() {
        if (ledIndex >= 0) {
            dot3k.barGraph.setBrightnessOfLed(ledIndex, 0);
            
            ledIndex--;
        } else {
            clearInterval(setBrightnessOfLedInterval);
            
            if (callback) {
                callback();
            }
        }
    }, 500);
}
1177431
def _get_pltdotstrs(self, hdrgos_usr, **kws):
        """"""
        import datetime
        import timeit
        dotstrs_all = []
        tic = timeit.default_timer()
        # Loop through GO groups. Each group of GOs is formed under a single "header GO"
        hdrgo2usrgos, go2obj = self._get_plt_data(hdrgos_usr)
        # get dot strings with _get_dotstrs_curs
        for hdrgo, usrgos in hdrgo2usrgos.items():
            dotstrs_cur = self._get_dotgraphs(
                hdrgo, usrgos,
                pltargs=PltGroupedGosArgs(self.grprobj, **kws),
                go2parentids=get_go2parents_go2obj(go2obj))
            dotstrs_all.extend(dotstrs_cur)
        sys.stdout.write("\nElapsed HMS: {HMS} to write ".format(
            HMS=str(datetime.timedelta(seconds=(timeit.default_timer()-tic)))))
        sys.stdout.write("{P:5,} GO DAG plots for {H:>5,} GO grouping headers\n".format(
            H=len(hdrgo2usrgos), P=len(dotstrs_all)))
        return sorted(set(dotstrs_all))
760297
public final void fadd(X87Register dst, X87Register src)
  {
    assert dst.index() == 0 || src.index() == 0;
    emitX86(INST_FADD, dst, src);
  }
568500
def gts7(Input, flags, output):
    '''

 '''
    zn1 = [120.0, 110.0, 100.0, 90.0, 72.5]
    mn1 = 5
    dgtr=1.74533E-2;
    dr=1.72142E-2;
    alpha = [-0.38, 0.0, 0.0, 0.0, 0.17, 0.0, -0.38, 0.0, 0.0]
    altl = [200.0, 300.0, 160.0, 250.0, 240.0, 450.0, 320.0, 450.0]
    za = pdl[1][15];
    zn1[0] = za;

    for j in range(9):
        output.d[j]=0;

    #/* TINF VARIATIONS NOT IMPORTANT BELOW ZA OR ZN1(1) */
    if (Input.alt>zn1[0]):
        tinf = ptm[0]*pt[0] * \
                    (1.0+flags.sw[16]*globe7(pt,Input,flags));
    else:
        tinf = ptm[0]*pt[0];
    output.t[0]=tinf;

    #/*  GRADIENT VARIATIONS NOT IMPORTANT BELOW ZN1(5) */
    if (Input.alt>zn1[4]):
        g0 = ptm[3]*ps[0] * \
            (1.0+flags.sw[19]*globe7(ps,Input,flags));
    else:
        g0 = ptm[3]*ps[0];
    tlb = ptm[1] * (1.0 + flags.sw[17]*globe7(pd[3],Input,flags))*pd[3][0];
    s = g0 / (tinf - tlb);

#/*      Lower thermosphere temp variations not significant for
# *       density above 300 km */
    if (Input.alt<300.0):
        meso_tn1[1]=ptm[6]*ptl[0][0]/(1.0-flags.sw[18]*glob7s(ptl[0], Input, flags));
        meso_tn1[2]=ptm[2]*ptl[1][0]/(1.0-flags.sw[18]*glob7s(ptl[1], Input, flags));
        meso_tn1[3]=ptm[7]*ptl[2][0]/(1.0-flags.sw[18]*glob7s(ptl[2], Input, flags));
        meso_tn1[4]=ptm[4]*ptl[3][0]/(1.0-flags.sw[18]*flags.sw[20]*glob7s(ptl[3], Input, flags));
        meso_tgn1[1]=ptm[8]*pma[8][0]*(1.0+flags.sw[18]*flags.sw[20]*glob7s(pma[8], Input, flags))*meso_tn1[4]*meso_tn1[4]/(pow((ptm[4]*ptl[3][0]),2.0));
    else:
        meso_tn1[1]=ptm[6]*ptl[0][0];
        meso_tn1[2]=ptm[2]*ptl[1][0];
        meso_tn1[3]=ptm[7]*ptl[2][0];
        meso_tn1[4]=ptm[4]*ptl[3][0];
        meso_tgn1[1]=ptm[8]*pma[8][0]*meso_tn1[4]*meso_tn1[4]/(pow((ptm[4]*ptl[3][0]),2.0));
	

    z0 = zn1[3];
    t0 = meso_tn1[3];
    tr12 = 1.0;

    #/* N2 variation factor at Zlb */
    g28=flags.sw[21]*globe7(pd[2], Input, flags);

    #/* VARIATION OF TURBOPAUSE HEIGHT */
    zhf=pdl[1][24]*(1.0+flags.sw[5]*pdl[0][24]*sin(dgtr*Input.g_lat)*cos(dr*(Input.doy-pt[13])));
    output.t[0]=tinf;
    xmm = pdm[2][4];
    z = Input.alt;


    #/**** N2 DENSITY ****/

    #/* Diffusive density at Zlb */
    db28 = pdm[2][0]*exp(g28)*pd[2][0];
    #/* Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[2]=densu(z,db28,tinf,tlb,28.0,alpha[2],RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[2];
    #/* Turbopause */
    zh28=pdm[2][2]*zhf;
    zhm28=pdm[2][3]*pdl[1][5]; 
    xmd=28.0-xmm;
    #/* Mixed density at Zlb */
    tz = [0]
    b28=densu(zh28,db28,tinf,tlb,xmd,(alpha[2]-1.0),tz,ptm[5],s,mn1, zn1,meso_tn1,meso_tgn1);
    if ((flags.sw[15]) and (z<=altl[2])):
        #/*  Mixed density at Alt */
        global dm28
        dm28=densu(z,b28,tinf,tlb,xmm,alpha[2],tz,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        #/*  Net density at Alt */
        output.d[2]=dnet(output.d[2],dm28,zhm28,xmm,28.0);
    


    #/**** HE DENSITY ****/

    #/*   Density variation factor at Zlb */
    g4 = flags.sw[21]*globe7(pd[0], Input, flags);
    #/*  Diffusive density at Zlb */
    db04 = pdm[0][0]*exp(g4)*pd[0][0];
    #/*  Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[0]=densu(z,db04,tinf,tlb, 4.,alpha[0],RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[0];
    if ((flags.sw[15]) and (z<altl[0])):
        #/*  Turbopause */
        zh04=pdm[0][2];
        #/*  Mixed density at Zlb */
        RandomVariable = [output.t[1]]
        b04=densu(zh04,db04,tinf,tlb,4.-xmm,alpha[0]-1.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        #/*  Mixed density at Alt */
        RandomVariable = [output.t[1]]
        global dm04
        dm04=densu(z,b04,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        zhm04=zhm28;
        #/*  Net density at Alt */
        output.d[0]=dnet(output.d[0],dm04,zhm04,xmm,4.);
        #/*  Correction to specified mixing ratio at ground */
        rl=log(b28*pdm[0][1]/b04);
        zc04=pdm[0][4]*pdl[1][0];
        hc04=pdm[0][5]*pdl[1][1];
        #/*  Net density corrected at Alt */
        output.d[0]=output.d[0]*ccor(z,rl,hc04,zc04);
    


    #/**** O DENSITY ****/

    #/*  Density variation factor at Zlb */
    g16= flags.sw[21]*globe7(pd[1],Input,flags);
    #/*  Diffusive density at Zlb */
    db16 =  pdm[1][0]*exp(g16)*pd[1][0];
    #/*   Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[1]=densu(z,db16,tinf,tlb, 16.,alpha[1],RandomVariable,ptm[5],s,mn1, zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[1];
    if ((flags.sw[15]) and (z<=altl[1])):
        #/*   Turbopause */
        zh16=pdm[1][2];
        #/*  Mixed density at Zlb */
        RandomVariable = [output.t[1]]
        b16=densu(zh16,db16,tinf,tlb,16.0-xmm,(alpha[1]-1.0), RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        #/*  Mixed density at Alt */
        RandomVariable = [output.t[1]]
        global dm16
        dm16=densu(z,b16,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        zhm16=zhm28;
        #/*  Net density at Alt */
        output.d[1]=dnet(output.d[1],dm16,zhm16,xmm,16.);
        rl=pdm[1][1]*pdl[1][16]*(1.0+flags.sw[1]*pdl[0][23]*(Input.f107A-150.0));
        hc16=pdm[1][5]*pdl[1][3];
        zc16=pdm[1][4]*pdl[1][2];
        hc216=pdm[1][5]*pdl[1][4];
        output.d[1]=output.d[1]*ccor2(z,rl,hc16,zc16,hc216);
        #/*   Chemistry correction */
        hcc16=pdm[1][7]*pdl[1][13];
        zcc16=pdm[1][6]*pdl[1][12];
        rc16=pdm[1][3]*pdl[1][14];
        #/*  Net density corrected at Alt */
        output.d[1]=output.d[1]*ccor(z,rc16,hcc16,zcc16);
    


    #/**** O2 DENSITY ****/

    #/*   Density variation factor at Zlb */
    g32= flags.sw[21]*globe7(pd[4], Input, flags);
    #/*  Diffusive density at Zlb */
    db32 = pdm[3][0]*exp(g32)*pd[4][0];
    #/*   Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[3]=densu(z,db32,tinf,tlb, 32.,alpha[3],RandomVariable,ptm[5],s,mn1, zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[3];
    if (flags.sw[15]):
        if (z<=altl[3]):
            #/*   Turbopause */
            zh32=pdm[3][2];
            #/*  Mixed density at Zlb */
            RandomVariable = [output.t[1]]
            b32=densu(zh32,db32,tinf,tlb,32.-xmm,alpha[3]-1., RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
            output.t[1] = RandomVariable[0]
            #/*  Mixed density at Alt */
            RandomVariable = [output.t[1]]
            global dm32
            dm32=densu(z,b32,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
            output.t[1] = RandomVariable[0]
            zhm32=zhm28;
            #/*  Net density at Alt */
            output.d[3]=dnet(output.d[3],dm32,zhm32,xmm,32.);
            #/*   Correction to specified mixing ratio at ground */
            rl=log(b28*pdm[3][1]/b32);
            hc32=pdm[3][5]*pdl[1][7];
            zc32=pdm[3][4]*pdl[1][6];
            output.d[3]=output.d[3]*ccor(z,rl,hc32,zc32);
        
        #/*  Correction for general departure from diffusive equilibrium above Zlb */
        hcc32=pdm[3][7]*pdl[1][22];
        hcc232=pdm[3][7]*pdl[0][22];
        zcc32=pdm[3][6]*pdl[1][21];
        rc32=pdm[3][3]*pdl[1][23]*(1.+flags.sw[1]*pdl[0][23]*(Input.f107A-150.));
        #/*  Net density corrected at Alt */
        output.d[3]=output.d[3]*ccor2(z,rc32,hcc32,zcc32,hcc232);
    


    #/**** AR DENSITY ****/

    #/*   Density variation factor at Zlb */
    g40= flags.sw[21]*globe7(pd[5],Input,flags);
    #/*  Diffusive density at Zlb */
    db40 = pdm[4][0]*exp(g40)*pd[5][0];
    #/*   Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[4]=densu(z,db40,tinf,tlb, 40.,alpha[4],RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[4];
    if ((flags.sw[15]) and (z<=altl[4])):
        #/*   Turbopause */
        zh40=pdm[4][2];
        #/*  Mixed density at Zlb */
        RandomVariable = [output.t[1]]
        b40=densu(zh40,db40,tinf,tlb,40.-xmm,alpha[4]-1.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        #/*  Mixed density at Alt */
        RandomVariable = [output.t[1]]
        global dm40
        dm40=densu(z,b40,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        zhm40=zhm28;
        #/*  Net density at Alt */
        output.d[4]=dnet(output.d[4],dm40,zhm40,xmm,40.);
        #/*   Correction to specified mixing ratio at ground */
        rl=log(b28*pdm[4][1]/b40);
        hc40=pdm[4][5]*pdl[1][9];
        zc40=pdm[4][4]*pdl[1][8];
        #/*  Net density corrected at Alt */
        output.d[4]=output.d[4]*ccor(z,rl,hc40,zc40);
      


    #/**** HYDROGEN DENSITY ****/

    #/*   Density variation factor at Zlb */
    g1 = flags.sw[21]*globe7(pd[6], Input, flags);
    #/*  Diffusive density at Zlb */
    db01 = pdm[5][0]*exp(g1)*pd[6][0];
    #/*   Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[6]=densu(z,db01,tinf,tlb,1.,alpha[6],RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[6];
    if ((flags.sw[15]) and (z<=altl[6])):
        #/*   Turbopause */
        zh01=pdm[5][2];
        #/*  Mixed density at Zlb */
        RandomVariable = [output.t[1]]
        b01=densu(zh01,db01,tinf,tlb,1.-xmm,alpha[6]-1., RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        #/*  Mixed density at Alt */
        RandomVariable = [output.t[1]]
        global dm01
        dm01=densu(z,b01,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        zhm01=zhm28;
        #/*  Net density at Alt */
        output.d[6]=dnet(output.d[6],dm01,zhm01,xmm,1.);
        #/*   Correction to specified mixing ratio at ground */
        rl=log(b28*pdm[5][1]*sqrt(pdl[1][17]*pdl[1][17])/b01);
        hc01=pdm[5][5]*pdl[1][11];
        zc01=pdm[5][4]*pdl[1][10];
        output.d[6]=output.d[6]*ccor(z,rl,hc01,zc01);
        #/*   Chemistry correction */
        hcc01=pdm[5][7]*pdl[1][19];
        zcc01=pdm[5][6]*pdl[1][18];
        rc01=pdm[5][3]*pdl[1][20];
        #/*  Net density corrected at Alt */
        output.d[6]=output.d[6]*ccor(z,rc01,hcc01,zcc01);



    #/**** ATOMIC NITROGEN DENSITY ****/

    #/*   Density variation factor at Zlb */
    g14 = flags.sw[21]*globe7(pd[7],Input,flags);
    #/*  Diffusive density at Zlb */
    db14 = pdm[6][0]*exp(g14)*pd[7][0];
    #/*   Diffusive density at Alt */
    RandomVariable = [output.t[1]]
    output.d[7]=densu(z,db14,tinf,tlb,14.,alpha[7],RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    dd=output.d[7];
    if ((flags.sw[15]) and (z<=altl[7])): 
        #/*   Turbopause */
        zh14=pdm[6][2];
        #/*  Mixed density at Zlb */
        RandomVariable = [output.t[1]]
        b14=densu(zh14,db14,tinf,tlb,14.-xmm,alpha[7]-1., RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        #/*  Mixed density at Alt */
        RandomVariable = [output.t[1]]
        global dm14
        dm14=densu(z,b14,tinf,tlb,xmm,0.,RandomVariable,ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1);
        output.t[1] = RandomVariable[0]
        zhm14=zhm28;
        #/*  Net density at Alt */
        output.d[7]=dnet(output.d[7],dm14,zhm14,xmm,14.);
        #/*   Correction to specified mixing ratio at ground */
        rl=log(b28*pdm[6][1]*sqrt(pdl[0][2]*pdl[0][2])/b14);
        hc14=pdm[6][5]*pdl[0][1];
        zc14=pdm[6][4]*pdl[0][0];
        output.d[7]=output.d[7]*ccor(z,rl,hc14,zc14);
        #/*   Chemistry correction */
        hcc14=pdm[6][7]*pdl[0][4];
        zcc14=pdm[6][6]*pdl[0][3];
        rc14=pdm[6][3]*pdl[0][5];
        #/*  Net density corrected at Alt */
        output.d[7]=output.d[7]*ccor(z,rc14,hcc14,zcc14);
    


    #/**** Anomalous OXYGEN DENSITY ****/

    g16h = flags.sw[21]*globe7(pd[8],Input,flags);
    db16h = pdm[7][0]*exp(g16h)*pd[8][0];
    tho = pdm[7][9]*pdl[0][6];
    RandomVariable = [output.t[1]]
    dd=densu(z,db16h,tho,tho,16.,alpha[8],RandomVariable,ptm[5],s,mn1, zn1,meso_tn1,meso_tgn1);
    output.t[1] = RandomVariable[0]
    zsht=pdm[7][5];
    zmho=pdm[7][4];
    zsho=scalh(zmho,16.0,tho);
    output.d[8]=dd*exp(-zsht/zsho*(exp(-(z-zmho)/zsht)-1.));


    #/* total mass density */
    output.d[5] = 1.66E-24*(4.0*output.d[0]+16.0*output.d[1]+28.0*output.d[2]+32.0*output.d[3]+40.0*output.d[4]+ output.d[6]+14.0*output.d[7]);
    db48=1.66E-24*(4.0*db04+16.0*db16+28.0*db28+32.0*db32+40.0*db40+db01+14.0*db14);



    #/* temperature */
    z = sqrt(Input.alt*Input.alt);
    RandomVariable = [output.t[1]]
    ddum = densu(z,1.0, tinf, tlb, 0.0, 0.0, RandomVariable, ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1);
    output.t[1] = RandomVariable[0]
    if (flags.sw[0]): # pragma: no cover
        for i in range(9):
            output.d[i]=output.d[i]*1.0E6;
        output.d[5]=output.d[5]/1000;
    return
560146
def adjust_ether (self, ip=None, ether=None):
    
# The rules are:
#   1. send to the group mac address address corresponding to the IP.dst
    if ip != None and ip.haslayer(IP) and ether != None and ether.haslayer(Ether):
      iplong = atol(ip.dst)
      ether.dst = "01:00:5e:%02x:%02x:%02x" % ( (iplong>>16)&0x7F, (iplong>>8)&0xFF, (iplong)&0xFF )
      # print "igmpize ip " + ip.dst + " as mac " + ether.dst 
      return True
    else:
      return False
186941
private int readPlaintextData(final ByteBuffer dst) {
        final int sslRead;
        final int pos = dst.position();
        if (dst.isDirect()) {
            sslRead = SSL.readFromSSL(ssl, bufferAddress(dst) + pos, dst.limit() - pos);
            if (sslRead > 0) {
                dst.position(pos + sslRead);
            }
        } else {
            final int limit = dst.limit();
            final int len = min(maxEncryptedPacketLength0(), limit - pos);
            final ByteBuf buf = alloc.directBuffer(len);
            try {
                sslRead = SSL.readFromSSL(ssl, memoryAddress(buf), len);
                if (sslRead > 0) {
                    dst.limit(pos + sslRead);
                    buf.getBytes(buf.readerIndex(), dst);
                    dst.limit(limit);
                }
            } finally {
                buf.release();
            }
        }

        return sslRead;
    }
731712
def copystat(src, dst):
    """"""
    st = os.stat(src)
    mode = stat.S_IMODE(st.st_mode)
    if hasattr(os, 'utime'):
        os.utime(dst, (st.st_atime, st.st_mtime))
    if hasattr(os, 'chmod'):
        os.chmod(dst, mode)
    if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
        try:
            os.chflags(dst, st.st_flags)
        except OSError as why:
            if (not hasattr(errno, 'EOPNOTSUPP') or
                why.errno != errno.EOPNOTSUPP):
                raise