rapidtide 3.0.7.1__py3-none-any.whl → 3.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. rapidtide/RapidtideDataset.py +1 -1
  2. rapidtide/_version.py +3 -3
  3. rapidtide/calcnullsimfunc.py +1 -3
  4. rapidtide/data/examples/src/test_findmaxlag.py +1 -1
  5. rapidtide/data/examples/src/testfmri +19 -7
  6. rapidtide/data/examples/src/testnewrefine +0 -23
  7. rapidtide/fMRIData_class.py +29 -52
  8. rapidtide/fit.py +4 -4
  9. rapidtide/happy_supportfuncs.py +1 -1
  10. rapidtide/helper_classes.py +0 -1099
  11. rapidtide/linfitfiltpass.py +82 -4
  12. rapidtide/makelaggedtcs.py +10 -0
  13. rapidtide/refinedelay.py +11 -20
  14. rapidtide/refineregressor.py +1 -1
  15. rapidtide/resample.py +8 -8
  16. rapidtide/simFuncClasses.py +1132 -0
  17. rapidtide/simfuncfit.py +30 -30
  18. rapidtide/stats.py +5 -2
  19. rapidtide/tests/.coveragerc +6 -0
  20. rapidtide/tests/cleanposttest +1 -1
  21. rapidtide/tests/runlocaltest +2 -2
  22. rapidtide/tests/test_cleanregressor.py +3 -3
  23. rapidtide/tests/test_congrid.py +1 -1
  24. rapidtide/tests/test_corrpass.py +3 -3
  25. rapidtide/tests/test_delayestimation.py +9 -8
  26. rapidtide/tests/test_findmaxlag.py +2 -2
  27. rapidtide/tests/test_fullrunrapidtide_v3.py +2 -1
  28. rapidtide/tests/test_fullrunrapidtide_v8.py +66 -0
  29. rapidtide/tests/test_getparsers.py +14 -6
  30. rapidtide/tests/test_io.py +2 -6
  31. rapidtide/tests/test_nullcorr.py +3 -3
  32. rapidtide/tests/test_refinedelay.py +20 -5
  33. rapidtide/tidepoolTemplate_alt.py +1 -1
  34. rapidtide/util.py +7 -0
  35. rapidtide/voxelData.py +3 -6
  36. rapidtide/workflows/calcSimFuncMap.py +271 -0
  37. rapidtide/workflows/cleanregressor.py +2 -2
  38. rapidtide/workflows/delayvar.py +45 -59
  39. rapidtide/workflows/fitSimFuncMap.py +427 -0
  40. rapidtide/workflows/happy.py +1 -1
  41. rapidtide/workflows/rapidtide.py +499 -877
  42. rapidtide/workflows/rapidtide_parser.py +26 -38
  43. rapidtide/workflows/refineDelayMap.py +138 -0
  44. rapidtide/{RegressorRefiner.py → workflows/refineRegressor.py} +200 -28
  45. rapidtide/workflows/regressfrommaps.py +38 -30
  46. rapidtide/workflows/retrolagtcs.py +5 -6
  47. rapidtide/workflows/retroregress.py +73 -191
  48. rapidtide/workflows/showarbcorr.py +2 -2
  49. rapidtide/workflows/showxcorrx.py +5 -5
  50. rapidtide/workflows/tidepool.py +5 -5
  51. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/METADATA +2 -2
  52. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/RECORD +56 -52
  53. rapidtide/workflows/delayestimation.py +0 -483
  54. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/WHEEL +0 -0
  55. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/entry_points.txt +0 -0
  56. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/licenses/LICENSE +0 -0
  57. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2016-2025 Blaise Frederick
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+ import numpy as np
20
+
21
+ import rapidtide.calcsimfunc as tide_calcsimfunc
22
+ import rapidtide.io as tide_io
23
+ import rapidtide.linfitfiltpass as tide_linfitfiltpass
24
+ import rapidtide.makelaggedtcs as tide_makelagged
25
+ import rapidtide.stats as tide_stats
26
+ import rapidtide.util as tide_util
27
+
28
+
29
+ def makeRIPTiDeRegressors(
30
+ initial_fmri_x,
31
+ lagmin,
32
+ lagmax,
33
+ lagtcgenerator,
34
+ LGR,
35
+ nprocs=1,
36
+ alwaysmultiproc=False,
37
+ showprogressbar=True,
38
+ chunksize=1000,
39
+ targetstep=2.5,
40
+ edgepad=0,
41
+ rt_floatset=np.float64,
42
+ rt_floattype="float64",
43
+ debug=False,
44
+ ):
45
+ # make the RIPTiDe evs
46
+ numdelays = int(np.round((lagmax - lagmin) / targetstep, 0))
47
+ numregressors = numdelays + 2 * edgepad
48
+ delaystep = (lagmax - lagmin) / numdelays
49
+ delaystouse = np.linspace(
50
+ lagmin - edgepad * delaystep,
51
+ lagmax + edgepad * delaystep,
52
+ numdelays + 2 * edgepad,
53
+ endpoint=True,
54
+ )
55
+ if debug:
56
+ print(f"{lagmin=}")
57
+ print(f"{lagmax=}")
58
+ print(f"{numdelays=}")
59
+ print(f"{edgepad=}")
60
+ print(f"{numregressors=}")
61
+ print(f"{delaystep=}")
62
+ print(f"{delaystouse=}, {len(delaystouse)}")
63
+ print(f"{len(initial_fmri_x)}")
64
+
65
+ regressorset = np.zeros((len(delaystouse), len(initial_fmri_x)), dtype=rt_floatset)
66
+
67
+ dummy = tide_makelagged.makelaggedtcs(
68
+ lagtcgenerator,
69
+ initial_fmri_x,
70
+ np.ones_like(delaystouse, dtype=np.float64),
71
+ delaystouse,
72
+ regressorset,
73
+ LGR=LGR,
74
+ nprocs=nprocs,
75
+ alwaysmultiproc=alwaysmultiproc,
76
+ showprogressbar=showprogressbar,
77
+ chunksize=chunksize,
78
+ rt_floatset=rt_floatset,
79
+ rt_floattype=rt_floattype,
80
+ debug=debug,
81
+ )
82
+
83
+ if debug:
84
+ print(regressorset)
85
+
86
+ return regressorset, delaystouse
87
+
88
+
89
+ def calcSimFunc(
90
+ numvalidspatiallocs,
91
+ fmri_data_valid,
92
+ validsimcalcstart,
93
+ validsimcalcend,
94
+ osvalidsimcalcstart,
95
+ osvalidsimcalcend,
96
+ initial_fmri_x,
97
+ os_fmri_x,
98
+ theCorrelator,
99
+ theMutualInformationator,
100
+ cleaned_referencetc,
101
+ corrout,
102
+ regressorset,
103
+ delayvals,
104
+ sLFOfitmean,
105
+ r2value,
106
+ fitcoeff,
107
+ fitNorm,
108
+ meanval,
109
+ corrscale,
110
+ outputname,
111
+ outcorrarray,
112
+ validvoxels,
113
+ nativecorrshape,
114
+ theinputdata,
115
+ theheader,
116
+ lagmininpts,
117
+ lagmaxinpts,
118
+ thepass,
119
+ optiondict,
120
+ LGR,
121
+ TimingLGR,
122
+ similaritymetric="correlation",
123
+ simcalcoffset=0,
124
+ echocancel=False,
125
+ checkpoint=False,
126
+ nprocs=1,
127
+ alwaysmultiproc=False,
128
+ oversampfactor=2,
129
+ interptype="univariate",
130
+ showprogressbar=True,
131
+ chunksize=1000,
132
+ rt_floatset=np.float64,
133
+ rt_floattype="float64",
134
+ mklthreads=1,
135
+ threaddebug=False,
136
+ debug=False,
137
+ ):
138
+ # Step 1 - Correlation step
139
+ if similaritymetric == "mutualinfo":
140
+ similaritytype = "Mutual information"
141
+ elif similaritymetric == "correlation":
142
+ similaritytype = "Correlation"
143
+ elif similaritymetric == "riptide":
144
+ similaritytype = "RIPTiDe"
145
+ else:
146
+ similaritytype = "MI enhanced correlation"
147
+ LGR.info(f"\n\n{similaritytype} calculation, pass {thepass}")
148
+ TimingLGR.info(f"{similaritytype} calculation start, pass {thepass}")
149
+
150
+ tide_util.disablemkl(nprocs, debug=threaddebug)
151
+ if similaritymetric == "mutualinfo":
152
+ theMutualInformationator.setlimits(lagmininpts, lagmaxinpts)
153
+ (
154
+ voxelsprocessed_cp,
155
+ theglobalmaxlist,
156
+ trimmedcorrscale,
157
+ ) = tide_calcsimfunc.correlationpass(
158
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
159
+ cleaned_referencetc,
160
+ theMutualInformationator,
161
+ initial_fmri_x[validsimcalcstart : validsimcalcend + 1],
162
+ os_fmri_x[osvalidsimcalcstart : osvalidsimcalcend + 1],
163
+ lagmininpts,
164
+ lagmaxinpts,
165
+ corrout,
166
+ meanval,
167
+ nprocs=nprocs,
168
+ alwaysmultiproc=alwaysmultiproc,
169
+ oversampfactor=oversampfactor,
170
+ interptype=interptype,
171
+ showprogressbar=showprogressbar,
172
+ chunksize=chunksize,
173
+ rt_floatset=rt_floatset,
174
+ rt_floattype=rt_floattype,
175
+ debug=debug,
176
+ )
177
+ elif (similaritymetric == "correlation") or (similaritymetric == "hybrid"):
178
+ (
179
+ voxelsprocessed_cp,
180
+ theglobalmaxlist,
181
+ trimmedcorrscale,
182
+ ) = tide_calcsimfunc.correlationpass(
183
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
184
+ cleaned_referencetc,
185
+ theCorrelator,
186
+ initial_fmri_x[validsimcalcstart : validsimcalcend + 1],
187
+ os_fmri_x[osvalidsimcalcstart : osvalidsimcalcend + 1],
188
+ lagmininpts,
189
+ lagmaxinpts,
190
+ corrout,
191
+ meanval,
192
+ nprocs=nprocs,
193
+ alwaysmultiproc=alwaysmultiproc,
194
+ oversampfactor=oversampfactor,
195
+ interptype=interptype,
196
+ showprogressbar=showprogressbar,
197
+ chunksize=chunksize,
198
+ rt_floatset=rt_floatset,
199
+ rt_floattype=rt_floattype,
200
+ debug=debug,
201
+ )
202
+ elif similaritymetric == "riptide":
203
+ # do the linear fit to the comb of delayed regressors
204
+ for thedelay in range(len(delayvals)):
205
+ print(f"Fitting delay {delayvals[thedelay]:.2f}")
206
+ voxelsprocessed_cp = tide_linfitfiltpass.linfitfiltpass(
207
+ numvalidspatiallocs,
208
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
209
+ 0.0,
210
+ regressorset[thedelay, validsimcalcstart : validsimcalcend + 1],
211
+ sLFOfitmean,
212
+ corrout[:, thedelay],
213
+ r2value,
214
+ fitcoeff,
215
+ fitNorm,
216
+ None,
217
+ None,
218
+ coefficientsonly=True,
219
+ voxelspecific=False,
220
+ nprocs=nprocs,
221
+ alwaysmultiproc=alwaysmultiproc,
222
+ showprogressbar=showprogressbar,
223
+ verbose=(LGR is not None),
224
+ chunksize=chunksize,
225
+ rt_floatset=rt_floatset,
226
+ rt_floattype=rt_floattype,
227
+ debug=debug,
228
+ )
229
+ else:
230
+ print("illegal similarity metric")
231
+
232
+ tide_util.enablemkl(mklthreads, debug=threaddebug)
233
+
234
+ if similaritymetric != "riptide":
235
+ for i in range(len(theglobalmaxlist)):
236
+ theglobalmaxlist[i] = corrscale[theglobalmaxlist[i]] - simcalcoffset
237
+ namesuffix = "_desc-globallag_hist"
238
+ tide_stats.makeandsavehistogram(
239
+ np.asarray(theglobalmaxlist),
240
+ len(corrscale),
241
+ 0,
242
+ outputname + namesuffix,
243
+ displaytitle="Histogram of lag times from global lag calculation",
244
+ therange=(corrscale[0], corrscale[-1]),
245
+ refine=False,
246
+ dictvarname="globallaghist_pass" + str(thepass),
247
+ append=(echocancel or (thepass > 1)),
248
+ thedict=optiondict,
249
+ )
250
+
251
+ if checkpoint:
252
+ outcorrarray[:, :] = 0.0
253
+ outcorrarray[validvoxels, :] = corrout[:, :]
254
+ if theinputdata.filetype == "text":
255
+ tide_io.writenpvecs(
256
+ outcorrarray.reshape(nativecorrshape),
257
+ f"{outputname}_corrout_prefit_pass" + str(thepass) + ".txt",
258
+ )
259
+ else:
260
+ savename = f"{outputname}_desc-corroutprefit_pass-" + str(thepass)
261
+ tide_io.savetonifti(outcorrarray.reshape(nativecorrshape), theheader, savename)
262
+
263
+ TimingLGR.info(
264
+ f"{similaritytype} calculation end, pass {thepass}",
265
+ {
266
+ "message2": voxelsprocessed_cp,
267
+ "message3": "voxels",
268
+ },
269
+ )
270
+
271
+ return similaritytype
@@ -20,9 +20,9 @@ import numpy as np
20
20
 
