public void testString() { System.out.println("testString: testString"); // read for (i=0; i<m; i++) { ima.set0(i); String val = A.getString( ima); assert( val.equals("aaa")); } }
private Map<Float, Float> extractDataPoints(int scanIndex) throws IOException, InvalidRangeException { // Find the Index of mass and intensity values Map<Float, Float> dataPoints = new HashMap<Float, Float>(); final int scanStartPosition[] = { ((Long) indexElement.get(scanIndex).getKey()).intValue()}; if(scanIndex == 4975){ System.out.println("wait");} final int scanLength[] = { ((Long) indexElement.get(scanIndex + 1).getKey()).intValue() - ((Long) indexElement.get(scanIndex).getKey()).intValue() }; final Array massValueArray = massValueVariable.read(scanStartPosition, scanLength); final Array intensityValueArray = intensityValueVariable .read(scanStartPosition, scanLength); final Index massValuesIndex = massValueArray.getIndex(); final Index intensityValuesIndex = intensityValueArray.getIndex(); // Get number of data points final int arrayLength = massValueArray.getShape()[0]; // Load the data points for (int i = 0; i < arrayLength; i++) { final Index massIndex0 = massValuesIndex.set0(i); final Index intensityIndex0 = intensityValuesIndex.set0(i); dataPoints.put(new Float(massValueArray.getDouble(massIndex0) * massValueScaleFactor), (float) (intensityValueArray .getDouble(intensityIndex0) * intensityValueScaleFactor)); } return dataPoints; }
/** * Create a scalar numeric-valued Attribute. * * @param name name of Attribute * @param val value of Attribute */ public Attribute(String name, Number val) { super(name); int[] shape = new int[1]; shape[0] = 1; DataType dt = DataType.getType(val.getClass()); Array vala = Array.factory(dt.getPrimitiveClassType(), shape); Index ima = vala.getIndex(); vala.setDouble(ima.set0(0), val.doubleValue()); setValues(vala); }
public Attribute(String name, Number val, boolean isUnsigned) { super(name); if (name == null) throw new IllegalArgumentException("Trying to set name to null on " + this); int[] shape = new int[1]; shape[0] = 1; DataType dt = DataType.getType(val.getClass(), isUnsigned); setDataType(dt); Array vala = Array.factory(dt, shape); Index ima = vala.getIndex(); vala.setObject(ima.set0(0), val); setValues(vala); setImmutable(); }
public void testStringPutGet() { System.out.println("testString: testStringPutGet"); // write ima.set0(0); A.setString(ima, "hey"); ima.set0(1); A.setString(ima, "there"); ima.set0(2); A.setString(ima, "yo"); ima.set0(3); A.setString(ima, "I"); // read ima.set0(0); assert(A.getString(ima).equals("hey")); ima.set0(1); assert(A.getString(ima).equals("the")); ima.set0(2); assert(A.getString(ima).equals("yo")); ima.set0(3); assert(A.getString(ima).equals("I")); }
public Attribute(String name, Number val, boolean isUnsigned) { super(name); if (name == null) throw new IllegalArgumentException("Trying to set name to null on "+this); int[] shape = new int[1]; shape[0] = 1; DataType dt = DataType.getType(val.getClass()); Array vala = Array.factory(dt.getPrimitiveClassType(), shape); Index ima = vala.getIndex(); vala.setDouble(ima.set0(0), val.doubleValue()); setValues(vala); this.isUnsigned = isUnsigned; if (isUnsigned) vala.setUnsigned(true); setImmutable(true); }
public void testRegular() { System.out.println("testString: testRegular"); // read for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); char val = A.getChar(ima); assert (val == 'a'); } } }
public void setUp() { // write for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); A.setChar(ima, 'a'); } } }
void transfer(Array slice, int k) { Index ima = work.getIndex(); ima.set1(k); // this one stays fixed int count = 0; IndexIterator ii = slice.getIndexIterator(); while (ii.hasNext()) { work.setDouble(ima.set0(count), ii.getDoubleNext()); count++; } }
void transfer(Array slice, int k) { Index ima = work.getIndex(); ima.set1(k); // this one stays fixed int count = 0; IndexIterator ii = slice.getIndexIterator(); while (ii.hasNext()) { work.setDouble(ima.set0(count), ii.getDoubleNext()); count++; } }
void transfer(Array slice, int k) { Index ima = work.getIndex(); ima.set1(k); // this one stays fixed int count = 0; IndexIterator ii = slice.getIndexIterator(); while (ii.hasNext()) { work.setDouble(ima.set0(count), ii.getDoubleNext()); count++; } }
public void testGetPut() { System.out.println("test Set/Get: seti()"); // read for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); for (k=0; k<p; k++) { double val = A.getDouble(ima.set2(k)); assert (val == i*1000000+j*1000+k); } } } }
public void setUp() { // write int count = 0; for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); for (k=0; k<p; k++) { A.setDouble(ima.set2(k), (double) (count++)); } } } }
public void setUp() { // write for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); for (k=0; k<p; k++) { A.setDouble(ima.set2(k), (double) (i*1000000+j*1000+k)); } } } }
final Index massIndex0 = massValuesIndex.set0(i);
double val = ii.getDoubleNext(); if (Double.isNaN(val)) continue; shortData.setDouble(ima.set0(count2), val); count2++;
@Before public void setUp() { ima = A.getIndex(); // write for (int i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); for (k=0; k<p; k++) { ima.set2(k); A.setDouble(ima, (double) (i*100+j*10+k)); } } } }
public void setUp() throws InvalidRangeException { Index ima = A.getIndex(); // write for (i=0; i<m; i++) { ima.set0(i); for (j=0; j<n; j++) { ima.set1(j); for (k=0; k<p; k++) { ima.set2(k); A.setDouble(ima, (double) (i*100+j*10+k)); } } } // section secA = (ArrayDouble) A.section( new Section(m1+":"+m2+",:,:").getRanges() ); }
StructureData sd = (StructureData) data.getObject(ima.set0(29)); assert (sd.getScalarDouble("c_name") == 9.0) : sd.getScalarDouble("c_name");