List of usage examples for java.lang Float NaN
float NaN
To view the source code for java.lang Float NaN.
Click Source Link
From source file:org.deegree.tools.coverage.RTBClient.java
private static void setAdditionalOptions(RasterTreeBuilder rtb, CommandLine line) throws ParseException { float baseResolution = getFloatOption(line, OPT_RES, Float.NaN); rtb.setBaseResolution(baseResolution); String outputFormat = line.getOptionValue(OPT_OUTPUT_TYPE, DEFAULT_OUTPUT_FORMAT); rtb.setOutputFormat(outputFormat);/*from ww w . j a v a 2 s . com*/ rtb.setForceTileSize(line.hasOption(OPT_FORCE_SIZE)); if (line.hasOption(OPT_BBOX)) { Envelope envelope = parseBBOX(line.getOptionValue(OPT_BBOX)); rtb.setBaseEnvelope(envelope); } if (line.hasOption(OPT_BACKGROUND)) { rtb.setBackgroundValue(RasterCommandUtils.parseBackgroundValue(OPT_BACKGROUND)); } rtb.setNumThreads(getIntOption(line, OPT_NUM_THREADS, 1)); }
From source file:com.frank.search.solr.core.mapping.SimpleSolrPersistentProperty.java
@Override public Float getBoost() { Float boost = Float.NaN; Indexed indexedAnnotation = getIndexAnnotation(); if (indexedAnnotation != null) { boost = indexedAnnotation.boost(); }//w ww . ja v a2 s . com return Float.isNaN(boost) ? null : boost; }
From source file:com.cloudera.oryx.als.serving.ServerRecommender.java
@Override public void ingest(Reader reader) { for (CharSequence line : new FileLineIterable(reader)) { String[] columns = DelimitedDataUtils.decode(line); if (columns.length < 2) { throw new IllegalArgumentException("Bad line: [" + line + "]"); }/* w w w .j a va2 s. c o m*/ String userID = columns[0]; String itemID = columns[1]; if (columns.length > 2) { String valueToken = columns[2]; float value = valueToken.isEmpty() ? Float.NaN : LangUtils.parseFloat(valueToken); if (Float.isNaN(value)) { removePreference(userID, itemID); } else { setPreference(userID, itemID, value); } } else { setPreference(userID, itemID); } } }
From source file:org.mrgeo.data.tile.TiledInputFormatContext.java
public static TiledInputFormatContext load(final Configuration conf) { TiledInputFormatContext context = new TiledInputFormatContext(); context.inputs = new HashSet<String>(); String strInputs = conf.get(INPUTS); if (strInputs != null) { String[] confInputs = strInputs.split(","); for (String confInput : confInputs) { context.inputs.add(confInput); }/*w w w . j av a 2s .c om*/ } context.zoomLevel = conf.getInt(ZOOM_LEVEL, 1); context.tileSize = conf.getInt(TILE_SIZE, 512); String confBounds = conf.get(BOUNDS); if (confBounds != null) { context.bounds = Bounds.fromDelimitedString(confBounds); } context.includeEmptyTiles = conf.getBoolean(INCLUDE_EMPTY_TILES, false); if (context.includeEmptyTiles) { context.fillValue = conf.getFloat(FILL_VALUE, Float.NaN); } int providerPropertyCount = conf.getInt(PROVIDER_PROPERTY_COUNT, 0); if (providerPropertyCount > 0) { context.inputProviderProperties = new Properties(); for (int i = 0; i < providerPropertyCount; i++) { String key = conf.get(PROVIDER_PROPERTY_KEY + i); String value = conf.get(PROVIDER_PROPERTY_VALUE + i); context.inputProviderProperties.setProperty(key, value); } } return context; }
From source file:org.caleydo.view.tourguide.impl.Statistics.java
public static double chiSquaredProbability(double x, int df) { // return weka.core.Statistics.chiSquaredProbability(x, df); ChiSquaredDistribution d;//from www. j a va2s. c o m if (df == 1) { d = chiSquare1 != null ? chiSquare1.get() : null; if (d == null) { d = new ChiSquaredDistributionImpl(1); chiSquare1 = new SoftReference<>(d); } } else { d = new ChiSquaredDistributionImpl(df); } try { return 1.0 - d.cumulativeProbability(x); } catch (MathException e) { log.error("can't compute chiSquaredProbability of " + x + " with df: " + df, e); } return Float.NaN; }
From source file:knop.psfj.heatmap.FractionnedSpace.java
/** * Gets the pixel value./*from w ww . ja v a 2 s. c o m*/ * * @param f the f * @return the pixel value */ public float getPixelValue(Fraction f) { DescriptiveStatistics stats = new DescriptiveStatistics(); float median = Float.NaN; //System.out.println(f); if (f.size() != 0) { for (Point p : f) { //System.out.println(p.getValue()); if (stats == null) System.out.println(stats); if (p == null) continue; stats.addValue(p.getValue()); } median = new Float(stats.getPercentile(50)); //System.out.println("Resultat : "+median); } return median; }
From source file:com.tmall.wireless.tangram.util.Utils.java
/** * <pre>/* w w w . j a va2 s. co m*/ * parse image ratio from imageurl with regex as follows: * (\d+)-(\d+)(_?q\d+)?(\.[jpg|png|gif]) * (\d+)x(\d+)(_?q\d+)?(\.[jpg|png|gif]) * * samples urls: * http://img.alicdn.com/tps/i1/TB1x623LVXXXXXZXFXXzo_ZPXXX-372-441.png --> return 372/441 * http://img.alicdn.com/tps/i1/TB1P9AdLVXXXXa_XXXXzo_ZPXXX-372-441.png --> return 372/441 * http://img.alicdn.com/tps/i1/TB1NZxRLFXXXXbwXFXXzo_ZPXXX-372-441.png --> return 372/441 * http://img07.taobaocdn.com/tfscom/T10DjXXn4oXXbSV1s__105829.jpg_100x100.jpg --> return 100/100 * http://img07.taobaocdn.com/tfscom/T10DjXXn4oXXbSV1s__105829.jpg_100x100q90.jpg --> return 100/100 * http://img07.taobaocdn.com/tfscom/T10DjXXn4oXXbSV1s__105829.jpg_100x100q90.jpg_.webp --> return 100/100 * http://img03.taobaocdn.com/tps/i3/T1JYROXuRhXXajR_DD-1680-446.jpg_q50.jpg --> return 1680/446 * </pre> * @param imageUrl image url * @return ratio of with to height parsed from url */ public static float getImageRatio(String imageUrl) { if (TextUtils.isEmpty(imageUrl)) return Float.NaN; try { Matcher matcher = REGEX_1.matcher(imageUrl); String widthStr; String heightStr; if (matcher.find()) { if (matcher.groupCount() >= 2) { widthStr = matcher.group(1); heightStr = matcher.group(2); if (widthStr.length() < 5 && heightStr.length() < 5) { int urlWidth = Integer.parseInt(widthStr); int urlHeight = Integer.parseInt(heightStr); if (urlWidth == 0 || urlHeight == 0) { return 1; } return (float) urlWidth / urlHeight; } } } else { matcher = REGEX_2.matcher(imageUrl); if (matcher.find()) { if (matcher.groupCount() >= 2) { widthStr = matcher.group(1); heightStr = matcher.group(2); if (widthStr.length() < 5 && heightStr.length() < 5) { int urlWidth = Integer.parseInt(widthStr); int urlHeight = Integer.parseInt(heightStr); if (urlWidth == 0 || urlHeight == 0) { return 1; } return (float) urlWidth / urlHeight; } } } } } catch (Exception e) { e.printStackTrace(); } return Float.NaN; }
From source file:dk.dma.ais.abnormal.analyzer.reports.RecentEventsReportJob.java
private String generateReportBody(Date date0, Date date1, Multimap<Class<? extends Event>, Event> eventsByType) { StringBuffer email = new StringBuffer(); email.append("<html>"); email.append("<h2>Abnormal events</h2>"); email.append("<h4>Detected between " + date0 + " and " + date1 + "</h4>"); email.append("<br/>"); email.append("<pre>"); eventsByType.keySet().forEach(eventType -> { email.append(eventType.getSimpleName() + " (" + eventsByType.get(eventType).size() + ")\n\n"); email.append(String.format("%-8s %-16s %-16s %-9s %-20s %-3s %-9s %-7s %-7s %-4s %-5s %-3s%n", "#", "BEGIN", "END", "MMSI", "NAME", "LOA", "TYPE", "LAT", "LON", "SOG", "COG", "HDG")); email.append(/*from ww w .j ava 2s .c o m*/ "----------------------------------------------------------------------------------------------------------------------\n"); eventsByType.get(eventType).forEach(event -> { Vessel vessel = event.getBehaviours().iterator().next().getVessel(); TrackingPoint tp = event.getBehaviours().iterator().next().getTrackingPoints().last(); email.append(String.format("%8d ", event.getId())); email.append(String.format("%16s ", DATE_FORMAT.format(event.getStartTime()))); email.append(String.format("%16s ", event.getEndTime() == null ? " " : DATE_FORMAT.format(event.getStartTime()))); email.append(String.format("%9d ", vessel.getMmsi())); email.append(String.format("%-20s ", vessel.getName() == null ? "" : vessel.getName())); email.append(String.format("%3d ", vessel.getLength() == null ? -1 : vessel.getLength())); email.append(String .format("%-9s ", vessel.getType() == null ? "" : Categorizer.mapShipTypeCategoryToString( Categorizer.mapShipTypeToCategory(vessel.getType()))) .toUpperCase()); email.append(String.format("%7.4f ", tp.getLatitude() == null ? Float.NaN : tp.getLatitude())); email.append(String.format("%7.4f ", tp.getLongitude() == null ? Float.NaN : tp.getLongitude())); email.append(String.format("%4.1f ", tp.getSpeedOverGround() == null ? Float.NaN : tp.getSpeedOverGround())); email.append(String.format("%5.1f ", tp.getCourseOverGround() == null ? Float.NaN : tp.getCourseOverGround())); email.append( String.format("%3.0f ", tp.getTrueHeading() == null ? Float.NaN : tp.getTrueHeading())); email.append('\n'); }); email.append( "======================================================================================================================\n"); email.append("\n"); }); email.append("\n"); email.append("</pre>"); email.append("</html>"); return email.toString(); }
From source file:edu.ucsf.valelab.saim.RunTheFit.java
@Override public void run() { // pre-populate arrays with angles in radians and in degrees final double[] anglesRadians = new double[ip_.getNSlices()]; final double[] anglesDegrees = new double[ip_.getNSlices()]; for (int i = 0; i < anglesRadians.length; i++) { double angle = sd_.firstAngle_ + i * sd_.angleStep_; anglesDegrees[i] = angle;/*from ww w. j av a 2s. c om*/ anglesRadians[i] = Math.toRadians(angle); } final ImageStack is = ip_.getImageStack(); final int width = ip_.getWidth(); final int height = ip_.getHeight(); // create the fitter final SaimFunctionFitter sff = new SaimFunctionFitter(sd_.wavelength_, sd_.dOx_, sd_.nSample_, false); final SaimFunction sf = new SaimFunction(sd_); final int nrTries = sd_.heights_.length; Double[] r2s = new Double[nrTries]; double[][] results = new double[nrTries][]; // now cycle through the x/y pixels and fit each of them IntensityData observed = new IntensityData(); IntensityData calculated = new IntensityData(); int lastX = startX_ + numberX_; try { for (int x = startX_; x < lastX; x++) { for (int y = 0; y < height; y++) { if (stop_.get()) { return; } float sum = 0.0f; float[] values = new float[ip_.getNSlices()]; for (int i = 0; i < ip_.getNSlices(); i++) { values[i] = is.getProcessor(i + 1).get(x, y); sum += values[i]; } // only calculate if the average pixel intensity is // above the threshold if ((sum / (float) values.length) > sd_.threshold_) { observed.clear(); SaimUtils.organize(observed, sd_, values, anglesDegrees, anglesRadians); for (int i = 0; i < nrTries; i++) { try { double[] guess = new double[] { sd_.A_, sd_.B_, sd_.heights_[i] }; sff.setGuess(guess); results[i] = sff.fit(observed.getWeightedObservedPoints()); calculated.clear(); SaimUtils.predictValues(observed, calculated, results[i], sf); try { r2s[i] = SaimUtils.getRSquared(observed, calculated); } catch (InvalidInputException ex) { ij.IJ.log("Observed and Calculated datasets differe in size"); } } catch (TooManyIterationsException tiex) { for (int j = 0; j < 4; j++) { fpOut_[j].setf(x, y, Float.NaN); } r2s[i] = 0.0; ij.IJ.log("Failed to fit pixel " + x + ", " + y); } } final int bestIndex = SaimUtils.getIndexOfMaxValue(r2s); fpOut_[2].setf(x, y, (float) results[bestIndex][0]); // A fpOut_[3].setf(x, y, (float) results[bestIndex][1]); // B fpOut_[0].setf(x, y, (float) results[bestIndex][2]); // height fpOut_[1].setf(x, y, (float) r2s[bestIndex].doubleValue()); } } nrXProcessed_.getAndIncrement(); synchronized (nrXProcessed_) { ij.IJ.showProgress(nrXProcessed_.get(), width); } } } catch (InvalidInputException ex) { ij.IJ.error("Saim Fit", ex.getMessage()); } }
From source file:com.taobao.weex.dom.WXRecyclerDomObject.java
public void updateRecyclerAttr() { preCalculateCellWidth();/* ww w . j av a 2s.co m*/ if (mColumnWidth == 0 && mColumnWidth == Float.NaN) { WXLogUtils.w("preCalculateCellWidth mColumnGap :" + mColumnGap + " mColumnWidth:" + mColumnWidth + " mColumnCount:" + mColumnCount); return; } int count = getChildCount(); for (int i = 0; i < count; i++) { WXDomObject domObject = getChild(i); if (WXBasicComponentType.CELL.equals(domObject.getType())) { getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth); } } }