21
21
  import rapidtide.correlate as tide_corr
22
22
  import rapidtide.filter as tide_filt
23
- import rapidtide.helper_classes as tide_classes
24
23
  import rapidtide.io as tide_io
25
24
  import rapidtide.miscmath as tide_math
25
+ import rapidtide.simFuncClasses as tide_simFuncClasses
26
26
  import rapidtide.simfuncfit as tide_simfuncfit
27
27
 
28
28
 
@@ -81,7 +81,7 @@ def cleanregressor(
81
81
  dolagmod = True
82
82
  doreferencenotch = True
83
83
  if respdelete:
84
- resptracker = tide_classes.FrequencyTracker(nperseg=64)
84
+ resptracker = tide_simFuncClasses.FrequencyTracker(nperseg=64)
85
85
  thetimes, thefreqs = resptracker.track(resampref_y, oversampfreq)
86
86
  tide_io.writevec(thefreqs, f"{outputname}_peakfreaks_pass{thepass}.txt")
87
87
  resampref_y = resptracker.clean(resampref_y, oversampfreq, thetimes, thefreqs)
@@ -614,38 +614,32 @@ def delayvar(args):
614
614
  windowedfilteredregressderivratios = np.zeros(internalwinspaceshape, dtype=float)
615
615
  windoweddelayoffset = np.zeros(internalwinspaceshape, dtype=float)
616
616
  windowedclosestoffset = np.zeros(internalwinspaceshape, dtype=float)
617
+
618
+ winsLFOfitmean, winsLFOfitmean_shm = tide_util.allocarray(
619
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
620
+ )
621
+ winrvalue, winrvalue_shm = tide_util.allocarray(internalwinspaceshape, rt_outfloattype, shared=usesharedmem)
622
+ winr2value, winr2value_shm = tide_util.allocarray(internalwinspaceshape, rt_outfloattype, shared=usesharedmem)
623
+ winfitNorm, winfitNorm_shm = tide_util.allocarray(
624
+ internalwinspaceshapederivs, rt_outfloattype, shared=usesharedmem
625
+ )
626
+ winfitcoeff, winitcoeff_shm = tide_util.allocarray(
627
+ internalwinspaceshapederivs, rt_outfloattype, shared=usesharedmem
628
+ )
629
+ winmovingsignal, winmovingsignal_shm = tide_util.allocarray(
630
+ internalwinfmrishape, rt_outfloattype, shared=usesharedmem
631
+ )
632
+ winlagtc, winlagtc_shm = tide_util.allocarray(internalwinfmrishape, rt_floattype, shared=usesharedmem)
633
+ winfiltereddata, winfiltereddata_shm = tide_util.allocarray(
634
+ internalwinfmrishape, rt_outfloattype, shared=usesharedmem
635
+ )
617
636
  if usesharedmem:
618
637
  if args.debug:
619
638
  print("allocating shared memory")
620
- winsLFOfitmean, winsLFOfitmean_shm = tide_util.allocshared(
621
- internalwinspaceshape, rt_outfloatset
622
- )
623
- winrvalue, winrvalue_shm = tide_util.allocshared(internalwinspaceshape, rt_outfloatset)
624
- winr2value, winr2value_shm = tide_util.allocshared(internalwinspaceshape, rt_outfloatset)
625
- winfitNorm, winfitNorm_shm = tide_util.allocshared(
626
- internalwinspaceshapederivs, rt_outfloatset
627
- )
628
- winfitcoeff, winitcoeff_shm = tide_util.allocshared(
629
- internalwinspaceshapederivs, rt_outfloatset
630
- )
631
- winmovingsignal, winmovingsignal_shm = tide_util.allocshared(
632
- internalwinfmrishape, rt_outfloatset
633
- )
634
- winlagtc, winlagtc_shm = tide_util.allocshared(internalwinfmrishape, rt_floatset)
635
- winfiltereddata, winfiltereddata_shm = tide_util.allocshared(
636
- internalwinfmrishape, rt_outfloatset
637
- )
638
639
  else:
639
640
  if args.debug:
640
641
  print("allocating memory")
641
- winsLFOfitmean = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
642
- winrvalue = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
643
- winr2value = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
644
- winfitNorm = np.zeros(internalwinspaceshapederivs, dtype=rt_outfloattype)
645
- winfitcoeff = np.zeros(internalwinspaceshapederivs, dtype=rt_outfloattype)
646
- winmovingsignal = np.zeros(internalwinfmrishape, dtype=rt_outfloattype)
647
- winlagtc = np.zeros(internalwinfmrishape, dtype=rt_floattype)
648
- winfiltereddata = np.zeros(internalwinfmrishape, dtype=rt_outfloattype)
642
+
649
643
  if args.debug:
650
644
  print(f"wintrs={wintrs}, winskip={winskip}, numtrs={numtrs}, numwins={numwins}")
651
645
  thewindowprocoptions = therunoptions
@@ -831,7 +825,7 @@ def delayvar(args):
831
825
  sys.exit()
832
826
  print(
833
827
  f"Using {len(thefit.components_)} component(s), accounting for "
834
- + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]}% of the variance"
828
+ + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]:.2f}% of the variance"
835
829
  )
