/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test.endtoend; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.text.ParseException; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import org.das2.qds.DDataSet; import org.das2.qds.DataSetUtil; import org.das2.qds.JoinDataSet; import org.das2.qds.MutablePropertyDataSet; import org.das2.qds.QDataSet; import org.das2.qds.WritableDataSet; import org.das2.qds.ops.Ops; /** * * @author jbf */ public class TestSupport { protected static final Logger logger= org.das2.util.LoggerManager.getLogger("autoplot.test"); /** * input vaps for testing. */ public static final String TEST_HOME= "/home/jbf/ct/hudson/"; /** * input data for testing */ public static final String TEST_DATA= "file:" + TEST_HOME + "data.backup/"; /** * input data for testing, small area that can be backed up. */ public static final String TEST_DATA_SMALL= "file:" + TEST_HOME + "data/"; /** * input vaps for testing. */ public static final String TEST_VAP= "file:" + TEST_HOME + "vap/"; public static MutablePropertyDataSet sampleDataRank2( int len0, int len1 ) { MutablePropertyDataSet rank2Rand= (MutablePropertyDataSet) Ops.add( Ops.randomn(-12345, len0,len1), Ops.sin( Ops.add( Ops.outerProduct( Ops.linspace( 0, 1000.,len0), Ops.replicate(1,len1)), Ops.outerProduct( Ops.replicate(1,len0), Ops.linspace(0,10,len1) ) ) ) ); rank2Rand.putProperty( QDataSet.NAME, "Randomn" ); return rank2Rand; } /** * return rank 1 dataset that is a 1-D random walk. * @param len0 * @return */ public static MutablePropertyDataSet sampleDataRank1( int len0 ) { MutablePropertyDataSet rank1Rand= (MutablePropertyDataSet) Ops.accum( Ops.randomn(-12345,len0) ); try { MutablePropertyDataSet xx= (MutablePropertyDataSet) Ops.timegen("2050-001T00:00", "75.23 ms", len0); xx.putProperty(QDataSet.NAME, "Time" ); rank1Rand.putProperty(QDataSet.DEPEND_0, xx ); } catch (ParseException ex) { logger.log(Level.SEVERE, ex.getMessage(), ex); } Random r= new Random(-12345); // simulate data dropout. WritableDataSet wds= (WritableDataSet)rank1Rand; int len= Math.max( 5,len0/100 ); for ( int i=0; i<5; i++ ) { int idx= r.nextInt(len0-len); for ( int j=idx; j