2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								program jt9
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Decoder for JT9.  Can run stand-alone, reading data from *.wav files;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! or as the back end of wsjt-x, with data placed in a shared memory region.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  use options
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  use prog_args
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  use, intrinsic :: iso_c_binding
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  use FFTW3
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-27 15:40:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  use timer_module, only: timer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  use timer_impl, only: init_timer, fini_timer
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-02 14:29:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  use readwav
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  include 'jt9com.f90'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  integer*2 id2a(180000)
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  integer(C_INT) iret
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-02 14:29:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  type(wav_header) wav
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  real*4 s(NSMAX)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 19:28:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  real*8 TRperiod
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  character c
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character(len=500) optarg, infile
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  character wisfile*80
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-07 20:00:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								!### ndepth was defined as 60001.  Why???
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  integer :: arglen,stat,offset,remain,mode=0,flow=200,fsplit=2700,          &
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 10:35:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       fhigh=4000,nrxfreq=1500,ndepth=1,nexp_decode=0,nQSOProg=0
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 09:01:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  logical :: read_files = .true., tx9 = .false., display_help = .false.,     &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       bLowSidelobes = .false.
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-31 16:38:21 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  type (option) :: long_options(30) = [ &
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('help', .false., 'h', 'Display this help message', ''),          &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('shmem',.true.,'s','Use shared memory for sample data','KEY'),   &
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 19:28:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('tr-period', .true., 'p', 'Tx/Rx period, default SECONDS=60',     &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'SECONDS'),                                                          &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('executable-path', .true., 'e',                                  &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Location of subordinate executables (KVASD) default PATH="."',      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'PATH'),                                                             &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('data-path', .true., 'a',                                        &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Location of writeable data files, default PATH="."', 'PATH'),       &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('temp-path', .true., 't',                                        &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Temporary files path, default PATH="."', 'PATH'),                   &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('lowest', .true., 'L',                                           &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Lowest frequency decoded (JT65), default HERTZ=200', 'HERTZ'),      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('highest', .true., 'H',                                          &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Highest frequency decoded, default HERTZ=4007', 'HERTZ'),           &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('split', .true., 'S',                                            &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Lowest JT9 frequency decoded, default HERTZ=2700', 'HERTZ'),        &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('rx-frequency', .true., 'f',                                     &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Receive frequency offset, default HERTZ=1500', 'HERTZ'),            &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('patience', .true., 'w',                                         &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'FFTW3 planing patience (0-4), default PATIENCE=1', 'PATIENCE'),     &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('fft-threads', .true., 'm',                                      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'Number of threads to process large FFTs, default THREADS=1',        &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'THREADS'),                                                          &
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-15 11:58:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('q65', .false., '3', 'Q65 mode', ''),                        &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('jt4', .false., '4', 'JT4 mode', ''),                            &
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-03 15:40:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('ft4', .false., '5', 'FT4 mode', ''),                            &
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 15:07:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('jt65', .false.,'6', 'JT65 mode', ''),                           &
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-23 12:53:49 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('fst4', .false., '7', 'FST4 mode', ''),                      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('fst4w', .false., 'W', 'FST4W mode', ''),                    &
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-03 15:40:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('ft8', .false., '8', 'FT8 mode', ''),                            &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('jt9', .false., '9', 'JT9 mode', ''),                            &
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-16 18:25:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('qra64', .false., 'q', 'QRA64 mode', ''),                        &
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 10:35:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('QSOprog', .true., 'Q', 'QSO progress (0-5), default PROGRESS=1',&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'QSOprogress'),                                                      &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('sub-mode', .true., 'b', 'Sub mode, default SUBMODE=A', 'A'),    &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('depth', .true., 'd',                                            &
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 10:35:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        'Decoding depth (1-3), default DEPTH=1', 'DEPTH'),                   &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    option ('tx-jt9', .false., 'T', 'Tx mode is JT9', ''),                   &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('my-call', .true., 'c', 'my callsign', 'CALL'),                  &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('my-grid', .true., 'G', 'my grid locator', 'GRID'),              &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('his-call', .true., 'x', 'his callsign', 'CALL'),                &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('his-grid', .true., 'g', 'his grid locator', 'GRID'),            &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    option ('experience-decode', .true., 'X',                                &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'experience based decoding flags (1..n), default FLAGS=0',           &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'FLAGS') ]
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  type(dec_data), allocatable :: shared_data
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-19 20:41:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  character(len=20) :: datetime=''
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character(len=12) :: mycall='K1ABC', hiscall='W9XYZ'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character(len=6) :: mygrid='', hisgrid='EN37'
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  common/patience/npatience,nthreads
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  common/decstats/ntry65a,ntry65b,n65a,n65b,num9,numfano
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-26 10:50:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  data npatience/1/,nthreads/1/,wisfile/' '/
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-01 12:01:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  iwspr=0
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  nsubmode = 0
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 19:28:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  TRperiod=60.d0
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  do
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-31 16:38:21 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     call getopt('hs:e:a:b:r:m:p:d:f:w:t:9876543WqTL:S:H:c:G:x:g:X:Q:',      &
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-30 13:55:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          long_options,c,optarg,arglen,stat,offset,remain,.true.)
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if (stat .ne. 0) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     end if
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     select case (c)
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-10 14:04:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('h')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           display_help = .true.
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('s')
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-18 17:57:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           read_files = .false.
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           shm_key = optarg(:arglen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('e')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           exe_dir = optarg(:arglen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('a')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           data_dir = optarg(:arglen)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('b')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           nsubmode = ichar (optarg(:1)) - ichar ('A')
							 | 
						
					
						
							
								
									
										
										
										
											2014-12-03 00:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('t')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           temp_dir = optarg(:arglen)
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('m')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) nthreads
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('p')
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 19:28:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) TRperiod
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('d')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) ndepth
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('f')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) nrxfreq
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-10 14:04:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('L')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) flow
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('S')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) fsplit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('H')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) fhigh
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-16 18:25:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('q')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 164
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 10:35:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('Q')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) nQSOProg
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-31 16:38:21 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('3')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 66
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('4')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 4
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-03 15:40:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('5')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 5
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-10 14:04:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('6')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           if (mode.lt.65) mode = mode + 65
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 15:07:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('7')
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-27 08:53:11 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           mode = 240
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-01 12:01:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           iwspr=0
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-30 13:55:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('8')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 8
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 15:07:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('9')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           if (mode.lt.9.or.mode.eq.65) mode = mode + 9
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-10 14:04:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('T')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           tx9 = .true.
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-20 18:48:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('w')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) npatience
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-01 12:01:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('W')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           mode = 241
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           iwspr=1
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        case ('c')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) mycall
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('G')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) mygrid
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('x')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) hiscall
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('g')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) hisgrid
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        case ('X')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           read (optarg(:arglen), *) nexp_decode
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     end select
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end do
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-04 10:19:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (display_help .or. stat .lt. 0                      &
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-18 17:57:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       .or. (.not. read_files .and. remain .gt. 0)       &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       .or. (read_files .and. remain .lt. 1)) then
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-15 15:35:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     print *, 'Usage: jt9 [OPTIONS] file1 [file2 ...]'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, '       Reads data from *.wav files.'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, ''
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, '       jt9 -s <key> [-w patience] [-m threads] [-e path] [-a path] [-t path]'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, '       Gets data from shared memory region with key==<key>'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, ''
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, 'OPTIONS:'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     print *, ''
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-10 14:04:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     do i = 1, size (long_options)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       call long_options(i) % print (6)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     end do
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     go to 999
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  endif
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:09:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  iret=fftwf_init_threads()            !Initialize FFTW threading 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Default to 1 thread, but use nthreads for the big ones
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call fftwf_plan_with_nthreads(1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-30 21:28:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! Import FFTW wisdom, if available
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  wisfile=trim(data_dir)//'/jt9_wisdom.dat'// C_NULL_CHAR
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  iret=fftwf_import_wisdom_from_filename(wisfile)
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-20 18:48:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ntry65a=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ntry65b=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  n65a=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  n65b=0
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-13 14:22:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  num9=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  numfano=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-18 17:57:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (.not. read_files) then
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     call jt9a()          !We're running under control of WSJT-X
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     go to 999
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  allocate(shared_data)
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 21:42:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  nflatten=0
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  do iarg = offset + 1, offset + remain
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     call get_command_argument (iarg, optarg, arglen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     infile = optarg(:arglen)
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-02 14:29:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     call wav%read (infile)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     nfsample=wav%audio_format%sample_rate
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     i1=index(infile,'.wav')
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(i1.lt.1) i1=index(infile,'.WAV')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     if(infile(i1-5:i1-5).eq.'_') then
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        read(infile(i1-4:i1-1),*,err=1) nutc
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     else
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-14 18:19:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        read(infile(i1-6:i1-1),*,err=1) nutc
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     endif
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     go to 2
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								1    nutc=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-18 11:25:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								2    nsps=6912
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 20:31:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     npts=TRperiod*12000.d0
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     kstep=nsps/2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     k=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-18 11:25:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     nhsym=0
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     nhsym0=-999
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     if(iarg .eq. offset + 1) then
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-27 15:40:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call init_timer (trim(data_dir)//'/timer.out')
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-20 18:48:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call timer('jt9     ',0)
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     endif
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 23:21:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%id2=0          !??? Why is this necessary ???
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-23 09:55:50 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.5) npts=21*3456
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-08 09:14:12 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.66) npts=TRperiod*12000
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     do iblk=1,npts/kstep
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        k=iblk*kstep
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-30 13:55:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if(mode.eq.8 .and. k.gt.179712) exit
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call timer('read_wav',0)
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-02 14:29:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        read(unit=wav%lun,end=3) shared_data%id2(k-kstep+1:k)
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        go to 4
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								3       call timer('read_wav',1)
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-04 10:19:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        print*,'EOF on input file ',trim(infile)
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        exit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								4       call timer('read_wav',1)
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        nhsym=(k-2048)/kstep
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if(nhsym.ge.1 .and. nhsym.ne.nhsym0) then
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           if(mode.eq.9 .or. mode.eq.74) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Compute rough symbol spectra for the JT9 decoder
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              ingain=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              call timer('symspec ',0)
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              nminw=1
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 19:28:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              call symspec(shared_data,k,Tperiod,nsps,ingain,      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                   bLowSidelobes,nminw,pxdb,s,df3,ihsym,npts8,pxdbmax)
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              call timer('symspec ',1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           endif
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           nhsym0=nhsym
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-08 13:57:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           if(nhsym.ge.181 .and. mode.ne.240 .and. mode.ne.241 .and. mode.ne.66) exit
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     enddo
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-02 14:29:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     close(unit=wav%lun)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nutc=nutc
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%ndiskdat=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-17 20:31:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%ntr=TRperiod
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nfqso=nrxfreq
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%newdat=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%npts8=74736
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nfa=flow
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nfsplit=fsplit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nfb=fhigh
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%ntol=20
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-15 11:58:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.66) shared_data%params%ntol=10
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%kin=64800
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-27 08:53:11 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.240) shared_data%params%kin=720000   !### 60 s periods ###
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-18 11:25:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nzhsym=nhsym
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-01 12:01:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.240 .and. iwspr.eq.1) ndepth=ior(ndepth,128)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%ndepth=ndepth
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-04 17:03:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%lft8apon=.true.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%ljt65apon=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-22 03:01:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%napwid=75
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%dttol=3.
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-16 18:25:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.164 .and. nsubmode.lt.100) nsubmode=nsubmode+100
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-27 20:47:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%naggressive=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%n2pass=2
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 10:35:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nQSOprogress=nQSOProg
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-27 20:47:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nranera=6                      !### ntrials=3000
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nrobust=.false.
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nexp_decode=nexp_decode
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-19 20:41:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%mycall=transfer(mycall,shared_data%params%mycall)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%mygrid=transfer(mygrid,shared_data%params%mygrid)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%hiscall=transfer(hiscall,shared_data%params%hiscall)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%hisgrid=transfer(hisgrid,shared_data%params%hisgrid)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if (tx9) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%ntxmode=9
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%ntxmode=65
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     end if
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     if (mode.eq.0) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%nmode=65+9
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%nmode=mode
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     end if
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-29 23:52:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%nsubmode=nsubmode
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-19 20:41:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     datetime="2013-Apr-16 15:13" !### Temp
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     shared_data%params%datetime=transfer(datetime,shared_data%params%datetime)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-17 20:29:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.9 .and. fsplit.ne.2700) shared_data%params%nfa=fsplit
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     if(mode.eq.8) then
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 15:37:31 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! "Early" decoding pass, FT8 only, when jt9 reads data from disk
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-28 15:03:39 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        nearly=41
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%nzhsym=nearly
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(nearly*3456+1:)=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 15:53:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call multimode_decoder(shared_data%ss,id2a,      &
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             shared_data%params,nfsample)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 19:03:09 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        nearly=47
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%nzhsym=nearly
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(nearly*3456+1:)=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 15:53:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call multimode_decoder(shared_data%ss,id2a,      &
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 19:03:09 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             shared_data%params,nfsample)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(nearly*3456+1:50*3456)=shared_data%id2(nearly*3456+1:50*3456)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        id2a(50*3456+1:)=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-04 10:55:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        shared_data%params%nzhsym=50
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 15:53:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call multimode_decoder(shared_data%ss,id2a,      &
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 19:03:09 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             shared_data%params,nfsample)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cycle
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Normal decoding pass
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 15:53:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     call multimode_decoder(shared_data%ss,shared_data%id2, &
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          shared_data%params,nfsample)
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:43:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  enddo
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call timer('jt9     ',1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call timer('jt9     ',101)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-20 18:48:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								999 continue
							 | 
						
					
						
							
								
									
										
										
										
											2016-12-15 18:58:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! Output decoder statistics
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-27 15:40:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  call fini_timer ()
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-26 10:50:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! Save FFTW wisdom and free memory
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(len(trim(wisfile)).gt.0) iret=fftwf_export_wisdom_to_filename(wisfile)
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 01:41:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  call four2a(a,-1,1,1,1)
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-01 16:23:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  call filbig(a,-1,1,0.0,0,0,0,0,0)        !used for FFT plans
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call fftwf_cleanup_threads()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call fftwf_cleanup()
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-20 18:48:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								end program jt9
							 |