836
830
  reduceddata = thefit.inverse_transform(thefit.transform(scaledvoxels))
837
831
  # unscale the PCA cleaned data
@@ -872,44 +866,36 @@ def delayvar(args):
872
866
 
873
867
  doregress = False
874
868
  if doregress:
869
+ systemicsLFOfitmean, systemicsLFOfitmean_shm = tide_util.allocarray(
870
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
871
+ )
872
+ systemicrvalue, systemicrvalue_shm = tide_util.allocarray(
873
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
874
+ )
875
+ systemicr2value, systemicr2value_shm = tide_util.allocarray(
876
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
877
+ )
878
+ systemicfitNorm, systemicfitNorm_shm = tide_util.allocarray(
879
+ internalwinspaceshapederivs, rt_outfloattype, shared=usesharedmem
880
+ )
881
+ systemicfitcoeff, systemicitcoeff_shm = tide_util.allocarray(
882
+ internalwinspaceshapederivs, rt_outfloattype, shared=usesharedmem
883
+ )
884
+ systemicmovingsignal, systemicmovingsignal_shm = tide_util.allocarray(
885
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
886
+ )
887
+ systemiclagtc, systemiclagtc_shm = tide_util.allocarray(
888
+ internalwinspaceshape, rt_floattype, shared=usesharedmem
889
+ )
890
+ systemicfiltereddata, systemicfiltereddata_shm = tide_util.allocarray(
891
+ internalwinspaceshape, rt_outfloattype, shared=usesharedmem
892
+ )
875
893
  if usesharedmem:
