/* * This file is part of TISEAN * * Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber * * TISEAN is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * TISEAN is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with TISEAN; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /*Author: Rainer Hegger. Last modified (rewritten in C) Aug 22, 2004*/ #include #include #include #include #include #include "routines/tsa.h" #define WID_STR "Produces delay vectors" unsigned long length=ULONG_MAX; unsigned long exclude=0; unsigned int verbosity=0xff; int delay=1; unsigned int indim=1,embdim=2; char *column=NULL,*format=NULL,*multidelay=NULL; char *outfile=NULL; char *infile=NULL; char dimset=0,formatset=0,embset=0,mdelayset=0,delayset=0; char stdo=1; double **series; unsigned int *formatlist,*delaylist; void show_options(char *progname) { what_i_do(progname,WID_STR); fprintf(stderr,"\nUsage: %s [options]\n",progname); fprintf(stderr,"Options:\n"); fprintf(stderr,"Everything not being a valid option will be interpreted as a" " possible datafile.\nIf no datafile is given stdin is read." " Just - also means stdin\n"); fprintf(stderr,"\t-l # of data [default: whole file]\n"); fprintf(stderr,"\t-x # of rows to ignore [default: 0]\n"); fprintf(stderr,"\t-M num. of columns to read [default: %u]\n",indim); fprintf(stderr,"\t-c columns to read [default: 1,...,M]\n"); fprintf(stderr,"\t-m dimension [default: 2]\n"); fprintf(stderr,"\t-F format of the delay vector (see man page)\n"); fprintf(stderr,"\t-d delay [default: 1]\n"); fprintf(stderr,"\t-D multi delay list (see man page)\n"); fprintf(stderr,"\t-V verbosity level [default: 1]\n\t\t" "0='only panic messages'\n\t\t" "1='+ input/output messages'\n"); fprintf(stderr,"\t-o output file [default: 'datafile'.del, " "without -o: stdout]\n"); fprintf(stderr,"\t-h show these options\n"); exit(0); } void scan_options(int n,char **str) { char *out; if ((out=check_option(str,n,'l','u')) != NULL) sscanf(out,"%lu",&length); if ((out=check_option(str,n,'x','u')) != NULL) sscanf(out,"%lu",&exclude); if ((out=check_option(str,n,'c','s')) != NULL) column=out; if ((out=check_option(str,n,'M','u')) != NULL) { sscanf(out,"%u",&indim); dimset=1; } if ((out=check_option(str,n,'F','s')) != NULL) { format=out; formatset=1; } if ((out=check_option(str,n,'m','u')) != NULL) { sscanf(out,"%u",&embdim); embset=1; } if ((out=check_option(str,n,'d','u')) != NULL) { sscanf(out,"%u",&delay); delayset=1; } if ((out=check_option(str,n,'D','s')) != NULL) { multidelay=out; mdelayset=1; } if ((out=check_option(str,n,'V','u')) != NULL) sscanf(out,"%u",&verbosity); if ((out=check_option(str,n,'o','o')) != NULL) { stdo=0; if (strlen(out) > 0) outfile=out; } } void create_format_list(void) { unsigned int i=0,num=0,sum=0; while (format[i]) { if (!(isdigit(format[i])) && !(format[i] == ',')) { fprintf(stderr,"Wrong format of -F parameter. Exiting!\n"); exit(DELAY_WRONG_FORMAT_F); } i++; } i=0; while (format[i]) { if (format[i++] == ',') num++; } check_alloc(formatlist=(unsigned int*)malloc(sizeof(int)*(num+1))); for (i=0;i<=num;i++) { sscanf(format,"%d",&formatlist[i]); if (i