public static double scaleEDA(final int port, final int raw) {
        // need to round maximum value that otherwise is 1.05496875
        final double ohm = 1 - ( (double)raw /(double)1023);
       	double result = 1/ohm;
        if (result != Double.POSITIVE_INFINITY)
        	result = new BigDecimal(result).setScale(4, RoundingMode.HALF_UP)
                .doubleValue();
        return result;
    }