876
894
  if args.debug:
877
895
  print("allocating shared memory")
878
- systemicsLFOfitmean, systemicsLFOfitmean_shm = tide_util.allocshared(
879
- internalwinspaceshape, rt_outfloatset
880
- )
881
- systemicrvalue, systemicrvalue_shm = tide_util.allocshared(
882
- internalwinspaceshape, rt_outfloatset
883
- )
884
- systemicr2value, systemicr2value_shm = tide_util.allocshared(
885
- internalwinspaceshape, rt_outfloatset
886
- )
887
- systemicfitNorm, systemicfitNorm_shm = tide_util.allocshared(
888
- internalwinspaceshapederivs, rt_outfloatset
889
- )
890
- systemicfitcoeff, systemicitcoeff_shm = tide_util.allocshared(
891
- internalwinspaceshapederivs, rt_outfloatset
892
- )
893
- systemicmovingsignal, systemicmovingsignal_shm = tide_util.allocshared(
894
- internalwinspaceshape, rt_outfloatset
895
- )
896
- systemiclagtc, systemiclagtc_shm = tide_util.allocshared(
897
- internalwinspaceshape, rt_floatset
898
- )
899
- systemicfiltereddata, systemicfiltereddata_shm = tide_util.allocshared(
900
- internalwinspaceshape, rt_outfloatset
901
- )
902
896
  else:
903
897
  if args.debug:
904
898
  print("allocating memory")
905
- systemicsLFOfitmean = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
906
- systemicrvalue = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
907
- systemicr2value = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
908
- systemicfitNorm = np.zeros(internalwinspaceshapederivs, dtype=rt_outfloattype)
909
- systemicfitcoeff = np.zeros(internalwinspaceshapederivs, dtype=rt_outfloattype)
910
- systemicmovingsignal = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
911
- systemiclagtc = np.zeros(internalwinspaceshape, dtype=rt_floattype)
912
- systemicfiltereddata = np.zeros(internalwinspaceshape, dtype=rt_outfloattype)
913
899
 
914
900
  windowlocs = np.linspace(0.0, winspace * numwins, num=numwins, endpoint=False) + skiptime
915
901
  voxelsprocessed_regressionfilt, regressorset, evset = tide_regressfrommaps.regressfrommaps(