From f75e5787bfb7945c3def78c516d176bac0477d23 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 24 Aug 2017 16:28:28 +0200 Subject: [PATCH] add spectrogram view and channel separation * show getting start hint in interpretation * add test for creating spectrogram * add spectrogram page to signal frame remove parent frame property from epic graphic view * prototype for spectrogram drawing (has performance issues) * enable yscale for spectrogram * regen file * enhance spectrogram performance by using QImage * enable y scale for spectrogram * add initial legend to spectrogram * fix colormap location * remove colormap legend * add more colormaps * make colormap configurable via ini * make colormap configurable in settings * make fft window size configurable * rescale Y on signal frame resize * adapt unittest to new api * allow y move with drag for spectrogram view * refactor painting backend * enable vertical selection in spectrogram graphic view * spectrum: fix order of y values * use fliplr for compat * add bandpass filter function * add narrowband iir filter * set lower bandwidth for test * add windowed sinc to filter class and adapt unittest * change default of hold shift to drag This way making a selection does not require a key modifier by default * add fft convolution * add performance test for fft convolution * speed up performance test * fix error for small data sets * add test for filtering channels * use astype for compatibility with old numpy versions * refactor context menu of graphic views * remove fft convolve performance test to avoid random fails on CI * fix spectrogram calculation * fix spectrogram calculation * improve stft performance * show samples in view for spectrogram and allow deeper zoom * enable zoom to selection for spectrogram * enable start end and selection infos for spectrogram selection * enable bandpass filtering from spectrogram * fix selection start end behavior for spectrogram * update spectrogram infos in start end edited * add unittest for channel separation * enhance architecture of spectrogram management * add class SpectrogramSceneManager * cache spectrogram * fix x axis orientation * move scene managers to painting * redraw on fft size update * add lod slider for spectrogram * remove unused stuff * add tooltip for lod slider * update selected bandwidth on sample rate changed * add update for gv signal on resize * fix fftshift parameter * remove xflip as this is corrected by fftshift now * remove lod slider as it leads to confusion and low lods are hard to see * clip f_low and f_high * update spectrogram images on colormap change * set loading cursor right before bandpass filtering signal * add select all action with ctrl+a to graphic views * use parameters from original signal for newly created signals * fix noise level in unittest * improve spectrogram performance by splitting image into segments * avoid division by zero * fix unittest * improve signal redraw on resize * add created signal right under original signal * adapt unittest to filtered frame created under original signal * add dialog for configure bandwidth and display default values * make bandwidth configurable * fix spectrogram scene rect for small signals * make data min and data max for spectrogram configurable * use object names for indexing settings as texts are not reliable Some OSes insert & before texts probably for shortcuts * use heuristic to choose normal or FFT convolution * suggest a filename for unsaved signals based on their name * fix subpath range calculation * use window for subpath drawing to avoid flickering colors --- src/urh/colormaps.py | 1067 +++++ .../ContinuousSendDialogController.py | 2 +- src/urh/controller/DecoderWidgetController.py | 5 +- .../FilterBandwidthDialogController.py | 66 + src/urh/controller/MainController.py | 19 +- .../controller/ModulatorDialogController.py | 4 +- src/urh/controller/OptionsController.py | 37 +- .../ProtocolSniffDialogController.py | 4 +- src/urh/controller/ReceiveDialogController.py | 2 +- src/urh/controller/SendDialogController.py | 7 +- src/urh/controller/SignalFrameController.py | 283 +- src/urh/controller/SignalTabController.py | 83 +- .../controller/SpectrumDialogController.py | 6 +- src/urh/cythonext/path_creator.cpp | 3392 ++++++++++++---- src/urh/cythonext/path_creator.pyx | 11 +- src/urh/cythonext/signalFunctions.cpp | 3601 +++++++++++++---- src/urh/cythonext/signalFunctions.pyx | 17 + .../plugins/InsertSine/InsertSinePlugin.py | 2 +- src/urh/signalprocessing/Filter.py | 99 + src/urh/signalprocessing/Modulator.py | 2 +- src/urh/signalprocessing/Signal.py | 11 +- src/urh/signalprocessing/Spectrogram.py | 163 + .../painting}/ContinuousSceneManager.py | 2 +- src/urh/{ => ui/painting}/FFTSceneManager.py | 6 +- src/urh/ui/{ => painting}/GridScene.py | 7 +- src/urh/ui/painting/HorizontalSelection.py | 46 + src/urh/ui/{ => painting}/LabeledArrow.py | 0 src/urh/ui/{ => painting}/LegendScene.py | 2 +- src/urh/{ => ui/painting}/LiveSceneManager.py | 2 +- src/urh/{ => ui/painting}/SceneManager.py | 9 +- src/urh/ui/{ROI.py => painting/Selection.py} | 100 +- .../{ => ui/painting}/SignalSceneManager.py | 3 +- .../{ => ui/painting}/SniffSceneManager.py | 2 +- src/urh/ui/painting/SpectrogramScene.py | 19 + .../ui/painting/SpectrogramSceneManager.py | 76 + src/urh/ui/painting/VerticalSelection.py | 46 + src/urh/ui/{ => painting}/ZoomableScene.py | 10 +- src/urh/ui/painting/__init__.py | 0 src/urh/ui/ui_filter_bandwidth_dialog.py | 150 + src/urh/ui/ui_options.py | 57 +- src/urh/ui/ui_signal_frame.py | 129 +- src/urh/ui/ui_tab_interpretation.py | 40 +- src/urh/ui/views/EditableGraphicView.py | 76 +- src/urh/ui/views/EpicGraphicView.py | 41 +- src/urh/ui/views/LiveGraphicView.py | 2 +- src/urh/ui/views/SelectableGraphicView.py | 140 +- src/urh/ui/views/SpectrogramGraphicView.py | 97 + .../ui/views/ZoomAndDropableGraphicView.py | 2 +- src/urh/ui/views/ZoomableGraphicView.py | 47 +- src/urh/util/Formatter.py | 2 +- src/urh/util/util.py | 4 + tests/QtTestCase.py | 3 + tests/SpectrogramTest.py | 207 + tests/data/two_channels.complex | Bin 0 -> 6400 bytes tests/test_filter.py | 26 + tests/test_filter_bandwidth_dialog.py | 21 + tests/test_send_recv_dialog_gui.py | 2 +- tests/test_spectrogram.py | 66 + ui/filter_bandwidth_dialog.ui | 268 ++ ui/options.ui | 101 +- ui/signal_frame.ui | 424 +- ui/tab_interpretation.ui | 55 +- 62 files changed, 8991 insertions(+), 2182 deletions(-) create mode 100644 src/urh/colormaps.py create mode 100644 src/urh/controller/FilterBandwidthDialogController.py create mode 100644 src/urh/signalprocessing/Spectrogram.py rename src/urh/{ => ui/painting}/ContinuousSceneManager.py (91%) rename src/urh/{ => ui/painting}/FFTSceneManager.py (93%) rename src/urh/ui/{ => painting}/GridScene.py (97%) create mode 100644 src/urh/ui/painting/HorizontalSelection.py rename src/urh/ui/{ => painting}/LabeledArrow.py (100%) rename src/urh/ui/{ => painting}/LegendScene.py (94%) rename src/urh/{ => ui/painting}/LiveSceneManager.py (84%) rename src/urh/{ => ui/painting}/SceneManager.py (94%) rename src/urh/ui/{ROI.py => painting/Selection.py} (54%) rename src/urh/{ => ui/painting}/SignalSceneManager.py (96%) rename src/urh/{ => ui/painting}/SniffSceneManager.py (93%) create mode 100644 src/urh/ui/painting/SpectrogramScene.py create mode 100644 src/urh/ui/painting/SpectrogramSceneManager.py create mode 100644 src/urh/ui/painting/VerticalSelection.py rename src/urh/ui/{ => painting}/ZoomableScene.py (87%) create mode 100644 src/urh/ui/painting/__init__.py create mode 100644 src/urh/ui/ui_filter_bandwidth_dialog.py create mode 100644 src/urh/ui/views/SpectrogramGraphicView.py create mode 100644 tests/SpectrogramTest.py create mode 100644 tests/data/two_channels.complex create mode 100644 tests/test_filter_bandwidth_dialog.py create mode 100644 tests/test_spectrogram.py create mode 100644 ui/filter_bandwidth_dialog.ui diff --git a/src/urh/colormaps.py b/src/urh/colormaps.py new file mode 100644 index 0000000000..2897e49804 --- /dev/null +++ b/src/urh/colormaps.py @@ -0,0 +1,1067 @@ +import numpy as np + +from urh import constants + +magma = [[0.001462, 0.000466, 0.013866], + [0.002258, 0.001295, 0.018331], + [0.003279, 0.002305, 0.023708], + [0.004512, 0.003490, 0.029965], + [0.005950, 0.004843, 0.037130], + [0.007588, 0.006356, 0.044973], + [0.009426, 0.008022, 0.052844], + [0.011465, 0.009828, 0.060750], + [0.013708, 0.011771, 0.068667], + [0.016156, 0.013840, 0.076603], + [0.018815, 0.016026, 0.084584], + [0.021692, 0.018320, 0.092610], + [0.024792, 0.020715, 0.100676], + [0.028123, 0.023201, 0.108787], + [0.031696, 0.025765, 0.116965], + [0.035520, 0.028397, 0.125209], + [0.039608, 0.031090, 0.133515], + [0.043830, 0.033830, 0.141886], + [0.048062, 0.036607, 0.150327], + [0.052320, 0.039407, 0.158841], + [0.056615, 0.042160, 0.167446], + [0.060949, 0.044794, 0.176129], + [0.065330, 0.047318, 0.184892], + [0.069764, 0.049726, 0.193735], + [0.074257, 0.052017, 0.202660], + [0.078815, 0.054184, 0.211667], + [0.083446, 0.056225, 0.220755], + [0.088155, 0.058133, 0.229922], + [0.092949, 0.059904, 0.239164], + [0.097833, 0.061531, 0.248477], + [0.102815, 0.063010, 0.257854], + [0.107899, 0.064335, 0.267289], + [0.113094, 0.065492, 0.276784], + [0.118405, 0.066479, 0.286321], + [0.123833, 0.067295, 0.295879], + [0.129380, 0.067935, 0.305443], + [0.135053, 0.068391, 0.315000], + [0.140858, 0.068654, 0.324538], + [0.146785, 0.068738, 0.334011], + [0.152839, 0.068637, 0.343404], + [0.159018, 0.068354, 0.352688], + [0.165308, 0.067911, 0.361816], + [0.171713, 0.067305, 0.370771], + [0.178212, 0.066576, 0.379497], + [0.184801, 0.065732, 0.387973], + [0.191460, 0.064818, 0.396152], + [0.198177, 0.063862, 0.404009], + [0.204935, 0.062907, 0.411514], + [0.211718, 0.061992, 0.418647], + [0.218512, 0.061158, 0.425392], + [0.225302, 0.060445, 0.431742], + [0.232077, 0.059889, 0.437695], + [0.238826, 0.059517, 0.443256], + [0.245543, 0.059352, 0.448436], + [0.252220, 0.059415, 0.453248], + [0.258857, 0.059706, 0.457710], + [0.265447, 0.060237, 0.461840], + [0.271994, 0.060994, 0.465660], + [0.278493, 0.061978, 0.469190], + [0.284951, 0.063168, 0.472451], + [0.291366, 0.064553, 0.475462], + [0.297740, 0.066117, 0.478243], + [0.304081, 0.067835, 0.480812], + [0.310382, 0.069702, 0.483186], + [0.316654, 0.071690, 0.485380], + [0.322899, 0.073782, 0.487408], + [0.329114, 0.075972, 0.489287], + [0.335308, 0.078236, 0.491024], + [0.341482, 0.080564, 0.492631], + [0.347636, 0.082946, 0.494121], + [0.353773, 0.085373, 0.495501], + [0.359898, 0.087831, 0.496778], + [0.366012, 0.090314, 0.497960], + [0.372116, 0.092816, 0.499053], + [0.378211, 0.095332, 0.500067], + [0.384299, 0.097855, 0.501002], + [0.390384, 0.100379, 0.501864], + [0.396467, 0.102902, 0.502658], + [0.402548, 0.105420, 0.503386], + [0.408629, 0.107930, 0.504052], + [0.414709, 0.110431, 0.504662], + [0.420791, 0.112920, 0.505215], + [0.426877, 0.115395, 0.505714], + [0.432967, 0.117855, 0.506160], + [0.439062, 0.120298, 0.506555], + [0.445163, 0.122724, 0.506901], + [0.451271, 0.125132, 0.507198], + [0.457386, 0.127522, 0.507448], + [0.463508, 0.129893, 0.507652], + [0.469640, 0.132245, 0.507809], + [0.475780, 0.134577, 0.507921], + [0.481929, 0.136891, 0.507989], + [0.488088, 0.139186, 0.508011], + [0.494258, 0.141462, 0.507988], + [0.500438, 0.143719, 0.507920], + [0.506629, 0.145958, 0.507806], + [0.512831, 0.148179, 0.507648], + [0.519045, 0.150383, 0.507443], + [0.525270, 0.152569, 0.507192], + [0.531507, 0.154739, 0.506895], + [0.537755, 0.156894, 0.506551], + [0.544015, 0.159033, 0.506159], + [0.550287, 0.161158, 0.505719], + [0.556571, 0.163269, 0.505230], + [0.562866, 0.165368, 0.504692], + [0.569172, 0.167454, 0.504105], + [0.575490, 0.169530, 0.503466], + [0.581819, 0.171596, 0.502777], + [0.588158, 0.173652, 0.502035], + [0.594508, 0.175701, 0.501241], + [0.600868, 0.177743, 0.500394], + [0.607238, 0.179779, 0.499492], + [0.613617, 0.181811, 0.498536], + [0.620005, 0.183840, 0.497524], + [0.626401, 0.185867, 0.496456], + [0.632805, 0.187893, 0.495332], + [0.639216, 0.189921, 0.494150], + [0.645633, 0.191952, 0.492910], + [0.652056, 0.193986, 0.491611], + [0.658483, 0.196027, 0.490253], + [0.664915, 0.198075, 0.488836], + [0.671349, 0.200133, 0.487358], + [0.677786, 0.202203, 0.485819], + [0.684224, 0.204286, 0.484219], + [0.690661, 0.206384, 0.482558], + [0.697098, 0.208501, 0.480835], + [0.703532, 0.210638, 0.479049], + [0.709962, 0.212797, 0.477201], + [0.716387, 0.214982, 0.475290], + [0.722805, 0.217194, 0.473316], + [0.729216, 0.219437, 0.471279], + [0.735616, 0.221713, 0.469180], + [0.742004, 0.224025, 0.467018], + [0.748378, 0.226377, 0.464794], + [0.754737, 0.228772, 0.462509], + [0.761077, 0.231214, 0.460162], + [0.767398, 0.233705, 0.457755], + [0.773695, 0.236249, 0.455289], + [0.779968, 0.238851, 0.452765], + [0.786212, 0.241514, 0.450184], + [0.792427, 0.244242, 0.447543], + [0.798608, 0.247040, 0.444848], + [0.804752, 0.249911, 0.442102], + [0.810855, 0.252861, 0.439305], + [0.816914, 0.255895, 0.436461], + [0.822926, 0.259016, 0.433573], + [0.828886, 0.262229, 0.430644], + [0.834791, 0.265540, 0.427671], + [0.840636, 0.268953, 0.424666], + [0.846416, 0.272473, 0.421631], + [0.852126, 0.276106, 0.418573], + [0.857763, 0.279857, 0.415496], + [0.863320, 0.283729, 0.412403], + [0.868793, 0.287728, 0.409303], + [0.874176, 0.291859, 0.406205], + [0.879464, 0.296125, 0.403118], + [0.884651, 0.300530, 0.400047], + [0.889731, 0.305079, 0.397002], + [0.894700, 0.309773, 0.393995], + [0.899552, 0.314616, 0.391037], + [0.904281, 0.319610, 0.388137], + [0.908884, 0.324755, 0.385308], + [0.913354, 0.330052, 0.382563], + [0.917689, 0.335500, 0.379915], + [0.921884, 0.341098, 0.377376], + [0.925937, 0.346844, 0.374959], + [0.929845, 0.352734, 0.372677], + [0.933606, 0.358764, 0.370541], + [0.937221, 0.364929, 0.368567], + [0.940687, 0.371224, 0.366762], + [0.944006, 0.377643, 0.365136], + [0.947180, 0.384178, 0.363701], + [0.950210, 0.390820, 0.362468], + [0.953099, 0.397563, 0.361438], + [0.955849, 0.404400, 0.360619], + [0.958464, 0.411324, 0.360014], + [0.960949, 0.418323, 0.359630], + [0.963310, 0.425390, 0.359469], + [0.965549, 0.432519, 0.359529], + [0.967671, 0.439703, 0.359810], + [0.969680, 0.446936, 0.360311], + [0.971582, 0.454210, 0.361030], + [0.973381, 0.461520, 0.361965], + [0.975082, 0.468861, 0.363111], + [0.976690, 0.476226, 0.364466], + [0.978210, 0.483612, 0.366025], + [0.979645, 0.491014, 0.367783], + [0.981000, 0.498428, 0.369734], + [0.982279, 0.505851, 0.371874], + [0.983485, 0.513280, 0.374198], + [0.984622, 0.520713, 0.376698], + [0.985693, 0.528148, 0.379371], + [0.986700, 0.535582, 0.382210], + [0.987646, 0.543015, 0.385210], + [0.988533, 0.550446, 0.388365], + [0.989363, 0.557873, 0.391671], + [0.990138, 0.565296, 0.395122], + [0.990871, 0.572706, 0.398714], + [0.991558, 0.580107, 0.402441], + [0.992196, 0.587502, 0.406299], + [0.992785, 0.594891, 0.410283], + [0.993326, 0.602275, 0.414390], + [0.993834, 0.609644, 0.418613], + [0.994309, 0.616999, 0.422950], + [0.994738, 0.624350, 0.427397], + [0.995122, 0.631696, 0.431951], + [0.995480, 0.639027, 0.436607], + [0.995810, 0.646344, 0.441361], + [0.996096, 0.653659, 0.446213], + [0.996341, 0.660969, 0.451160], + [0.996580, 0.668256, 0.456192], + [0.996775, 0.675541, 0.461314], + [0.996925, 0.682828, 0.466526], + [0.997077, 0.690088, 0.471811], + [0.997186, 0.697349, 0.477182], + [0.997254, 0.704611, 0.482635], + [0.997325, 0.711848, 0.488154], + [0.997351, 0.719089, 0.493755], + [0.997351, 0.726324, 0.499428], + [0.997341, 0.733545, 0.505167], + [0.997285, 0.740772, 0.510983], + [0.997228, 0.747981, 0.516859], + [0.997138, 0.755190, 0.522806], + [0.997019, 0.762398, 0.528821], + [0.996898, 0.769591, 0.534892], + [0.996727, 0.776795, 0.541039], + [0.996571, 0.783977, 0.547233], + [0.996369, 0.791167, 0.553499], + [0.996162, 0.798348, 0.559820], + [0.995932, 0.805527, 0.566202], + [0.995680, 0.812706, 0.572645], + [0.995424, 0.819875, 0.579140], + [0.995131, 0.827052, 0.585701], + [0.994851, 0.834213, 0.592307], + [0.994524, 0.841387, 0.598983], + [0.994222, 0.848540, 0.605696], + [0.993866, 0.855711, 0.612482], + [0.993545, 0.862859, 0.619299], + [0.993170, 0.870024, 0.626189], + [0.992831, 0.877168, 0.633109], + [0.992440, 0.884330, 0.640099], + [0.992089, 0.891470, 0.647116], + [0.991688, 0.898627, 0.654202], + [0.991332, 0.905763, 0.661309], + [0.990930, 0.912915, 0.668481], + [0.990570, 0.920049, 0.675675], + [0.990175, 0.927196, 0.682926], + [0.989815, 0.934329, 0.690198], + [0.989434, 0.941470, 0.697519], + [0.989077, 0.948604, 0.704863], + [0.988717, 0.955742, 0.712242], + [0.988367, 0.962878, 0.719649], + [0.988033, 0.970012, 0.727077], + [0.987691, 0.977154, 0.734536], + [0.987387, 0.984288, 0.742002], + [0.987053, 0.991438, 0.749504]] + +inferno = [[0.001462, 0.000466, 0.013866], + [0.002267, 0.001270, 0.018570], + [0.003299, 0.002249, 0.024239], + [0.004547, 0.003392, 0.030909], + [0.006006, 0.004692, 0.038558], + [0.007676, 0.006136, 0.046836], + [0.009561, 0.007713, 0.055143], + [0.011663, 0.009417, 0.063460], + [0.013995, 0.011225, 0.071862], + [0.016561, 0.013136, 0.080282], + [0.019373, 0.015133, 0.088767], + [0.022447, 0.017199, 0.097327], + [0.025793, 0.019331, 0.105930], + [0.029432, 0.021503, 0.114621], + [0.033385, 0.023702, 0.123397], + [0.037668, 0.025921, 0.132232], + [0.042253, 0.028139, 0.141141], + [0.046915, 0.030324, 0.150164], + [0.051644, 0.032474, 0.159254], + [0.056449, 0.034569, 0.168414], + [0.061340, 0.036590, 0.177642], + [0.066331, 0.038504, 0.186962], + [0.071429, 0.040294, 0.196354], + [0.076637, 0.041905, 0.205799], + [0.081962, 0.043328, 0.215289], + [0.087411, 0.044556, 0.224813], + [0.092990, 0.045583, 0.234358], + [0.098702, 0.046402, 0.243904], + [0.104551, 0.047008, 0.253430], + [0.110536, 0.047399, 0.262912], + [0.116656, 0.047574, 0.272321], + [0.122908, 0.047536, 0.281624], + [0.129285, 0.047293, 0.290788], + [0.135778, 0.046856, 0.299776], + [0.142378, 0.046242, 0.308553], + [0.149073, 0.045468, 0.317085], + [0.155850, 0.044559, 0.325338], + [0.162689, 0.043554, 0.333277], + [0.169575, 0.042489, 0.340874], + [0.176493, 0.041402, 0.348111], + [0.183429, 0.040329, 0.354971], + [0.190367, 0.039309, 0.361447], + [0.197297, 0.038400, 0.367535], + [0.204209, 0.037632, 0.373238], + [0.211095, 0.037030, 0.378563], + [0.217949, 0.036615, 0.383522], + [0.224763, 0.036405, 0.388129], + [0.231538, 0.036405, 0.392400], + [0.238273, 0.036621, 0.396353], + [0.244967, 0.037055, 0.400007], + [0.251620, 0.037705, 0.403378], + [0.258234, 0.038571, 0.406485], + [0.264810, 0.039647, 0.409345], + [0.271347, 0.040922, 0.411976], + [0.277850, 0.042353, 0.414392], + [0.284321, 0.043933, 0.416608], + [0.290763, 0.045644, 0.418637], + [0.297178, 0.047470, 0.420491], + [0.303568, 0.049396, 0.422182], + [0.309935, 0.051407, 0.423721], + [0.316282, 0.053490, 0.425116], + [0.322610, 0.055634, 0.426377], + [0.328921, 0.057827, 0.427511], + [0.335217, 0.060060, 0.428524], + [0.341500, 0.062325, 0.429425], + [0.347771, 0.064616, 0.430217], + [0.354032, 0.066925, 0.430906], + [0.360284, 0.069247, 0.431497], + [0.366529, 0.071579, 0.431994], + [0.372768, 0.073915, 0.432400], + [0.379001, 0.076253, 0.432719], + [0.385228, 0.078591, 0.432955], + [0.391453, 0.080927, 0.433109], + [0.397674, 0.083257, 0.433183], + [0.403894, 0.085580, 0.433179], + [0.410113, 0.087896, 0.433098], + [0.416331, 0.090203, 0.432943], + [0.422549, 0.092501, 0.432714], + [0.428768, 0.094790, 0.432412], + [0.434987, 0.097069, 0.432039], + [0.441207, 0.099338, 0.431594], + [0.447428, 0.101597, 0.431080], + [0.453651, 0.103848, 0.430498], + [0.459875, 0.106089, 0.429846], + [0.466100, 0.108322, 0.429125], + [0.472328, 0.110547, 0.428334], + [0.478558, 0.112764, 0.427475], + [0.484789, 0.114974, 0.426548], + [0.491022, 0.117179, 0.425552], + [0.497257, 0.119379, 0.424488], + [0.503493, 0.121575, 0.423356], + [0.509730, 0.123769, 0.422156], + [0.515967, 0.125960, 0.420887], + [0.522206, 0.128150, 0.419549], + [0.528444, 0.130341, 0.418142], + [0.534683, 0.132534, 0.416667], + [0.540920, 0.134729, 0.415123], + [0.547157, 0.136929, 0.413511], + [0.553392, 0.139134, 0.411829], + [0.559624, 0.141346, 0.410078], + [0.565854, 0.143567, 0.408258], + [0.572081, 0.145797, 0.406369], + [0.578304, 0.148039, 0.404411], + [0.584521, 0.150294, 0.402385], + [0.590734, 0.152563, 0.400290], + [0.596940, 0.154848, 0.398125], + [0.603139, 0.157151, 0.395891], + [0.609330, 0.159474, 0.393589], + [0.615513, 0.161817, 0.391219], + [0.621685, 0.164184, 0.388781], + [0.627847, 0.166575, 0.386276], + [0.633998, 0.168992, 0.383704], + [0.640135, 0.171438, 0.381065], + [0.646260, 0.173914, 0.378359], + [0.652369, 0.176421, 0.375586], + [0.658463, 0.178962, 0.372748], + [0.664540, 0.181539, 0.369846], + [0.670599, 0.184153, 0.366879], + [0.676638, 0.186807, 0.363849], + [0.682656, 0.189501, 0.360757], + [0.688653, 0.192239, 0.357603], + [0.694627, 0.195021, 0.354388], + [0.700576, 0.197851, 0.351113], + [0.706500, 0.200728, 0.347777], + [0.712396, 0.203656, 0.344383], + [0.718264, 0.206636, 0.340931], + [0.724103, 0.209670, 0.337424], + [0.729909, 0.212759, 0.333861], + [0.735683, 0.215906, 0.330245], + [0.741423, 0.219112, 0.326576], + [0.747127, 0.222378, 0.322856], + [0.752794, 0.225706, 0.319085], + [0.758422, 0.229097, 0.315266], + [0.764010, 0.232554, 0.311399], + [0.769556, 0.236077, 0.307485], + [0.775059, 0.239667, 0.303526], + [0.780517, 0.243327, 0.299523], + [0.785929, 0.247056, 0.295477], + [0.791293, 0.250856, 0.291390], + [0.796607, 0.254728, 0.287264], + [0.801871, 0.258674, 0.283099], + [0.807082, 0.262692, 0.278898], + [0.812239, 0.266786, 0.274661], + [0.817341, 0.270954, 0.270390], + [0.822386, 0.275197, 0.266085], + [0.827372, 0.279517, 0.261750], + [0.832299, 0.283913, 0.257383], + [0.837165, 0.288385, 0.252988], + [0.841969, 0.292933, 0.248564], + [0.846709, 0.297559, 0.244113], + [0.851384, 0.302260, 0.239636], + [0.855992, 0.307038, 0.235133], + [0.860533, 0.311892, 0.230606], + [0.865006, 0.316822, 0.226055], + [0.869409, 0.321827, 0.221482], + [0.873741, 0.326906, 0.216886], + [0.878001, 0.332060, 0.212268], + [0.882188, 0.337287, 0.207628], + [0.886302, 0.342586, 0.202968], + [0.890341, 0.347957, 0.198286], + [0.894305, 0.353399, 0.193584], + [0.898192, 0.358911, 0.188860], + [0.902003, 0.364492, 0.184116], + [0.905735, 0.370140, 0.179350], + [0.909390, 0.375856, 0.174563], + [0.912966, 0.381636, 0.169755], + [0.916462, 0.387481, 0.164924], + [0.919879, 0.393389, 0.160070], + [0.923215, 0.399359, 0.155193], + [0.926470, 0.405389, 0.150292], + [0.929644, 0.411479, 0.145367], + [0.932737, 0.417627, 0.140417], + [0.935747, 0.423831, 0.135440], + [0.938675, 0.430091, 0.130438], + [0.941521, 0.436405, 0.125409], + [0.944285, 0.442772, 0.120354], + [0.946965, 0.449191, 0.115272], + [0.949562, 0.455660, 0.110164], + [0.952075, 0.462178, 0.105031], + [0.954506, 0.468744, 0.099874], + [0.956852, 0.475356, 0.094695], + [0.959114, 0.482014, 0.089499], + [0.961293, 0.488716, 0.084289], + [0.963387, 0.495462, 0.079073], + [0.965397, 0.502249, 0.073859], + [0.967322, 0.509078, 0.068659], + [0.969163, 0.515946, 0.063488], + [0.970919, 0.522853, 0.058367], + [0.972590, 0.529798, 0.053324], + [0.974176, 0.536780, 0.048392], + [0.975677, 0.543798, 0.043618], + [0.977092, 0.550850, 0.039050], + [0.978422, 0.557937, 0.034931], + [0.979666, 0.565057, 0.031409], + [0.980824, 0.572209, 0.028508], + [0.981895, 0.579392, 0.026250], + [0.982881, 0.586606, 0.024661], + [0.983779, 0.593849, 0.023770], + [0.984591, 0.601122, 0.023606], + [0.985315, 0.608422, 0.024202], + [0.985952, 0.615750, 0.025592], + [0.986502, 0.623105, 0.027814], + [0.986964, 0.630485, 0.030908], + [0.987337, 0.637890, 0.034916], + [0.987622, 0.645320, 0.039886], + [0.987819, 0.652773, 0.045581], + [0.987926, 0.660250, 0.051750], + [0.987945, 0.667748, 0.058329], + [0.987874, 0.675267, 0.065257], + [0.987714, 0.682807, 0.072489], + [0.987464, 0.690366, 0.079990], + [0.987124, 0.697944, 0.087731], + [0.986694, 0.705540, 0.095694], + [0.986175, 0.713153, 0.103863], + [0.985566, 0.720782, 0.112229], + [0.984865, 0.728427, 0.120785], + [0.984075, 0.736087, 0.129527], + [0.983196, 0.743758, 0.138453], + [0.982228, 0.751442, 0.147565], + [0.981173, 0.759135, 0.156863], + [0.980032, 0.766837, 0.166353], + [0.978806, 0.774545, 0.176037], + [0.977497, 0.782258, 0.185923], + [0.976108, 0.789974, 0.196018], + [0.974638, 0.797692, 0.206332], + [0.973088, 0.805409, 0.216877], + [0.971468, 0.813122, 0.227658], + [0.969783, 0.820825, 0.238686], + [0.968041, 0.828515, 0.249972], + [0.966243, 0.836191, 0.261534], + [0.964394, 0.843848, 0.273391], + [0.962517, 0.851476, 0.285546], + [0.960626, 0.859069, 0.298010], + [0.958720, 0.866624, 0.310820], + [0.956834, 0.874129, 0.323974], + [0.954997, 0.881569, 0.337475], + [0.953215, 0.888942, 0.351369], + [0.951546, 0.896226, 0.365627], + [0.950018, 0.903409, 0.380271], + [0.948683, 0.910473, 0.395289], + [0.947594, 0.917399, 0.410665], + [0.946809, 0.924168, 0.426373], + [0.946392, 0.930761, 0.442367], + [0.946403, 0.937159, 0.458592], + [0.946903, 0.943348, 0.474970], + [0.947937, 0.949318, 0.491426], + [0.949545, 0.955063, 0.507860], + [0.951740, 0.960587, 0.524203], + [0.954529, 0.965896, 0.540361], + [0.957896, 0.971003, 0.556275], + [0.961812, 0.975924, 0.571925], + [0.966249, 0.980678, 0.587206], + [0.971162, 0.985282, 0.602154], + [0.976511, 0.989753, 0.616760], + [0.982257, 0.994109, 0.631017], + [0.988362, 0.998364, 0.644924]] + +plasma = [[0.050383, 0.029803, 0.527975], + [0.063536, 0.028426, 0.533124], + [0.075353, 0.027206, 0.538007], + [0.086222, 0.026125, 0.542658], + [0.096379, 0.025165, 0.547103], + [0.105980, 0.024309, 0.551368], + [0.115124, 0.023556, 0.555468], + [0.123903, 0.022878, 0.559423], + [0.132381, 0.022258, 0.563250], + [0.140603, 0.021687, 0.566959], + [0.148607, 0.021154, 0.570562], + [0.156421, 0.020651, 0.574065], + [0.164070, 0.020171, 0.577478], + [0.171574, 0.019706, 0.580806], + [0.178950, 0.019252, 0.584054], + [0.186213, 0.018803, 0.587228], + [0.193374, 0.018354, 0.590330], + [0.200445, 0.017902, 0.593364], + [0.207435, 0.017442, 0.596333], + [0.214350, 0.016973, 0.599239], + [0.221197, 0.016497, 0.602083], + [0.227983, 0.016007, 0.604867], + [0.234715, 0.015502, 0.607592], + [0.241396, 0.014979, 0.610259], + [0.248032, 0.014439, 0.612868], + [0.254627, 0.013882, 0.615419], + [0.261183, 0.013308, 0.617911], + [0.267703, 0.012716, 0.620346], + [0.274191, 0.012109, 0.622722], + [0.280648, 0.011488, 0.625038], + [0.287076, 0.010855, 0.627295], + [0.293478, 0.010213, 0.629490], + [0.299855, 0.009561, 0.631624], + [0.306210, 0.008902, 0.633694], + [0.312543, 0.008239, 0.635700], + [0.318856, 0.007576, 0.637640], + [0.325150, 0.006915, 0.639512], + [0.331426, 0.006261, 0.641316], + [0.337683, 0.005618, 0.643049], + [0.343925, 0.004991, 0.644710], + [0.350150, 0.004382, 0.646298], + [0.356359, 0.003798, 0.647810], + [0.362553, 0.003243, 0.649245], + [0.368733, 0.002724, 0.650601], + [0.374897, 0.002245, 0.651876], + [0.381047, 0.001814, 0.653068], + [0.387183, 0.001434, 0.654177], + [0.393304, 0.001114, 0.655199], + [0.399411, 0.000859, 0.656133], + [0.405503, 0.000678, 0.656977], + [0.411580, 0.000577, 0.657730], + [0.417642, 0.000564, 0.658390], + [0.423689, 0.000646, 0.658956], + [0.429719, 0.000831, 0.659425], + [0.435734, 0.001127, 0.659797], + [0.441732, 0.001540, 0.660069], + [0.447714, 0.002080, 0.660240], + [0.453677, 0.002755, 0.660310], + [0.459623, 0.003574, 0.660277], + [0.465550, 0.004545, 0.660139], + [0.471457, 0.005678, 0.659897], + [0.477344, 0.006980, 0.659549], + [0.483210, 0.008460, 0.659095], + [0.489055, 0.010127, 0.658534], + [0.494877, 0.011990, 0.657865], + [0.500678, 0.014055, 0.657088], + [0.506454, 0.016333, 0.656202], + [0.512206, 0.018833, 0.655209], + [0.517933, 0.021563, 0.654109], + [0.523633, 0.024532, 0.652901], + [0.529306, 0.027747, 0.651586], + [0.534952, 0.031217, 0.650165], + [0.540570, 0.034950, 0.648640], + [0.546157, 0.038954, 0.647010], + [0.551715, 0.043136, 0.645277], + [0.557243, 0.047331, 0.643443], + [0.562738, 0.051545, 0.641509], + [0.568201, 0.055778, 0.639477], + [0.573632, 0.060028, 0.637349], + [0.579029, 0.064296, 0.635126], + [0.584391, 0.068579, 0.632812], + [0.589719, 0.072878, 0.630408], + [0.595011, 0.077190, 0.627917], + [0.600266, 0.081516, 0.625342], + [0.605485, 0.085854, 0.622686], + [0.610667, 0.090204, 0.619951], + [0.615812, 0.094564, 0.617140], + [0.620919, 0.098934, 0.614257], + [0.625987, 0.103312, 0.611305], + [0.631017, 0.107699, 0.608287], + [0.636008, 0.112092, 0.605205], + [0.640959, 0.116492, 0.602065], + [0.645872, 0.120898, 0.598867], + [0.650746, 0.125309, 0.595617], + [0.655580, 0.129725, 0.592317], + [0.660374, 0.134144, 0.588971], + [0.665129, 0.138566, 0.585582], + [0.669845, 0.142992, 0.582154], + [0.674522, 0.147419, 0.578688], + [0.679160, 0.151848, 0.575189], + [0.683758, 0.156278, 0.571660], + [0.688318, 0.160709, 0.568103], + [0.692840, 0.165141, 0.564522], + [0.697324, 0.169573, 0.560919], + [0.701769, 0.174005, 0.557296], + [0.706178, 0.178437, 0.553657], + [0.710549, 0.182868, 0.550004], + [0.714883, 0.187299, 0.546338], + [0.719181, 0.191729, 0.542663], + [0.723444, 0.196158, 0.538981], + [0.727670, 0.200586, 0.535293], + [0.731862, 0.205013, 0.531601], + [0.736019, 0.209439, 0.527908], + [0.740143, 0.213864, 0.524216], + [0.744232, 0.218288, 0.520524], + [0.748289, 0.222711, 0.516834], + [0.752312, 0.227133, 0.513149], + [0.756304, 0.231555, 0.509468], + [0.760264, 0.235976, 0.505794], + [0.764193, 0.240396, 0.502126], + [0.768090, 0.244817, 0.498465], + [0.771958, 0.249237, 0.494813], + [0.775796, 0.253658, 0.491171], + [0.779604, 0.258078, 0.487539], + [0.783383, 0.262500, 0.483918], + [0.787133, 0.266922, 0.480307], + [0.790855, 0.271345, 0.476706], + [0.794549, 0.275770, 0.473117], + [0.798216, 0.280197, 0.469538], + [0.801855, 0.284626, 0.465971], + [0.805467, 0.289057, 0.462415], + [0.809052, 0.293491, 0.458870], + [0.812612, 0.297928, 0.455338], + [0.816144, 0.302368, 0.451816], + [0.819651, 0.306812, 0.448306], + [0.823132, 0.311261, 0.444806], + [0.826588, 0.315714, 0.441316], + [0.830018, 0.320172, 0.437836], + [0.833422, 0.324635, 0.434366], + [0.836801, 0.329105, 0.430905], + [0.840155, 0.333580, 0.427455], + [0.843484, 0.338062, 0.424013], + [0.846788, 0.342551, 0.420579], + [0.850066, 0.347048, 0.417153], + [0.853319, 0.351553, 0.413734], + [0.856547, 0.356066, 0.410322], + [0.859750, 0.360588, 0.406917], + [0.862927, 0.365119, 0.403519], + [0.866078, 0.369660, 0.400126], + [0.869203, 0.374212, 0.396738], + [0.872303, 0.378774, 0.393355], + [0.875376, 0.383347, 0.389976], + [0.878423, 0.387932, 0.386600], + [0.881443, 0.392529, 0.383229], + [0.884436, 0.397139, 0.379860], + [0.887402, 0.401762, 0.376494], + [0.890340, 0.406398, 0.373130], + [0.893250, 0.411048, 0.369768], + [0.896131, 0.415712, 0.366407], + [0.898984, 0.420392, 0.363047], + [0.901807, 0.425087, 0.359688], + [0.904601, 0.429797, 0.356329], + [0.907365, 0.434524, 0.352970], + [0.910098, 0.439268, 0.349610], + [0.912800, 0.444029, 0.346251], + [0.915471, 0.448807, 0.342890], + [0.918109, 0.453603, 0.339529], + [0.920714, 0.458417, 0.336166], + [0.923287, 0.463251, 0.332801], + [0.925825, 0.468103, 0.329435], + [0.928329, 0.472975, 0.326067], + [0.930798, 0.477867, 0.322697], + [0.933232, 0.482780, 0.319325], + [0.935630, 0.487712, 0.315952], + [0.937990, 0.492667, 0.312575], + [0.940313, 0.497642, 0.309197], + [0.942598, 0.502639, 0.305816], + [0.944844, 0.507658, 0.302433], + [0.947051, 0.512699, 0.299049], + [0.949217, 0.517763, 0.295662], + [0.951344, 0.522850, 0.292275], + [0.953428, 0.527960, 0.288883], + [0.955470, 0.533093, 0.285490], + [0.957469, 0.538250, 0.282096], + [0.959424, 0.543431, 0.278701], + [0.961336, 0.548636, 0.275305], + [0.963203, 0.553865, 0.271909], + [0.965024, 0.559118, 0.268513], + [0.966798, 0.564396, 0.265118], + [0.968526, 0.569700, 0.261721], + [0.970205, 0.575028, 0.258325], + [0.971835, 0.580382, 0.254931], + [0.973416, 0.585761, 0.251540], + [0.974947, 0.591165, 0.248151], + [0.976428, 0.596595, 0.244767], + [0.977856, 0.602051, 0.241387], + [0.979233, 0.607532, 0.238013], + [0.980556, 0.613039, 0.234646], + [0.981826, 0.618572, 0.231287], + [0.983041, 0.624131, 0.227937], + [0.984199, 0.629718, 0.224595], + [0.985301, 0.635330, 0.221265], + [0.986345, 0.640969, 0.217948], + [0.987332, 0.646633, 0.214648], + [0.988260, 0.652325, 0.211364], + [0.989128, 0.658043, 0.208100], + [0.989935, 0.663787, 0.204859], + [0.990681, 0.669558, 0.201642], + [0.991365, 0.675355, 0.198453], + [0.991985, 0.681179, 0.195295], + [0.992541, 0.687030, 0.192170], + [0.993032, 0.692907, 0.189084], + [0.993456, 0.698810, 0.186041], + [0.993814, 0.704741, 0.183043], + [0.994103, 0.710698, 0.180097], + [0.994324, 0.716681, 0.177208], + [0.994474, 0.722691, 0.174381], + [0.994553, 0.728728, 0.171622], + [0.994561, 0.734791, 0.168938], + [0.994495, 0.740880, 0.166335], + [0.994355, 0.746995, 0.163821], + [0.994141, 0.753137, 0.161404], + [0.993851, 0.759304, 0.159092], + [0.993482, 0.765499, 0.156891], + [0.993033, 0.771720, 0.154808], + [0.992505, 0.777967, 0.152855], + [0.991897, 0.784239, 0.151042], + [0.991209, 0.790537, 0.149377], + [0.990439, 0.796859, 0.147870], + [0.989587, 0.803205, 0.146529], + [0.988648, 0.809579, 0.145357], + [0.987621, 0.815978, 0.144363], + [0.986509, 0.822401, 0.143557], + [0.985314, 0.828846, 0.142945], + [0.984031, 0.835315, 0.142528], + [0.982653, 0.841812, 0.142303], + [0.981190, 0.848329, 0.142279], + [0.979644, 0.854866, 0.142453], + [0.977995, 0.861432, 0.142808], + [0.976265, 0.868016, 0.143351], + [0.974443, 0.874622, 0.144061], + [0.972530, 0.881250, 0.144923], + [0.970533, 0.887896, 0.145919], + [0.968443, 0.894564, 0.147014], + [0.966271, 0.901249, 0.148180], + [0.964021, 0.907950, 0.149370], + [0.961681, 0.914672, 0.150520], + [0.959276, 0.921407, 0.151566], + [0.956808, 0.928152, 0.152409], + [0.954287, 0.934908, 0.152921], + [0.951726, 0.941671, 0.152925], + [0.949151, 0.948435, 0.152178], + [0.946602, 0.955190, 0.150328], + [0.944152, 0.961916, 0.146861], + [0.941896, 0.968590, 0.140956], + [0.940015, 0.975158, 0.131326]] + +viridis = [[0.267004, 0.004874, 0.329415], + [0.268510, 0.009605, 0.335427], + [0.269944, 0.014625, 0.341379], + [0.271305, 0.019942, 0.347269], + [0.272594, 0.025563, 0.353093], + [0.273809, 0.031497, 0.358853], + [0.274952, 0.037752, 0.364543], + [0.276022, 0.044167, 0.370164], + [0.277018, 0.050344, 0.375715], + [0.277941, 0.056324, 0.381191], + [0.278791, 0.062145, 0.386592], + [0.279566, 0.067836, 0.391917], + [0.280267, 0.073417, 0.397163], + [0.280894, 0.078907, 0.402329], + [0.281446, 0.084320, 0.407414], + [0.281924, 0.089666, 0.412415], + [0.282327, 0.094955, 0.417331], + [0.282656, 0.100196, 0.422160], + [0.282910, 0.105393, 0.426902], + [0.283091, 0.110553, 0.431554], + [0.283197, 0.115680, 0.436115], + [0.283229, 0.120777, 0.440584], + [0.283187, 0.125848, 0.444960], + [0.283072, 0.130895, 0.449241], + [0.282884, 0.135920, 0.453427], + [0.282623, 0.140926, 0.457517], + [0.282290, 0.145912, 0.461510], + [0.281887, 0.150881, 0.465405], + [0.281412, 0.155834, 0.469201], + [0.280868, 0.160771, 0.472899], + [0.280255, 0.165693, 0.476498], + [0.279574, 0.170599, 0.479997], + [0.278826, 0.175490, 0.483397], + [0.278012, 0.180367, 0.486697], + [0.277134, 0.185228, 0.489898], + [0.276194, 0.190074, 0.493001], + [0.275191, 0.194905, 0.496005], + [0.274128, 0.199721, 0.498911], + [0.273006, 0.204520, 0.501721], + [0.271828, 0.209303, 0.504434], + [0.270595, 0.214069, 0.507052], + [0.269308, 0.218818, 0.509577], + [0.267968, 0.223549, 0.512008], + [0.266580, 0.228262, 0.514349], + [0.265145, 0.232956, 0.516599], + [0.263663, 0.237631, 0.518762], + [0.262138, 0.242286, 0.520837], + [0.260571, 0.246922, 0.522828], + [0.258965, 0.251537, 0.524736], + [0.257322, 0.256130, 0.526563], + [0.255645, 0.260703, 0.528312], + [0.253935, 0.265254, 0.529983], + [0.252194, 0.269783, 0.531579], + [0.250425, 0.274290, 0.533103], + [0.248629, 0.278775, 0.534556], + [0.246811, 0.283237, 0.535941], + [0.244972, 0.287675, 0.537260], + [0.243113, 0.292092, 0.538516], + [0.241237, 0.296485, 0.539709], + [0.239346, 0.300855, 0.540844], + [0.237441, 0.305202, 0.541921], + [0.235526, 0.309527, 0.542944], + [0.233603, 0.313828, 0.543914], + [0.231674, 0.318106, 0.544834], + [0.229739, 0.322361, 0.545706], + [0.227802, 0.326594, 0.546532], + [0.225863, 0.330805, 0.547314], + [0.223925, 0.334994, 0.548053], + [0.221989, 0.339161, 0.548752], + [0.220057, 0.343307, 0.549413], + [0.218130, 0.347432, 0.550038], + [0.216210, 0.351535, 0.550627], + [0.214298, 0.355619, 0.551184], + [0.212395, 0.359683, 0.551710], + [0.210503, 0.363727, 0.552206], + [0.208623, 0.367752, 0.552675], + [0.206756, 0.371758, 0.553117], + [0.204903, 0.375746, 0.553533], + [0.203063, 0.379716, 0.553925], + [0.201239, 0.383670, 0.554294], + [0.199430, 0.387607, 0.554642], + [0.197636, 0.391528, 0.554969], + [0.195860, 0.395433, 0.555276], + [0.194100, 0.399323, 0.555565], + [0.192357, 0.403199, 0.555836], + [0.190631, 0.407061, 0.556089], + [0.188923, 0.410910, 0.556326], + [0.187231, 0.414746, 0.556547], + [0.185556, 0.418570, 0.556753], + [0.183898, 0.422383, 0.556944], + [0.182256, 0.426184, 0.557120], + [0.180629, 0.429975, 0.557282], + [0.179019, 0.433756, 0.557430], + [0.177423, 0.437527, 0.557565], + [0.175841, 0.441290, 0.557685], + [0.174274, 0.445044, 0.557792], + [0.172719, 0.448791, 0.557885], + [0.171176, 0.452530, 0.557965], + [0.169646, 0.456262, 0.558030], + [0.168126, 0.459988, 0.558082], + [0.166617, 0.463708, 0.558119], + [0.165117, 0.467423, 0.558141], + [0.163625, 0.471133, 0.558148], + [0.162142, 0.474838, 0.558140], + [0.160665, 0.478540, 0.558115], + [0.159194, 0.482237, 0.558073], + [0.157729, 0.485932, 0.558013], + [0.156270, 0.489624, 0.557936], + [0.154815, 0.493313, 0.557840], + [0.153364, 0.497000, 0.557724], + [0.151918, 0.500685, 0.557587], + [0.150476, 0.504369, 0.557430], + [0.149039, 0.508051, 0.557250], + [0.147607, 0.511733, 0.557049], + [0.146180, 0.515413, 0.556823], + [0.144759, 0.519093, 0.556572], + [0.143343, 0.522773, 0.556295], + [0.141935, 0.526453, 0.555991], + [0.140536, 0.530132, 0.555659], + [0.139147, 0.533812, 0.555298], + [0.137770, 0.537492, 0.554906], + [0.136408, 0.541173, 0.554483], + [0.135066, 0.544853, 0.554029], + [0.133743, 0.548535, 0.553541], + [0.132444, 0.552216, 0.553018], + [0.131172, 0.555899, 0.552459], + [0.129933, 0.559582, 0.551864], + [0.128729, 0.563265, 0.551229], + [0.127568, 0.566949, 0.550556], + [0.126453, 0.570633, 0.549841], + [0.125394, 0.574318, 0.549086], + [0.124395, 0.578002, 0.548287], + [0.123463, 0.581687, 0.547445], + [0.122606, 0.585371, 0.546557], + [0.121831, 0.589055, 0.545623], + [0.121148, 0.592739, 0.544641], + [0.120565, 0.596422, 0.543611], + [0.120092, 0.600104, 0.542530], + [0.119738, 0.603785, 0.541400], + [0.119512, 0.607464, 0.540218], + [0.119423, 0.611141, 0.538982], + [0.119483, 0.614817, 0.537692], + [0.119699, 0.618490, 0.536347], + [0.120081, 0.622161, 0.534946], + [0.120638, 0.625828, 0.533488], + [0.121380, 0.629492, 0.531973], + [0.122312, 0.633153, 0.530398], + [0.123444, 0.636809, 0.528763], + [0.124780, 0.640461, 0.527068], + [0.126326, 0.644107, 0.525311], + [0.128087, 0.647749, 0.523491], + [0.130067, 0.651384, 0.521608], + [0.132268, 0.655014, 0.519661], + [0.134692, 0.658636, 0.517649], + [0.137339, 0.662252, 0.515571], + [0.140210, 0.665859, 0.513427], + [0.143303, 0.669459, 0.511215], + [0.146616, 0.673050, 0.508936], + [0.150148, 0.676631, 0.506589], + [0.153894, 0.680203, 0.504172], + [0.157851, 0.683765, 0.501686], + [0.162016, 0.687316, 0.499129], + [0.166383, 0.690856, 0.496502], + [0.170948, 0.694384, 0.493803], + [0.175707, 0.697900, 0.491033], + [0.180653, 0.701402, 0.488189], + [0.185783, 0.704891, 0.485273], + [0.191090, 0.708366, 0.482284], + [0.196571, 0.711827, 0.479221], + [0.202219, 0.715272, 0.476084], + [0.208030, 0.718701, 0.472873], + [0.214000, 0.722114, 0.469588], + [0.220124, 0.725509, 0.466226], + [0.226397, 0.728888, 0.462789], + [0.232815, 0.732247, 0.459277], + [0.239374, 0.735588, 0.455688], + [0.246070, 0.738910, 0.452024], + [0.252899, 0.742211, 0.448284], + [0.259857, 0.745492, 0.444467], + [0.266941, 0.748751, 0.440573], + [0.274149, 0.751988, 0.436601], + [0.281477, 0.755203, 0.432552], + [0.288921, 0.758394, 0.428426], + [0.296479, 0.761561, 0.424223], + [0.304148, 0.764704, 0.419943], + [0.311925, 0.767822, 0.415586], + [0.319809, 0.770914, 0.411152], + [0.327796, 0.773980, 0.406640], + [0.335885, 0.777018, 0.402049], + [0.344074, 0.780029, 0.397381], + [0.352360, 0.783011, 0.392636], + [0.360741, 0.785964, 0.387814], + [0.369214, 0.788888, 0.382914], + [0.377779, 0.791781, 0.377939], + [0.386433, 0.794644, 0.372886], + [0.395174, 0.797475, 0.367757], + [0.404001, 0.800275, 0.362552], + [0.412913, 0.803041, 0.357269], + [0.421908, 0.805774, 0.351910], + [0.430983, 0.808473, 0.346476], + [0.440137, 0.811138, 0.340967], + [0.449368, 0.813768, 0.335384], + [0.458674, 0.816363, 0.329727], + [0.468053, 0.818921, 0.323998], + [0.477504, 0.821444, 0.318195], + [0.487026, 0.823929, 0.312321], + [0.496615, 0.826376, 0.306377], + [0.506271, 0.828786, 0.300362], + [0.515992, 0.831158, 0.294279], + [0.525776, 0.833491, 0.288127], + [0.535621, 0.835785, 0.281908], + [0.545524, 0.838039, 0.275626], + [0.555484, 0.840254, 0.269281], + [0.565498, 0.842430, 0.262877], + [0.575563, 0.844566, 0.256415], + [0.585678, 0.846661, 0.249897], + [0.595839, 0.848717, 0.243329], + [0.606045, 0.850733, 0.236712], + [0.616293, 0.852709, 0.230052], + [0.626579, 0.854645, 0.223353], + [0.636902, 0.856542, 0.216620], + [0.647257, 0.858400, 0.209861], + [0.657642, 0.860219, 0.203082], + [0.668054, 0.861999, 0.196293], + [0.678489, 0.863742, 0.189503], + [0.688944, 0.865448, 0.182725], + [0.699415, 0.867117, 0.175971], + [0.709898, 0.868751, 0.169257], + [0.720391, 0.870350, 0.162603], + [0.730889, 0.871916, 0.156029], + [0.741388, 0.873449, 0.149561], + [0.751884, 0.874951, 0.143228], + [0.762373, 0.876424, 0.137064], + [0.772852, 0.877868, 0.131109], + [0.783315, 0.879285, 0.125405], + [0.793760, 0.880678, 0.120005], + [0.804182, 0.882046, 0.114965], + [0.814576, 0.883393, 0.110347], + [0.824940, 0.884720, 0.106217], + [0.835270, 0.886029, 0.102646], + [0.845561, 0.887322, 0.099702], + [0.855810, 0.888601, 0.097452], + [0.866013, 0.889868, 0.095953], + [0.876168, 0.891125, 0.095250], + [0.886271, 0.892374, 0.095374], + [0.896320, 0.893616, 0.096335], + [0.906311, 0.894855, 0.098125], + [0.916242, 0.896091, 0.100717], + [0.926106, 0.897330, 0.104071], + [0.935904, 0.898570, 0.108131], + [0.945636, 0.899815, 0.112838], + [0.955300, 0.901065, 0.118128], + [0.964894, 0.902323, 0.123941], + [0.974417, 0.903590, 0.130215], + [0.983868, 0.904867, 0.136897], + [0.993248, 0.906157, 0.143936]] + +default_colormap = "plasma" + +maps = {"magma": magma, "inferno": inferno, "plasma": plasma, "viridis": viridis} + +chosen_colormap = None +chosen_colormap_numpy_bgra = None + + +def read_selected_colormap_name_from_settings() -> str: + selected = constants.SETTINGS.value("spectrogram_colormap", defaultValue=default_colormap, type=str) + if selected not in maps.keys(): + selected = default_colormap + return selected + + +def write_selected_colormap_to_settings(colormap_name: str): + constants.SETTINGS.setValue("spectrogram_colormap", colormap_name) + + +def choose_colormap(name: str): + global chosen_colormap, chosen_colormap_numpy_bgra + chosen_colormap = maps.get(name, maps[default_colormap]) + chosen_colormap_numpy_bgra = calculate_numpy_brga_for(name) + + +def calculate_numpy_brga_for(name: str) -> np.ndarray: + colormap = maps.get(name, maps[default_colormap]) + result = np.zeros((len(colormap), 4), dtype=np.ubyte) + for i, color in enumerate(colormap): + result[i] = (int(255 * color[2]), int(255 * color[1]), int(255 * color[0]), 255) + + return result + + +choose_colormap(read_selected_colormap_name_from_settings()) diff --git a/src/urh/controller/ContinuousSendDialogController.py b/src/urh/controller/ContinuousSendDialogController.py index 1d87a8cd38..62dbe17dbc 100644 --- a/src/urh/controller/ContinuousSendDialogController.py +++ b/src/urh/controller/ContinuousSendDialogController.py @@ -1,11 +1,11 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtGui import QCloseEvent -from urh.ContinuousSceneManager import ContinuousSceneManager from urh.controller.SendDialogController import SendDialogController from urh.controller.SendRecvDialogController import SendRecvDialogController from urh.dev.VirtualDevice import VirtualDevice, Mode from urh.signalprocessing.ContinuousModulator import ContinuousModulator +from urh.ui.painting.ContinuousSceneManager import ContinuousSceneManager class ContinuousSendDialogController(SendDialogController): diff --git a/src/urh/controller/DecoderWidgetController.py b/src/urh/controller/DecoderWidgetController.py index b7bfa413e3..dc675c6faf 100644 --- a/src/urh/controller/DecoderWidgetController.py +++ b/src/urh/controller/DecoderWidgetController.py @@ -7,12 +7,11 @@ QLineEdit, QMessageBox from urh import constants -from urh.SignalSceneManager import SignalSceneManager +from urh.signalprocessing.Encoding import Encoding from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.signalprocessing.Signal import Signal -from urh.signalprocessing.Encoding import Encoding +from urh.ui.painting.SignalSceneManager import SignalSceneManager from urh.ui.ui_decoding import Ui_Decoder -from urh.util import util from urh.util.ProjectManager import ProjectManager diff --git a/src/urh/controller/FilterBandwidthDialogController.py b/src/urh/controller/FilterBandwidthDialogController.py new file mode 100644 index 0000000000..89f2d3daf8 --- /dev/null +++ b/src/urh/controller/FilterBandwidthDialogController.py @@ -0,0 +1,66 @@ +from PyQt5.QtCore import pyqtSlot +from PyQt5.QtWidgets import QDialog, QLabel, QRadioButton + +from urh import constants +from urh.signalprocessing.Filter import Filter +from urh.ui.ui_filter_bandwidth_dialog import Ui_DialogFilterBandwidth + + +class FilterBandwidthDialogController(QDialog): + def __init__(self, parent=None): + super().__init__(parent) + self.ui = Ui_DialogFilterBandwidth() + self.ui.setupUi(self) + + bw_type = constants.SETTINGS.value("bandpass_filter_bw_type", "Medium", str) + custom_bw = constants.SETTINGS.value("bandpass_filter_custom_bw", 0.1, float) + + for item in dir(self.ui): + item = getattr(self.ui, item) + if isinstance(item, QLabel): + name = item.objectName().replace("label", "") + key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None) + if key is not None and name.endswith("Bandwidth"): + item.setText("{0:n}".format(Filter.BANDWIDTHS[key])) + elif key is not None and name.endswith("KernelLength"): + item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key]))) + elif isinstance(item, QRadioButton): + item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", "")) + + self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw) + self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw)) + + self.create_connects() + + def create_connects(self): + self.ui.doubleSpinBoxCustomBandwidth.valueChanged.connect(self.on_spin_box_custom_bandwidth_value_changed) + self.ui.spinBoxCustomKernelLength.valueChanged.connect(self.on_spin_box_custom_kernel_length_value_changed) + self.ui.buttonBox.accepted.connect(self.on_accepted) + + @property + def checked_radiobutton(self): + for rb in dir(self.ui): + radio_button = getattr(self.ui, rb) + if isinstance(radio_button, QRadioButton) and radio_button.isChecked(): + return radio_button + return None + + @pyqtSlot(float) + def on_spin_box_custom_bandwidth_value_changed(self, bw: float): + self.ui.spinBoxCustomKernelLength.blockSignals(True) + self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(bw)) + self.ui.spinBoxCustomKernelLength.blockSignals(False) + + @pyqtSlot(int) + def on_spin_box_custom_kernel_length_value_changed(self, filter_len: int): + self.ui.doubleSpinBoxCustomBandwidth.blockSignals(True) + self.ui.doubleSpinBoxCustomBandwidth.setValue(Filter.get_bandwidth_from_filter_length(filter_len)) + self.ui.doubleSpinBoxCustomBandwidth.blockSignals(False) + + @pyqtSlot() + def on_accepted(self): + if self.checked_radiobutton is not None: + bw_type = self.checked_radiobutton.objectName().replace("radioButton", "").replace("_", " ") + constants.SETTINGS.setValue("bandpass_filter_bw_type", bw_type) + + constants.SETTINGS.setValue("bandpass_filter_custom_bw", self.ui.doubleSpinBoxCustomBandwidth.value()) diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index 455f6edaf9..c136e804a2 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -158,7 +158,7 @@ def create_connects(self): self.ui.fileTree.directory_open_wanted.connect(self.project_manager.set_project_folder) self.signal_tab_controller.frame_closed.connect(self.close_signal_frame) - self.signal_tab_controller.signal_created.connect(self.add_signal) + self.signal_tab_controller.signal_created.connect(self.on_signal_created) self.signal_tab_controller.ui.scrollArea.files_dropped.connect(self.on_files_dropped) self.signal_tab_controller.files_dropped.connect(self.on_files_dropped) self.signal_tab_controller.frame_was_dropped.connect(self.set_frame_numbers) @@ -270,21 +270,23 @@ def add_signalfile(self, filename: str, group_id=0, enforce_sample_rate=None): self.file_proxy_model.open_files.add(filename) self.add_signal(signal, group_id) - def add_signal(self, signal, group_id=0): + def add_signal(self, signal, group_id=0, index=-1): self.setCursor(Qt.WaitCursor) pa = ProtocolAnalyzer(signal) - sig_frame = self.signal_tab_controller.add_signal_frame(pa) + sig_frame = self.signal_tab_controller.add_signal_frame(pa, index=index) pa = self.compare_frame_controller.add_protocol(pa, group_id) signal.blockSignals(True) has_entry = self.project_manager.read_project_file_for_signal(signal) - if not has_entry: + + if not has_entry and not signal.changed: signal.auto_detect() + signal.blockSignals(False) self.signal_protocol_dict[sig_frame] = pa - sig_frame.refresh(draw_full_signal=True) # Hier wird das Protokoll ausgelesen + sig_frame.refresh(draw_full_signal=True) # protocol is derived here if self.project_manager.read_participants_for_signal(signal, pa.messages): sig_frame.ui.gvSignal.redraw_view() @@ -794,6 +796,9 @@ def on_options_changed(self, changed_options: dict): if "default_view" in changed_options: self.apply_default_view(int(changed_options["default_view"])) + if "spectrogram_colormap" in changed_options: + self.signal_tab_controller.redraw_spectrograms() + @pyqtSlot() def on_text_edit_project_description_text_changed(self): self.project_manager.description = self.ui.textEditProjectDescription.toPlainText() @@ -805,3 +810,7 @@ def on_btn_file_tree_go_up_clicked(self): path = cur_dir.path() self.filemodel.setRootPath(path) self.ui.fileTree.setRootIndex(self.file_proxy_model.mapFromSource(self.filemodel.index(path))) + + @pyqtSlot(int, Signal) + def on_signal_created(self, index: int, signal: Signal): + self.add_signal(signal, index=index) diff --git a/src/urh/controller/ModulatorDialogController.py b/src/urh/controller/ModulatorDialogController.py index 54abae1501..d30c1dfeb7 100644 --- a/src/urh/controller/ModulatorDialogController.py +++ b/src/urh/controller/ModulatorDialogController.py @@ -136,8 +136,8 @@ def create_connects(self): self.ui.gVModulated.zoomed.connect(self.on_carrier_data_modulated_zoomed) self.ui.gVCarrier.zoomed.connect(self.on_carrier_data_modulated_zoomed) self.ui.gVData.zoomed.connect(self.on_carrier_data_modulated_zoomed) - self.ui.gVModulated.sel_area_width_changed.connect(self.on_modulated_selection_changed) - self.ui.gVOriginalSignal.sel_area_width_changed.connect(self.on_original_selection_changed) + self.ui.gVModulated.selection_width_changed.connect(self.on_modulated_selection_changed) + self.ui.gVOriginalSignal.selection_width_changed.connect(self.on_original_selection_changed) self.ui.spinBoxGaussBT.valueChanged.connect(self.on_gauss_bt_changed) self.ui.spinBoxGaussFilterWidth.valueChanged.connect(self.on_gaus_filter_wdith_changed) diff --git a/src/urh/controller/OptionsController.py b/src/urh/controller/OptionsController.py index 539dc65157..6292f8e833 100644 --- a/src/urh/controller/OptionsController.py +++ b/src/urh/controller/OptionsController.py @@ -5,17 +5,19 @@ import tempfile from subprocess import call -from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal -from PyQt5.QtGui import QCloseEvent -from PyQt5.QtWidgets import QDialog, QHBoxLayout, QCompleter, QDirModel, QApplication, QHeaderView, QStyleFactory +from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QSize +from PyQt5.QtGui import QCloseEvent, QIcon, QPixmap +from PyQt5.QtWidgets import QDialog, QHBoxLayout, QCompleter, QDirModel, QApplication, QHeaderView, QStyleFactory, \ + QRadioButton -from urh import constants +from urh import constants, colormaps from urh.controller.PluginController import PluginController from urh.dev.BackendHandler import BackendHandler, Backends, BackendContainer from urh.dev.native import ExtensionHelper from urh.models.FieldTypeTableModel import FieldTypeTableModel from urh.signalprocessing.FieldType import FieldType from urh.signalprocessing.ProtocoLabel import ProtocolLabel +from urh.signalprocessing.Spectrogram import Spectrogram from urh.ui.delegates.ComboBoxDelegate import ComboBoxDelegate from urh.ui.ui_options import Ui_DialogOptions @@ -43,7 +45,7 @@ def __init__(self, installed_plugins, highlighted_plugins=None, parent=None): self.ui.comboBoxTheme.setCurrentIndex(constants.SETTINGS.value("theme_index", 0, int)) self.ui.checkBoxShowConfirmCloseDialog.setChecked( not constants.SETTINGS.value('not_show_close_dialog', False, bool)) - self.ui.checkBoxHoldShiftToDrag.setChecked(constants.SETTINGS.value('hold_shift_to_drag', False, bool)) + self.ui.checkBoxHoldShiftToDrag.setChecked(constants.SETTINGS.value('hold_shift_to_drag', True, bool)) self.ui.checkBoxDefaultFuzzingPause.setChecked( constants.SETTINGS.value('use_default_fuzzing_pause', True, bool)) @@ -91,6 +93,8 @@ def __init__(self, installed_plugins, highlighted_plugins=None, parent=None): self.old_default_view = self.ui.comboBoxDefaultView.currentIndex() self.ui.labelRebuildNativeStatus.setText("") + self.show_available_colormaps() + try: self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__))) except TypeError: @@ -201,6 +205,19 @@ def refresh_device_tab(self): self.ui.lineEditGnuradioDirectory.setEnabled(self.backend_handler.use_gnuradio_install_dir) self.ui.lineEditPython2Interpreter.setDisabled(self.backend_handler.use_gnuradio_install_dir) + def show_available_colormaps(self): + height = 50 + + selected = colormaps.read_selected_colormap_name_from_settings() + for colormap_name in sorted(colormaps.maps.keys()): + image = Spectrogram.create_colormap_image(colormap_name, height=height) + rb = QRadioButton(colormap_name) + rb.setObjectName(colormap_name) + rb.setChecked(colormap_name == selected) + rb.setIcon(QIcon(QPixmap.fromImage(image))) + rb.setIconSize(QSize(256, height)) + self.ui.scrollAreaWidgetSpectrogramColormapContents.layout().addWidget(rb) + def closeEvent(self, event: QCloseEvent): changed_values = {} if bool(self.ui.checkBoxPauseTime.isChecked()) != self.old_show_pause_as_time: @@ -218,6 +235,16 @@ def closeEvent(self, event: QCloseEvent): for plugin in self.plugin_controller.model.plugins: plugin.destroy_settings_frame() + for i in range(self.ui.scrollAreaWidgetSpectrogramColormapContents.layout().count()): + widget = self.ui.scrollAreaWidgetSpectrogramColormapContents.layout().itemAt(i).widget() + if isinstance(widget, QRadioButton) and widget.isChecked(): + selected_colormap_name = widget.objectName() + if selected_colormap_name != colormaps.read_selected_colormap_name_from_settings(): + colormaps.choose_colormap(selected_colormap_name) + colormaps.write_selected_colormap_to_settings(selected_colormap_name) + changed_values["spectrogram_colormap"] = selected_colormap_name + break + self.values_changed.emit(changed_values) constants.SETTINGS.setValue("{}/geometry".format(self.__class__.__name__), self.saveGeometry()) diff --git a/src/urh/controller/ProtocolSniffDialogController.py b/src/urh/controller/ProtocolSniffDialogController.py index 7e85edca1d..cbffe236e1 100644 --- a/src/urh/controller/ProtocolSniffDialogController.py +++ b/src/urh/controller/ProtocolSniffDialogController.py @@ -2,13 +2,13 @@ from PyQt5.QtCore import pyqtSlot, pyqtSignal from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QCompleter, QDirModel +from urh.ui.painting.SniffSceneManager import SniffSceneManager from urh import constants -from urh.SniffSceneManager import SniffSceneManager -from urh.LiveSceneManager import LiveSceneManager from urh.controller.SendRecvDialogController import SendRecvDialogController from urh.plugins.NetworkSDRInterface.NetworkSDRInterfacePlugin import NetworkSDRInterfacePlugin from urh.signalprocessing.ProtocolSniffer import ProtocolSniffer +from urh.ui.painting.LiveSceneManager import LiveSceneManager class ProtocolSniffDialogController(SendRecvDialogController): diff --git a/src/urh/controller/ReceiveDialogController.py b/src/urh/controller/ReceiveDialogController.py index 21f0cced15..c2836fa797 100644 --- a/src/urh/controller/ReceiveDialogController.py +++ b/src/urh/controller/ReceiveDialogController.py @@ -3,9 +3,9 @@ from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QMessageBox -from urh.LiveSceneManager import LiveSceneManager from urh.controller.SendRecvDialogController import SendRecvDialogController from urh.dev.VirtualDevice import Mode, VirtualDevice +from urh.ui.painting.LiveSceneManager import LiveSceneManager from urh.util import FileOperator from urh.util.Formatter import Formatter diff --git a/src/urh/controller/SendDialogController.py b/src/urh/controller/SendDialogController.py index ed945ec30b..b5393c247b 100644 --- a/src/urh/controller/SendDialogController.py +++ b/src/urh/controller/SendDialogController.py @@ -1,15 +1,12 @@ from PyQt5.QtCore import Qt, pyqtSlot -from PyQt5.QtGui import QBrush -from PyQt5.QtGui import QColor -from PyQt5.QtGui import QIcon -from PyQt5.QtGui import QPen +from PyQt5.QtGui import QBrush, QColor, QIcon, QPen from PyQt5.QtWidgets import QMessageBox from urh import constants -from urh.SignalSceneManager import SignalSceneManager from urh.controller.SendRecvDialogController import SendRecvDialogController from urh.dev.VirtualDevice import VirtualDevice, Mode from urh.signalprocessing.Signal import Signal +from urh.ui.painting.SignalSceneManager import SignalSceneManager from urh.util import FileOperator diff --git a/src/urh/controller/SignalFrameController.py b/src/urh/controller/SignalFrameController.py index fc7f6e2611..357387103e 100644 --- a/src/urh/controller/SignalFrameController.py +++ b/src/urh/controller/SignalFrameController.py @@ -1,21 +1,24 @@ import math -from PyQt5.QtCore import pyqtSignal, QPoint, Qt, QMimeData, pyqtSlot, QRectF, QTimer -from PyQt5.QtGui import QFontDatabase, QIcon, QDrag, QPixmap, QRegion, QDropEvent, QTextCursor, QContextMenuEvent +import numpy as np +from PyQt5.QtCore import pyqtSignal, QPoint, Qt, QMimeData, pyqtSlot, QTimer +from PyQt5.QtGui import QFontDatabase, QIcon, QDrag, QPixmap, QRegion, QDropEvent, QTextCursor, QContextMenuEvent, \ + QResizeEvent from PyQt5.QtWidgets import QFrame, QMessageBox, QMenu, QWidget, QUndoStack, \ QCheckBox, QApplication -from urh.ui.actions.EditSignalAction import EditSignalAction, EditAction from urh import constants -from urh.SignalSceneManager import SignalSceneManager from urh.controller.FilterDialogController import FilterDialogController from urh.controller.SendDialogController import SendDialogController from urh.controller.SignalDetailsController import SignalDetailsController from urh.signalprocessing.Filter import Filter, FilterType from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.signalprocessing.Signal import Signal -from urh.ui.LegendScene import LegendScene +from urh.signalprocessing.Spectrogram import Spectrogram from urh.ui.actions.ChangeSignalParameter import ChangeSignalParameter +from urh.ui.actions.EditSignalAction import EditSignalAction, EditAction +from urh.ui.painting.LegendScene import LegendScene +from urh.ui.painting.SignalSceneManager import SignalSceneManager from urh.ui.ui_signal_frame import Ui_SignalFrame from urh.util import FileOperator from urh.util.Errors import Errors @@ -47,6 +50,9 @@ def __init__(self, proto_analyzer: ProtocolAnalyzer, undo_stack: QUndoStack, self.ui = Ui_SignalFrame() self.ui.setupUi(self) + self.__set_spectrogram_adjust_widgets_visibility() + self.ui.gvSignal.init_undo_stack(self.undo_stack) + fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont) fixed_font.setPointSize(QApplication.instance().font().pointSize()) self.ui.txtEdProto.setFont(fixed_font) @@ -60,6 +66,11 @@ def __init__(self, proto_analyzer: ProtocolAnalyzer, undo_stack: QUndoStack, self.proto_analyzer = proto_analyzer self.signal = proto_analyzer.signal if self.proto_analyzer is not None else None # type: Signal + self.ui.gvSignal.protocol = self.proto_analyzer + self.ui.gvSignal.set_signal(self.signal) + self.ui.sliderFFTWindowSize.setValue(int(math.log2(Spectrogram.DEFAULT_FFT_WINDOW_SIZE))) + self.ui.sliderSpectrogramMin.setValue(self.ui.gvSpectrogram.scene_manager.spectrogram.data_min) + self.ui.sliderSpectrogramMax.setValue(self.ui.gvSpectrogram.scene_manager.spectrogram.data_max) self.dsp_filter = Filter([0.1] * 10, FilterType.moving_average) self.set_filter_button_caption() @@ -69,6 +80,10 @@ def __init__(self, proto_analyzer: ProtocolAnalyzer, undo_stack: QUndoStack, self.proto_selection_timer.setSingleShot(True) self.proto_selection_timer.setInterval(1) + self.spectrogram_update_timer = QTimer() + self.spectrogram_update_timer.setSingleShot(True) + self.spectrogram_update_timer.setInterval(500) + # Disabled because never used (see also set_protocol_visibilty()) self.ui.chkBoxSyncSelection.hide() @@ -126,23 +141,22 @@ def __init__(self, proto_analyzer: ProtocolAnalyzer, undo_stack: QUndoStack, suffix = " (*.proto)" elif proto_analyzer.filename.endswith(".txt"): suffix = " (*.txt)" - self.ui.lSignalTyp.setText("Protocol"+suffix) + self.ui.lSignalTyp.setText("Protocol" + suffix) scene, nsamples = SignalSceneManager.create_rectangle(proto_bits) self.ui.lSamplesInView.setText("{0:n}".format(int(nsamples))) self.ui.lSamplesTotal.setText("{0:n}".format(int(nsamples))) self.ui.gvSignal.setScene(scene) - self.ui.spinBoxSelectionStart.setMaximum(nsamples) - self.ui.spinBoxSelectionEnd.setMaximum(nsamples) self.ui.btnReplay.hide() self.create_connects() - - self.ui.gvSignal.sel_area_active = True - self.ui.btnSaveSignal.hide() + @property + def spectrogram_is_active(self) -> bool: + return self.ui.stackedWidget.currentWidget() == self.ui.pageSpectrogram + def create_connects(self): self.ui.btnCloseSignal.clicked.connect(self.on_btn_close_signal_clicked) self.ui.btnReplay.clicked.connect(self.on_btn_replay_clicked) @@ -150,6 +164,11 @@ def create_connects(self): self.ui.btnInfo.clicked.connect(self.on_info_btn_clicked) self.ui.btnShowHideStartEnd.clicked.connect(self.on_btn_show_hide_start_end_clicked) self.filter_dialog.filter_accepted.connect(self.on_filter_dialog_filter_accepted) + self.ui.sliderFFTWindowSize.valueChanged.connect(self.on_slider_fft_window_size_value_changed) + self.ui.sliderSpectrogramMin.valueChanged.connect(self.on_slider_spectrogram_min_value_changed) + self.ui.sliderSpectrogramMax.valueChanged.connect(self.on_slider_spectrogram_max_value_changed) + self.ui.gvSpectrogram.y_scale_changed.connect(self.on_gv_spectrogram_y_scale_changed) + self.ui.gvSpectrogram.bandpass_filter_triggered.connect(self.on_bandpass_filter_triggered) if self.signal is not None: self.ui.gvSignal.save_clicked.connect(self.save_signal) @@ -160,18 +179,19 @@ def create_connects(self): self.signal.modulation_type_changed.connect(self.show_modulation_type) self.signal.tolerance_changed.connect(self.ui.spinBoxTolerance.setValue) self.signal.protocol_needs_update.connect(self.refresh_protocol) - self.signal.data_edited.connect(self.refresh_signal) # Crop/Delete Mute etc. - self.signal.sample_rate_changed.connect(self.__set_duration) - self.signal.sample_rate_changed.connect(self.show_protocol) # Update times + self.signal.data_edited.connect(self.on_signal_data_edited) # Crop/Delete Mute etc. + + self.signal.sample_rate_changed.connect(self.on_signal_sample_rate_changed) self.signal.saved_status_changed.connect(self.on_signal_data_changed_before_save) self.ui.btnSaveSignal.clicked.connect(self.save_signal) self.signal.name_changed.connect(self.ui.lineEditSignalName.setText) self.ui.gvLegend.resized.connect(self.on_gv_legend_resized) - self.ui.gvSignal.sel_area_width_changed.connect(self.start_proto_selection_timer) + self.ui.gvSignal.selection_width_changed.connect(self.start_proto_selection_timer) self.ui.gvSignal.sel_area_start_end_changed.connect(self.start_proto_selection_timer) self.proto_selection_timer.timeout.connect(self.update_protocol_selection_from_roi) + self.spectrogram_update_timer.timeout.connect(self.on_spectrogram_update_timer_timeout) self.ui.lineEditSignalName.editingFinished.connect(self.change_signal_name) self.proto_analyzer.qt_signals.protocol_updated.connect(self.on_protocol_updated) @@ -182,11 +202,14 @@ def create_connects(self): self.ui.gvSignal.save_as_clicked.connect(self.save_signal_as) self.ui.gvSignal.create_clicked.connect(self.create_new_signal) self.ui.gvSignal.zoomed.connect(self.on_signal_zoomed) + self.ui.gvSpectrogram.zoomed.connect(self.on_spectrum_zoomed) self.ui.gvSignal.sel_area_start_end_changed.connect(self.update_selection_area) + self.ui.gvSpectrogram.sel_area_start_end_changed.connect(self.update_selection_area) + self.ui.gvSpectrogram.selection_height_changed.connect(self.update_number_selected_samples) self.ui.gvSignal.sep_area_changed.connect(self.set_qad_center) self.ui.gvSignal.sep_area_moving.connect(self.update_legend) - self.ui.sliderYScale.valueChanged.connect(self.handle_slideryscale_value_changed) + self.ui.sliderYScale.valueChanged.connect(self.on_slider_y_scale_value_changed) self.ui.spinBoxXZoom.valueChanged.connect(self.on_spinbox_x_zoom_value_changed) self.project_manager.project_updated.connect(self.on_participant_changed) @@ -252,8 +275,14 @@ def set_empty_frame_visibilities(self): self.ui.btnSaveSignal.hide() def update_number_selected_samples(self): - self.ui.lNumSelectedSamples.setText(str(abs(int(self.ui.gvSignal.selection_area.width)))) - self.__set_duration() + if self.spectrogram_is_active: + self.ui.lNumSelectedSamples.setText(str(abs(int(self.ui.gvSpectrogram.selection_area.length)))) + self.__set_selected_bandwidth() + return + else: + self.ui.lNumSelectedSamples.setText(str(abs(int(self.ui.gvSignal.selection_area.length)))) + self.__set_duration() + try: sel_messages = self.ui.gvSignal.selected_messages except AttributeError: @@ -266,6 +295,24 @@ def update_number_selected_samples(self): def change_signal_name(self): self.signal.name = self.ui.lineEditSignalName.text() + def __set_spectrogram_adjust_widgets_visibility(self): + self.ui.labelFFTWindowSize.setVisible(self.ui.cbSignalView.currentIndex() == 2) + self.ui.sliderFFTWindowSize.setVisible(self.ui.cbSignalView.currentIndex() == 2) + self.ui.labelSpectrogramMin.setVisible(self.ui.cbSignalView.currentIndex() == 2) + self.ui.labelSpectrogramMax.setVisible(self.ui.cbSignalView.currentIndex() == 2) + self.ui.sliderSpectrogramMin.setVisible(self.ui.cbSignalView.currentIndex() == 2) + self.ui.sliderSpectrogramMax.setVisible(self.ui.cbSignalView.currentIndex() == 2) + + def __set_selected_bandwidth(self): + try: + num_samples = int(self.ui.lNumSelectedSamples.text()) + except ValueError: + return + + if self.ui.gvSpectrogram.height_spectrogram and self.signal: + bw = (num_samples / self.ui.gvSpectrogram.height_spectrogram) * self.signal.sample_rate + self.ui.lDuration.setText(Formatter.big_value_with_suffix(bw) + "Hz") + def __set_duration(self): # On Signal Sample Rate changed try: num_samples = int(self.ui.lNumSelectedSamples.text()) @@ -276,17 +323,29 @@ def __set_duration(self): # On Signal Sample Rate changed t = num_samples / self.signal.sample_rate self.ui.lDuration.setText(Formatter.science_time(t)) - def handle_slideryscale_value_changed(self): + def on_slider_y_scale_value_changed(self): try: - gvs = self.ui.gvSignal + gv = self.ui.gvSignal if self.ui.stackedWidget.currentIndex() == 0 else self.ui.gvSpectrogram yscale = self.ui.sliderYScale.value() - current_factor = gvs.sceneRect().height() / gvs.view_rect().height() - gvs.scale(1, yscale / current_factor) - x, w = self.ui.gvSignal.view_rect().x(), self.ui.gvSignal.view_rect().width() - gvs.centerOn(x + w / 2, gvs.y_center) + current_factor = gv.sceneRect().height() / gv.view_rect().height() + gv.scale(1, yscale / current_factor) + x, w = gv.view_rect().x(), gv.view_rect().width() + gv.centerOn(x + w / 2, gv.y_center) except ZeroDivisionError: pass + @pyqtSlot() + def on_slider_fft_window_size_value_changed(self): + self.spectrogram_update_timer.start() + + @pyqtSlot() + def on_slider_spectrogram_min_value_changed(self): + self.spectrogram_update_timer.start() + + @pyqtSlot() + def on_slider_spectrogram_max_value_changed(self): + self.spectrogram_update_timer.start() + def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.drag_started.emit(self.mapToParent(event.pos())) @@ -318,7 +377,7 @@ def dropEvent(self, event: QDropEvent): def create_new_signal(self, start, end): if start != end: - new_signal = self.signal.create_new(start, end) + new_signal = self.signal.create_new(start=start, end=end) self.signal_created.emit(new_signal) else: Errors.empty_selection() @@ -352,7 +411,12 @@ def save_signal(self): self.save_signal_as() def save_signal_as(self): - filename = FileOperator.get_save_file_name(self.signal.filename, wav_only=self.signal.wav_mode) + if self.signal.filename: + initial_name = self.signal.filename + else: + initial_name = self.signal.name.replace(" ", "-").replace(",", ".").replace(".", "_") + ".complex" + + filename = FileOperator.get_save_file_name(initial_name, wav_only=self.signal.wav_mode) if filename: try: self.signal.save_as(filename) @@ -377,12 +441,6 @@ def draw_signal(self, full_signal=False): legend.draw_one_zero_arrows(-self.signal.qad_center) gv_legend.setScene(legend) - num_samples = self.signal.num_samples - self.ui.spinBoxSelectionStart.setMaximum(num_samples) - self.ui.spinBoxSelectionEnd.setMaximum(num_samples) - self.ui.gvSignal.nsamples = num_samples - - self.ui.gvSignal.sel_area_active = True self.ui.gvSignal.y_sep = -self.signal.qad_center def restore_protocol_selection(self, sel_start, sel_end, start_message, end_message, old_protoview): @@ -486,6 +544,27 @@ def show_protocol(self, old_view=-1, refresh=False): self.ui.txtEdProto.blockSignals(False) + def draw_spectrogram(self, show_full_scene=False, force_redraw=False): + self.setCursor(Qt.WaitCursor) + window_size = 2 ** self.ui.sliderFFTWindowSize.value() + data_min, data_max = self.ui.sliderSpectrogramMin.value(), self.ui.sliderSpectrogramMax.value() + + redraw_needed = self.ui.gvSpectrogram.scene_manager.set_parameters(self.signal.data, window_size=window_size, + data_min=data_min, data_max=data_max) + self.ui.gvSpectrogram.scene_manager.update_scene_rect() + + if show_full_scene: + self.ui.gvSpectrogram.show_full_scene() + + if redraw_needed or force_redraw: + self.ui.gvSpectrogram.scene_manager.show_full_scene() + self.ui.gvSpectrogram.show_full_scene() + + self.on_slider_y_scale_value_changed() + + self.__set_samples_in_view() + self.unsetCursor() + def eliminate(self): self.proto_selection_timer.stop() self.ui.verticalLayout.removeItem(self.ui.additionalInfos) @@ -510,20 +589,26 @@ def eliminate(self): self.setParent(None) self.deleteLater() - @pyqtSlot() - def on_signal_zoomed(self): - gvs = self.ui.gvSignal - self.ui.lSamplesInView.setText("{0:n}".format(int(gvs.view_rect().width()))) + def __handle_graphic_view_zoomed(self, graphic_view): + self.ui.lSamplesInView.setText("{0:n}".format(int(graphic_view.view_rect().width()))) self.ui.spinBoxXZoom.blockSignals(True) - self.ui.spinBoxXZoom.setValue(int(gvs.sceneRect().width() / gvs.view_rect().width() * 100)) + self.ui.spinBoxXZoom.setValue(int(graphic_view.sceneRect().width() / graphic_view.view_rect().width() * 100)) self.ui.spinBoxXZoom.blockSignals(False) + @pyqtSlot() + def on_signal_zoomed(self): + self.__handle_graphic_view_zoomed(self.ui.gvSignal) + + @pyqtSlot() + def on_spectrum_zoomed(self): + self.__handle_graphic_view_zoomed(self.ui.gvSpectrogram) + @pyqtSlot(int) def on_spinbox_x_zoom_value_changed(self, value: int): - gvs = self.ui.gvSignal + graphic_view = self.ui.gvSpectrogram if self.spectrogram_is_active else self.ui.gvSignal zoom_factor = value / 100 - current_factor = gvs.sceneRect().width() / gvs.view_rect().width() - gvs.zoom(zoom_factor / current_factor) + current_factor = graphic_view.sceneRect().width() / graphic_view.view_rect().width() + graphic_view.zoom(zoom_factor / current_factor) @pyqtSlot() def on_btn_close_signal_clicked(self): @@ -551,17 +636,25 @@ def on_noise_threshold_changed(self): @pyqtSlot(int) def on_spinbox_selection_start_value_changed(self, value: int): - if self.ui.gvSignal.sel_area_active: - self.ui.gvSignal.set_selection_area(x=value) + if self.spectrogram_is_active: + self.ui.gvSpectrogram.set_vertical_selection(y=self.ui.gvSpectrogram.sceneRect().height() - value) + self.ui.gvSpectrogram.emit_selection_size_changed() + self.ui.gvSpectrogram.selection_area.finished = True + else: + self.ui.gvSignal.set_horizontal_selection(x=value) self.ui.gvSignal.selection_area.finished = True - self.ui.gvSignal.emit_sel_area_width_changed() + self.ui.gvSignal.emit_selection_size_changed() @pyqtSlot(int) def on_spinbox_selection_end_value_changed(self, value: int): - if self.ui.gvSignal.sel_area_active: - self.ui.gvSignal.set_selection_area(w=value - self.ui.spinBoxSelectionStart.value()) + if self.spectrogram_is_active: + self.ui.gvSpectrogram.set_vertical_selection(h=self.ui.spinBoxSelectionStart.value() - value) + self.ui.gvSpectrogram.emit_selection_size_changed() + self.ui.gvSpectrogram.selection_area.finished = True + else: + self.ui.gvSignal.set_horizontal_selection(w=value - self.ui.spinBoxSelectionStart.value()) self.ui.gvSignal.selection_area.finished = True - self.ui.gvSignal.emit_sel_area_width_changed() + self.ui.gvSignal.emit_selection_size_changed() @pyqtSlot() def on_protocol_updated(self): @@ -601,18 +694,30 @@ def set_protocol_visibility(self): def on_cb_signal_view_index_changed(self): self.setCursor(Qt.WaitCursor) - self.ui.gvSignal.redraw_view(reinitialize=True) + self.__set_spectrogram_adjust_widgets_visibility() - if self.ui.cbSignalView.currentIndex() > 0: - self.ui.gvLegend.y_scene = self.scene_manager.scene.sceneRect().y() - self.ui.gvLegend.scene_height = self.scene_manager.scene.sceneRect().height() - self.ui.gvLegend.refresh() + if self.ui.cbSignalView.currentText().lower() == "spectrogram": + self.ui.stackedWidget.setCurrentWidget(self.ui.pageSpectrogram) + self.draw_spectrogram(show_full_scene=True) + self.__set_selected_bandwidth() else: - self.ui.gvLegend.hide() + self.ui.stackedWidget.setCurrentWidget(self.ui.pageSignal) + self.ui.gvSignal.scene_type = self.ui.cbSignalView.currentIndex() + self.ui.gvSignal.redraw_view(reinitialize=True) + + if self.ui.cbSignalView.currentIndex() == 1: + self.ui.gvLegend.y_scene = self.scene_manager.scene.sceneRect().y() + self.ui.gvLegend.scene_height = self.scene_manager.scene.sceneRect().height() + self.ui.gvLegend.refresh() + else: + self.ui.gvLegend.hide() + + self.ui.gvSignal.auto_fit_view() + self.ui.gvSignal.refresh_selection_area() + self.on_slider_y_scale_value_changed() # apply YScale to new view + self.__set_samples_in_view() + self.__set_duration() - self.ui.gvSignal.auto_fit_view() - self.ui.gvSignal.refresh_selection_area() - self.handle_slideryscale_value_changed() # YScale auf neue Sicht übertragen self.unsetCursor() @pyqtSlot() @@ -690,14 +795,14 @@ def set_roi_from_protocol_analysis(self, start_message, start_pos, end_message, if sample_pos != -1: if self.jump_sync and self.sync_protocol: self.ui.gvSignal.centerOn(sample_pos, self.ui.gvSignal.y_center) - self.ui.gvSignal.set_selection_area(sample_pos, num_samples) + self.ui.gvSignal.set_horizontal_selection(sample_pos, num_samples) self.ui.gvSignal.centerOn(sample_pos + num_samples, self.ui.gvSignal.y_center) else: - self.ui.gvSignal.set_selection_area(sample_pos, num_samples) + self.ui.gvSignal.set_horizontal_selection(sample_pos, num_samples) self.ui.gvSignal.zoom_to_selection(sample_pos, sample_pos + num_samples) else: - self.ui.gvSignal.set_selection_area(0, 0) + self.ui.gvSignal.clear_horizontal_selection() self.protocol_selection_is_updateable = True self.update_protocol_selection_from_roi() @@ -762,15 +867,15 @@ def update_roi_from_protocol_selection(self): if sample_pos != -1: if self.jump_sync and self.sync_protocol: self.ui.gvSignal.centerOn(sample_pos, self.ui.gvSignal.y_center) - self.ui.gvSignal.set_selection_area(sample_pos, num_samples) + self.ui.gvSignal.set_horizontal_selection(sample_pos, num_samples) if forward_selection: # Forward Selection --> Center ROI to End of Selection self.ui.gvSignal.centerOn(sample_pos + num_samples, self.ui.gvSignal.y_center) else: # Backward Selection --> Center ROI to Start of Selection self.ui.gvSignal.centerOn(sample_pos, self.ui.gvSignal.y_center) else: - self.ui.gvSignal.set_selection_area(sample_pos, num_samples) + self.ui.gvSignal.set_horizontal_selection(sample_pos, num_samples) else: - self.ui.gvSignal.set_selection_area(0, 0) + self.ui.gvSignal.clear_horizontal_selection() self.ui.gvSignal.blockSignals(False) self.update_number_selected_samples() @@ -842,17 +947,22 @@ def update_protocol_selection_from_roi(self): self.ui.txtEdProto.blockSignals(False) self.jump_sync = True + def __set_samples_in_view(self): + if self.spectrogram_is_active: + self.ui.lSamplesInView.setText("{0:n}".format(int(self.ui.gvSpectrogram.view_rect().width()))) + self.ui.lSamplesTotal.setText("{0:n}".format(self.ui.gvSpectrogram.width_spectrogram)) + else: + self.ui.lSamplesInView.setText("{0:n}".format(int(self.ui.gvSignal.view_rect().width()))) + self.ui.lSamplesTotal.setText("{0:n}".format(self.signal.num_samples)) + def refresh_signal(self, draw_full_signal=False): - self.ui.gvSignal.sel_area_active = False self.draw_signal(draw_full_signal) - self.ui.lSamplesInView.setText("{0:n}".format(int(self.ui.gvSignal.view_rect().width()))) - self.ui.lSamplesTotal.setText("{0:n}".format(self.signal.num_samples)) + self.__set_samples_in_view() self.update_number_selected_samples() self.set_qad_tooltip(self.signal.noise_threshold) - self.ui.gvSignal.sel_area_active = True @pyqtSlot(float) def on_signal_qad_center_changed(self, qad_center): @@ -915,6 +1025,15 @@ def on_participant_changed(self): if self.proto_analyzer: self.proto_analyzer.qt_signals.protocol_updated.emit() + def resizeEvent(self, event: QResizeEvent): + old_width, new_width = max(1, event.oldSize().width()), max(1, event.size().width()) + super().resizeEvent(event) + self.on_slider_y_scale_value_changed() + + # Force update of GVS, when size changed e.g. when Project Tree is opened + if not self.spectrogram_is_active: + self.ui.gvSignal.zoom(new_width / old_width, zoom_to_mouse_cursor=False) + @pyqtSlot() def on_info_btn_clicked(self): sdc = SignalDetailsController(self.signal, self) @@ -1021,3 +1140,37 @@ def on_filter_dialog_filter_accepted(self, dsp_filter: Filter): if dsp_filter is not None: self.dsp_filter = dsp_filter self.set_filter_button_caption() + + @pyqtSlot() + def on_spectrogram_update_timer_timeout(self): + self.draw_spectrogram(show_full_scene=True) + + @pyqtSlot(float) + def on_gv_spectrogram_y_scale_changed(self, scale: float): + self.ui.sliderYScale.blockSignals(True) + self.ui.sliderYScale.setValue(self.ui.sliderYScale.value() * scale) + self.ui.sliderYScale.blockSignals(False) + + @pyqtSlot(float, float) + def on_bandpass_filter_triggered(self, f_low: float, f_high: float): + self.setCursor(Qt.WaitCursor) + filter_bw = Filter.read_configured_filter_bw() + filtered = Filter.apply_bandpass_filter(self.signal.data, f_low, f_high, filter_bw=filter_bw) + signal = self.signal.create_new(new_data=filtered.astype(np.complex64)) + signal.name = self.signal.name + " filtered with f_low={0:.4n} f_high={1:.4n} bw={2:.4n}".format(f_low, f_high, + filter_bw) + self.signal_created.emit(signal) + self.unsetCursor() + + def on_signal_data_edited(self): + self.refresh_signal() + self.ui.gvSpectrogram.scene_manager.samples_need_update = True + + @pyqtSlot() + def on_signal_sample_rate_changed(self): + if self.spectrogram_is_active: + self.__set_selected_bandwidth() + else: + self.__set_duration() + + self.show_protocol() # update times diff --git a/src/urh/controller/SignalTabController.py b/src/urh/controller/SignalTabController.py index af6011e049..105e20d13a 100644 --- a/src/urh/controller/SignalTabController.py +++ b/src/urh/controller/SignalTabController.py @@ -11,13 +11,13 @@ class SignalTabController(QWidget): frame_closed = pyqtSignal(SignalFrameController) not_show_again_changed = pyqtSignal() - signal_created = pyqtSignal(Signal) + signal_created = pyqtSignal(int, Signal) files_dropped = pyqtSignal(list) frame_was_dropped = pyqtSignal(int, int) @property def num_frames(self): - return self.splitter.count() - 1 + return len(self.signal_frames) @property def signal_frames(self): @@ -25,7 +25,9 @@ def signal_frames(self): :rtype: list of SignalFrameController """ - return [self.splitter.widget(i) for i in range(self.num_frames)] + splitter = self.ui.splitter + return [splitter.widget(i) for i in range(splitter.count()) + if isinstance(splitter.widget(i), SignalFrameController)] @property def signal_undo_stack(self): @@ -35,23 +37,14 @@ def __init__(self, project_manager, parent=None): super().__init__(parent) self.ui = Ui_Interpretation() self.ui.setupUi(self) - self.splitter = QSplitter() - self.splitter.setStyleSheet("QSplitter::handle:vertical {\nmargin: 4px 0px; background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, \nstop:0 rgba(255, 255, 255, 0), \nstop:0.5 rgba(100, 100, 100, 100), \nstop:1 rgba(255, 255, 255, 0));\n image: url(:/icons/data/icons/splitter_handle_horizontal.svg);\n}") - self.splitter.setOrientation(Qt.Vertical) - self.splitter.setChildrenCollapsible(True) - self.splitter.setHandleWidth(6) - - placeholder_widget = QWidget() - placeholder_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) + + self.ui.placeholderLabel.setVisible(False) + self.getting_started_status = None + self.__set_getting_started_status(True) + self.undo_stack = QUndoStack() self.project_manager = project_manager - self.splitter.addWidget(placeholder_widget) - self.signal_vlay = QVBoxLayout() - self.signal_vlay.setContentsMargins(0,0,0,0) - self.signal_vlay.addWidget(self.splitter) - self.ui.scrlAreaSignals.setLayout(self.signal_vlay) - self.drag_pos = None def on_files_dropped(self, files): @@ -60,17 +53,17 @@ def on_files_dropped(self, files): def close_frame(self, frame:SignalFrameController): self.frame_closed.emit(frame) - def add_signal_frame(self, proto_analyzer): + def add_signal_frame(self, proto_analyzer, index=-1): + self.__set_getting_started_status(False) sig_frame = SignalFrameController(proto_analyzer, self.undo_stack, self.project_manager, parent=self) sframes = self.signal_frames - if len(proto_analyzer.signal.filename) == 0: # new signal from "create signal from selection" sig_frame.ui.btnSaveSignal.show() self.__create_connects_for_signal_frame(signal_frame=sig_frame) - sig_frame.signal_created.connect(self.signal_created.emit) + sig_frame.signal_created.connect(self.emit_signal_created) sig_frame.not_show_again_changed.connect(self.not_show_again_changed.emit) sig_frame.ui.lineEditSignalName.setToolTip(self.tr("Sourcefile: ") + proto_analyzer.signal.filename) sig_frame.apply_to_all_clicked.connect(self.on_apply_to_all_clicked) @@ -85,7 +78,8 @@ def add_signal_frame(self, proto_analyzer): sig_frame.ui.cbSignalView.setCurrentIndex(1) sig_frame.ui.cbSignalView.setDisabled(True) - self.splitter.insertWidget(self.num_frames, sig_frame) + index = self.num_frames if index == -1 else index + self.ui.splitter.insertWidget(index, sig_frame) sig_frame.blockSignals(False) default_view = constants.SETTINGS.value('default_view', 0, int) @@ -93,14 +87,8 @@ def add_signal_frame(self, proto_analyzer): return sig_frame - def __create_connects_for_signal_frame(self, signal_frame: SignalFrameController): - signal_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', False, type=bool) - signal_frame.drag_started.connect(self.frame_dragged) - signal_frame.frame_dropped.connect(self.frame_dropped) - signal_frame.files_dropped.connect(self.on_files_dropped) - signal_frame.closed.connect(self.close_frame) - def add_empty_frame(self, filename: str, proto): + self.__set_getting_started_status(False) sig_frame = SignalFrameController(proto_analyzer=proto, undo_stack=self.undo_stack, project_manager=self.project_manager, proto_bits=proto.decoded_proto_bits_str, parent=self) @@ -110,10 +98,29 @@ def add_empty_frame(self, filename: str, proto): sig_frame.set_empty_frame_visibilities() self.__create_connects_for_signal_frame(signal_frame=sig_frame) - self.splitter.insertWidget(self.num_frames, sig_frame) + self.ui.splitter.insertWidget(self.num_frames, sig_frame) return sig_frame + def __set_getting_started_status(self, getting_started: bool): + if getting_started == self.getting_started_status: + return + + self.getting_started_status = getting_started + self.ui.labelGettingStarted.setVisible(getting_started) + + if not getting_started: + w = QWidget() + w.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) + self.ui.splitter.addWidget(w) + + def __create_connects_for_signal_frame(self, signal_frame: SignalFrameController): + signal_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', True, type=bool) + signal_frame.drag_started.connect(self.frame_dragged) + signal_frame.frame_dropped.connect(self.frame_dropped) + signal_frame.files_dropped.connect(self.on_files_dropped) + signal_frame.closed.connect(self.close_frame) + def set_frame_numbers(self): for i, f in enumerate(self.signal_frames): f.ui.lSignalNr.setText("{0:d}:".format(i + 1)) @@ -217,10 +224,24 @@ def frame_dropped(self, pos: QPoint): @pyqtSlot(int, int) def swap_frames(self, from_index: int, to_index: int): if from_index != to_index: - start_sig_widget = self.splitter.widget(from_index) - self.splitter.insertWidget(to_index, start_sig_widget) + start_sig_widget = self.ui.splitter.widget(from_index) + self.ui.splitter.insertWidget(to_index, start_sig_widget) @pyqtSlot() def on_participant_changed(self): for sframe in self.signal_frames: sframe.on_participant_changed() + + def redraw_spectrograms(self): + for frame in self.signal_frames: + if frame.ui.gvSpectrogram.width_spectrogram > 0: + frame.draw_spectrogram(force_redraw=True) + + @pyqtSlot(Signal) + def emit_signal_created(self, signal): + try: + index = self.signal_frames.index(self.sender()) + 1 + except ValueError: + index = -1 + + self.signal_created.emit(index, signal) diff --git a/src/urh/controller/SpectrumDialogController.py b/src/urh/controller/SpectrumDialogController.py index 57abe05dfb..4932d636ce 100644 --- a/src/urh/controller/SpectrumDialogController.py +++ b/src/urh/controller/SpectrumDialogController.py @@ -1,11 +1,9 @@ -from PyQt5.QtCore import QTimer -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import QTimer, pyqtSlot from PyQt5.QtGui import QWheelEvent, QIcon -from urh.FFTSceneManager import FFTSceneManager from urh.controller.SendRecvDialogController import SendRecvDialogController from urh.dev.VirtualDevice import VirtualDevice, Mode -from urh.plugins.NetworkSDRInterface.NetworkSDRInterfacePlugin import NetworkSDRInterfacePlugin +from urh.ui.painting.FFTSceneManager import FFTSceneManager class SpectrumDialogController(SendRecvDialogController): diff --git a/src/urh/cythonext/path_creator.cpp b/src/urh/cythonext/path_creator.cpp index a5a92cba74..28ff420786 100644 --- a/src/urh/cythonext/path_creator.cpp +++ b/src/urh/cythonext/path_creator.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.25.2 */ +/* Generated by Cython 0.26 */ /* BEGIN: Cython Metadata { @@ -10,7 +10,11 @@ "extra_link_args": [ "-fopenmp" ], - "language": "c++" + "language": "c++", + "name": "urh.cythonext.path_creator", + "sources": [ + "src/urh/cythonext/path_creator.pyx" + ] }, "module_name": "urh.cythonext.path_creator" } @@ -23,7 +27,7 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else -#define CYTHON_ABI "0_25_2" +#define CYTHON_ABI "0_26" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -45,6 +49,7 @@ END: Cython Metadata */ #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif +#define __PYX_COMMA , #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG @@ -197,16 +202,20 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); +#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif @@ -333,6 +342,12 @@ END: Cython Metadata */ #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -387,6 +402,35 @@ END: Cython Metadata */ # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #ifdef __cplusplus + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__)) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -510,8 +554,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString @@ -524,8 +568,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) @@ -647,10 +694,12 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -1040,8 +1089,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; typedef npy_cdouble __pyx_t_5numpy_complex_t; struct __pyx_opt_args_3src_3urh_9cythonext_12path_creator_create_path; -/* "src/urh/cythonext/path_creator.pyx":16 - * from urh import constants +/* "src/urh/cythonext/path_creator.pyx":17 + * import math * * cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): # <<<<<<<<<<<<<< * cdef float[:] values @@ -1270,6 +1319,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ @@ -1295,7 +1351,7 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); // PROTO + __Pyx_TypeInfo* type); /* MemviewSliceInit.proto */ #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d @@ -1345,6 +1401,14 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1378,14 +1442,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* SliceObject.proto */ #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\ __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) @@ -1519,12 +1575,29 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); +/* decode_c_string_utf16.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + /* decode_c_string.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1588,11 +1661,20 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* HasAttr.proto */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); + /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* CLineInTraceback.proto */ +static int __Pyx_CLineForTraceback(int c_line); /* CodeObjectCache.proto */ typedef struct { @@ -1820,10 +1902,10 @@ static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_PY_LONG_LONG(PyObject *); @@ -1939,6 +2021,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_PY_LONG_LONG = { "long long", NULL, sizeof(PY_LONG_LONG), { 0 }, 0, IS_UNSIGNED(PY_LONG_LONG) ? 'U' : 'I', IS_UNSIGNED(PY_LONG_LONG), 0 }; @@ -1968,11 +2051,15 @@ static const char __pyx_k_id[] = "id"; static const char __pyx_k_ii[] = ">ii"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_end[] = "end"; +static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_urh[] = "urh"; static const char __pyx_k_base[] = "base"; +static const char __pyx_k_ceil[] = "ceil"; static const char __pyx_k_data[] = "data"; +static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_math[] = "math"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_ndim[] = "ndim"; @@ -1987,6 +2074,7 @@ static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; +static const char __pyx_k_floor[] = "floor"; static const char __pyx_k_int64[] = "int64"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_order[] = "order"; @@ -2001,9 +2089,12 @@ static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_name_2[] = "__name__"; +static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_repeat[] = "repeat"; +static const char __pyx_k_result[] = "result"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_unpack[] = "unpack"; +static const char __pyx_k_update[] = "update"; static const char __pyx_k_float32[] = "float32"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_memview[] = "memview"; @@ -2011,26 +2102,36 @@ static const char __pyx_k_samples[] = "samples"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_negative[] = "negative"; +static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_constants[] = "constants"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_QByteArray[] = "QByteArray"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; +static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_PyQt5_QtGui[] = "PyQt5.QtGui"; static const char __pyx_k_QDataStream[] = "QDataStream"; static const char __pyx_k_fromRawData[] = "fromRawData"; static const char __pyx_k_PyQt5_QtCore[] = "PyQt5.QtCore"; static const char __pyx_k_QPainterPath[] = "QPainterPath"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; +static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_subpath_ranges[] = "subpath_ranges"; static const char __pyx_k_PIXELS_PER_PATH[] = "PIXELS_PER_PATH"; +static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_strided_and_indirect[] = ""; static const char __pyx_k_contiguous_and_direct[] = ""; @@ -2049,6 +2150,7 @@ static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; +static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; @@ -2056,6 +2158,7 @@ static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; +static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; @@ -2069,6 +2172,7 @@ static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; static PyObject *__pyx_n_s_ImportError; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0; static PyObject *__pyx_n_s_IndexError; static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; @@ -2080,6 +2184,7 @@ static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; static PyObject *__pyx_n_b_O; static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; static PyObject *__pyx_n_s_PIXELS_PER_PATH; +static PyObject *__pyx_n_s_PickleError; static PyObject *__pyx_n_s_PyQt5_QtCore; static PyObject *__pyx_n_s_PyQt5_QtGui; static PyObject *__pyx_n_s_QByteArray; @@ -2089,17 +2194,21 @@ static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_View_MemoryView; static PyObject *__pyx_n_s_allocate_buffer; static PyObject *__pyx_n_s_arange; static PyObject *__pyx_n_s_astype; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_u_c; +static PyObject *__pyx_n_s_ceil; static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_constants; static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_n_s_data; +static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_s_dtype; static PyObject *__pyx_n_s_dtype_is_object; static PyObject *__pyx_n_s_encode; @@ -2109,6 +2218,7 @@ static PyObject *__pyx_n_s_error; static PyObject *__pyx_kp_u_f8; static PyObject *__pyx_n_s_flags; static PyObject *__pyx_n_s_float32; +static PyObject *__pyx_n_s_floor; static PyObject *__pyx_n_s_format; static PyObject *__pyx_n_s_fortran; static PyObject *__pyx_n_u_fortran; @@ -2123,6 +2233,7 @@ static PyObject *__pyx_n_s_int64; static PyObject *__pyx_n_s_itemsize; static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_math; static PyObject *__pyx_n_s_memview; static PyObject *__pyx_n_s_mode; static PyObject *__pyx_n_s_name; @@ -2131,6 +2242,8 @@ static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_ndim; static PyObject *__pyx_n_s_negative; +static PyObject *__pyx_n_s_new; +static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_numpy; static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to; @@ -2138,11 +2251,19 @@ static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_order; static PyObject *__pyx_n_s_pack; +static PyObject *__pyx_n_s_pickle; +static PyObject *__pyx_n_s_pyx_checksum; static PyObject *__pyx_n_s_pyx_getbuffer; +static PyObject *__pyx_n_s_pyx_state; +static PyObject *__pyx_n_s_pyx_type; +static PyObject *__pyx_n_s_pyx_unpickle_Enum; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_repeat; +static PyObject *__pyx_n_s_result; static PyObject *__pyx_n_s_samples; +static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; static PyObject *__pyx_n_s_size; static PyObject *__pyx_n_s_start; @@ -2151,6 +2272,7 @@ static PyObject *__pyx_n_s_stop; static PyObject *__pyx_kp_s_strided_and_direct; static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; static PyObject *__pyx_kp_s_strided_and_indirect; +static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_struct; static PyObject *__pyx_n_s_subpath_ranges; static PyObject *__pyx_n_s_test; @@ -2159,6 +2281,7 @@ static PyObject *__pyx_kp_s_unable_to_allocate_array_data; static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_unpack; +static PyObject *__pyx_n_s_update; static PyObject *__pyx_n_s_urh; static PyObject *__pyx_n_s_view; static PyObject *__pyx_n_s_x; @@ -2178,8 +2301,12 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ @@ -2201,8 +2328,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2212,6 +2344,7 @@ static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_12; static PyObject *__pyx_int_20; +static PyObject *__pyx_int_184977713; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; static PyObject *__pyx_slice__4; @@ -2222,9 +2355,9 @@ static PyObject *__pyx_slice__8; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__28; -static PyObject *__pyx_slice__29; -static PyObject *__pyx_slice__30; +static PyObject *__pyx_slice__32; +static PyObject *__pyx_slice__33; +static PyObject *__pyx_slice__34; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; @@ -2243,15 +2376,23 @@ static PyObject *__pyx_tuple__24; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__26; static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__35; static PyObject *__pyx_tuple__36; - -/* "src/urh/cythonext/path_creator.pyx":16 - * from urh import constants +static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_codeobj__44; + +/* "src/urh/cythonext/path_creator.pyx":17 + * import math * * cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): # <<<<<<<<<<<<<< * cdef float[:] values @@ -2278,8 +2419,8 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m PY_LONG_LONG __pyx_v_samples_per_pixel; PyObject *__pyx_v_result = 0; PyObject *__pyx_v_subpath_range = NULL; - PyObject *__pyx_v_substart = NULL; - PyObject *__pyx_v_subend = NULL; + PyObject *__pyx_v_sub_start = NULL; + PyObject *__pyx_v_sub_end = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2302,9 +2443,10 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m PY_LONG_LONG __pyx_t_18; int __pyx_t_19; __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_21; + long __pyx_t_21; Py_ssize_t __pyx_t_22; - int __pyx_t_23; + Py_ssize_t __pyx_t_23; + int __pyx_t_24; __Pyx_RefNannySetupContext("create_path", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { @@ -2313,7 +2455,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m } __Pyx_INCREF(__pyx_v_subpath_ranges); - /* "src/urh/cythonext/path_creator.pyx":22 + /* "src/urh/cythonext/path_creator.pyx":23 * cdef float sample, minimum, maximum, tmp, scale_factor * cdef long long i,j,index, chunk_end, num_samples, pixels_on_path, samples_per_pixel * num_samples = end - start # <<<<<<<<<<<<<< @@ -2322,7 +2464,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_num_samples = (__pyx_v_end - __pyx_v_start); - /* "src/urh/cythonext/path_creator.pyx":24 + /* "src/urh/cythonext/path_creator.pyx":25 * num_samples = end - start * * subpath_ranges = [(start, end)] if subpath_ranges is None else subpath_ranges # <<<<<<<<<<<<<< @@ -2331,11 +2473,11 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_t_2 = (__pyx_v_subpath_ranges == ((PyObject*)Py_None)); if ((__pyx_t_2 != 0)) { - __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); @@ -2343,7 +2485,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); @@ -2357,23 +2499,23 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __Pyx_DECREF_SET(__pyx_v_subpath_ranges, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "src/urh/cythonext/path_creator.pyx":25 + /* "src/urh/cythonext/path_creator.pyx":26 * * subpath_ranges = [(start, end)] if subpath_ranges is None else subpath_ranges * pixels_on_path = constants.PIXELS_PER_PATH # <<<<<<<<<<<<<< * * samples_per_pixel = (num_samples / pixels_on_path) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_constants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_constants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PIXELS_PER_PATH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PIXELS_PER_PATH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_pixels_on_path = __pyx_t_6; - /* "src/urh/cythonext/path_creator.pyx":27 + /* "src/urh/cythonext/path_creator.pyx":28 * pixels_on_path = constants.PIXELS_PER_PATH * * samples_per_pixel = (num_samples / pixels_on_path) # <<<<<<<<<<<<<< @@ -2382,7 +2524,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_samples_per_pixel = ((PY_LONG_LONG)(__pyx_v_num_samples / __pyx_v_pixels_on_path)); - /* "src/urh/cythonext/path_creator.pyx":29 + /* "src/urh/cythonext/path_creator.pyx":30 * samples_per_pixel = (num_samples / pixels_on_path) * * if samples_per_pixel > 1: # <<<<<<<<<<<<<< @@ -2392,25 +2534,25 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_2 = ((__pyx_v_samples_per_pixel > 1) != 0); if (__pyx_t_2) { - /* "src/urh/cythonext/path_creator.pyx":30 + /* "src/urh/cythonext/path_creator.pyx":31 * * if samples_per_pixel > 1: * sample_rng = np.arange(start, end, samples_per_pixel, dtype=np.int64) # <<<<<<<<<<<<<< * values = np.zeros(2 * len(sample_rng), dtype=np.float32, order="C") * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_samples_per_pixel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_samples_per_pixel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); @@ -2421,86 +2563,86 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 30, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_PY_LONG_LONG(__pyx_t_4); - if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 30, __pyx_L1_error) + if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_sample_rng = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; - /* "src/urh/cythonext/path_creator.pyx":31 + /* "src/urh/cythonext/path_creator.pyx":32 * if samples_per_pixel > 1: * sample_rng = np.arange(start, end, samples_per_pixel, dtype=np.int64) * values = np.zeros(2 * len(sample_rng), dtype=np.float32, order="C") # <<<<<<<<<<<<<< * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_9 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromSsize_t((2 * __pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t((2 * __pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5); - if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 31, __pyx_L1_error) + if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_values = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - /* "src/urh/cythonext/path_creator.pyx":32 + /* "src/urh/cythonext/path_creator.pyx":33 * sample_rng = np.arange(start, end, samples_per_pixel, dtype=np.int64) * values = np.zeros(2 * len(sample_rng), dtype=np.float32, order="C") * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! # <<<<<<<<<<<<<< * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): * chunk_end = i + samples_per_pixel */ - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_9 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_scale_factor = (((double)__pyx_v_num_samples) / (2.0 * __pyx_t_9)); - /* "src/urh/cythonext/path_creator.pyx":33 + /* "src/urh/cythonext/path_creator.pyx":34 * values = np.zeros(2 * len(sample_rng), dtype=np.float32, order="C") * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): # <<<<<<<<<<<<<< @@ -2511,6 +2653,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); #endif /*try:*/ { __pyx_t_6 = __pyx_v_start; @@ -2546,7 +2689,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_v_sample = ((float)__PYX_NAN()); __pyx_v_tmp = ((float)__PYX_NAN()); - /* "src/urh/cythonext/path_creator.pyx":34 + /* "src/urh/cythonext/path_creator.pyx":35 * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): * chunk_end = i + samples_per_pixel # <<<<<<<<<<<<<< @@ -2555,7 +2698,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_chunk_end = (__pyx_v_i + __pyx_v_samples_per_pixel); - /* "src/urh/cythonext/path_creator.pyx":35 + /* "src/urh/cythonext/path_creator.pyx":36 * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): * chunk_end = i + samples_per_pixel * if chunk_end >= end: # <<<<<<<<<<<<<< @@ -2565,7 +2708,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_2 = ((__pyx_v_chunk_end >= __pyx_v_end) != 0); if (__pyx_t_2) { - /* "src/urh/cythonext/path_creator.pyx":36 + /* "src/urh/cythonext/path_creator.pyx":37 * chunk_end = i + samples_per_pixel * if chunk_end >= end: * chunk_end = end # <<<<<<<<<<<<<< @@ -2574,7 +2717,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_chunk_end = __pyx_v_end; - /* "src/urh/cythonext/path_creator.pyx":35 + /* "src/urh/cythonext/path_creator.pyx":36 * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): * chunk_end = i + samples_per_pixel * if chunk_end >= end: # <<<<<<<<<<<<<< @@ -2583,7 +2726,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ } - /* "src/urh/cythonext/path_creator.pyx":38 + /* "src/urh/cythonext/path_creator.pyx":39 * chunk_end = end * * tmp = samples[i] # <<<<<<<<<<<<<< @@ -2593,7 +2736,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_15 = __pyx_v_i; __pyx_v_tmp = (*((float *) ( /* dim=0 */ (__pyx_v_samples.data + __pyx_t_15 * __pyx_v_samples.strides[0]) ))); - /* "src/urh/cythonext/path_creator.pyx":39 + /* "src/urh/cythonext/path_creator.pyx":40 * * tmp = samples[i] * minimum = tmp # <<<<<<<<<<<<<< @@ -2602,7 +2745,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_minimum = __pyx_v_tmp; - /* "src/urh/cythonext/path_creator.pyx":40 + /* "src/urh/cythonext/path_creator.pyx":41 * tmp = samples[i] * minimum = tmp * maximum = tmp # <<<<<<<<<<<<<< @@ -2611,7 +2754,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_maximum = __pyx_v_tmp; - /* "src/urh/cythonext/path_creator.pyx":42 + /* "src/urh/cythonext/path_creator.pyx":43 * maximum = tmp * * for j in range(i + 1, chunk_end): # <<<<<<<<<<<<<< @@ -2622,7 +2765,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m for (__pyx_t_17 = (__pyx_v_i + 1); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "src/urh/cythonext/path_creator.pyx":43 + /* "src/urh/cythonext/path_creator.pyx":44 * * for j in range(i + 1, chunk_end): * sample = samples[j] # <<<<<<<<<<<<<< @@ -2632,7 +2775,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_18 = __pyx_v_j; __pyx_v_sample = (*((float *) ( /* dim=0 */ (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) ))); - /* "src/urh/cythonext/path_creator.pyx":44 + /* "src/urh/cythonext/path_creator.pyx":45 * for j in range(i + 1, chunk_end): * sample = samples[j] * if sample < minimum: # <<<<<<<<<<<<<< @@ -2642,7 +2785,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_2 = ((__pyx_v_sample < __pyx_v_minimum) != 0); if (__pyx_t_2) { - /* "src/urh/cythonext/path_creator.pyx":45 + /* "src/urh/cythonext/path_creator.pyx":46 * sample = samples[j] * if sample < minimum: * minimum = sample # <<<<<<<<<<<<<< @@ -2651,7 +2794,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_minimum = __pyx_v_sample; - /* "src/urh/cythonext/path_creator.pyx":44 + /* "src/urh/cythonext/path_creator.pyx":45 * for j in range(i + 1, chunk_end): * sample = samples[j] * if sample < minimum: # <<<<<<<<<<<<<< @@ -2661,7 +2804,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m goto __pyx_L14; } - /* "src/urh/cythonext/path_creator.pyx":46 + /* "src/urh/cythonext/path_creator.pyx":47 * if sample < minimum: * minimum = sample * elif sample > maximum: # <<<<<<<<<<<<<< @@ -2671,7 +2814,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_2 = ((__pyx_v_sample > __pyx_v_maximum) != 0); if (__pyx_t_2) { - /* "src/urh/cythonext/path_creator.pyx":47 + /* "src/urh/cythonext/path_creator.pyx":48 * minimum = sample * elif sample > maximum: * maximum = sample # <<<<<<<<<<<<<< @@ -2680,7 +2823,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_maximum = __pyx_v_sample; - /* "src/urh/cythonext/path_creator.pyx":46 + /* "src/urh/cythonext/path_creator.pyx":47 * if sample < minimum: * minimum = sample * elif sample > maximum: # <<<<<<<<<<<<<< @@ -2691,7 +2834,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_L14:; } - /* "src/urh/cythonext/path_creator.pyx":49 + /* "src/urh/cythonext/path_creator.pyx":50 * maximum = sample * * index = (2*(i-start)/samples_per_pixel) # <<<<<<<<<<<<<< @@ -2700,7 +2843,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m */ __pyx_v_index = ((PY_LONG_LONG)((2 * (__pyx_v_i - __pyx_v_start)) / __pyx_v_samples_per_pixel)); - /* "src/urh/cythonext/path_creator.pyx":50 + /* "src/urh/cythonext/path_creator.pyx":51 * * index = (2*(i-start)/samples_per_pixel) * values[index] = minimum # <<<<<<<<<<<<<< @@ -2710,7 +2853,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __pyx_t_16 = __pyx_v_index; *((float *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_16 * __pyx_v_values.strides[0]) )) = __pyx_v_minimum; - /* "src/urh/cythonext/path_creator.pyx":51 + /* "src/urh/cythonext/path_creator.pyx":52 * index = (2*(i-start)/samples_per_pixel) * values[index] = minimum * values[index + 1] = maximum # <<<<<<<<<<<<<< @@ -2732,7 +2875,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m #endif } - /* "src/urh/cythonext/path_creator.pyx":33 + /* "src/urh/cythonext/path_creator.pyx":34 * values = np.zeros(2 * len(sample_rng), dtype=np.float32, order="C") * scale_factor = num_samples / (2.0 * len(sample_rng)) # 2.0 is important to make it a float division! * for i in prange(start, end, samples_per_pixel, nogil=True, schedule='static'): # <<<<<<<<<<<<<< @@ -2742,6 +2885,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L6; @@ -2750,19 +2894,19 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m } } - /* "src/urh/cythonext/path_creator.pyx":53 + /* "src/urh/cythonext/path_creator.pyx":54 * values[index + 1] = maximum * * x = np.repeat(sample_rng, 2) # <<<<<<<<<<<<<< * else: * x = np.arange(start, end, dtype=np.int64) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_repeat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_repeat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sample_rng, 1, (PyObject *(*)(char *)) __pyx_memview_get_PY_LONG_LONG, (int (*)(char *, PyObject *)) __pyx_memview_set_PY_LONG_LONG, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = NULL; __pyx_t_19 = 0; @@ -2779,7 +2923,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_int_2}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2788,14 +2932,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_int_2}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_1 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -2806,19 +2950,19 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m __Pyx_GIVEREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_19, __pyx_int_2); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(__pyx_t_5); - if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 53, __pyx_L1_error) + if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_x = __pyx_t_20; __pyx_t_20.memview = NULL; __pyx_t_20.data = NULL; - /* "src/urh/cythonext/path_creator.pyx":29 + /* "src/urh/cythonext/path_creator.pyx":30 * samples_per_pixel = (num_samples / pixels_on_path) * * if samples_per_pixel > 1: # <<<<<<<<<<<<<< @@ -2828,7 +2972,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m goto __pyx_L3; } - /* "src/urh/cythonext/path_creator.pyx":55 + /* "src/urh/cythonext/path_creator.pyx":56 * x = np.repeat(sample_rng, 2) * else: * x = np.arange(start, end, dtype=np.int64) # <<<<<<<<<<<<<< @@ -2836,16 +2980,16 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m * scale_factor = 1.0 */ /*else*/ { - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); @@ -2853,28 +2997,28 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __pyx_t_5 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(__pyx_t_3); - if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_x = __pyx_t_20; __pyx_t_20.memview = NULL; __pyx_t_20.data = NULL; - /* "src/urh/cythonext/path_creator.pyx":56 + /* "src/urh/cythonext/path_creator.pyx":57 * else: * x = np.arange(start, end, dtype=np.int64) * values = samples[start:end] # <<<<<<<<<<<<<< @@ -2899,14 +3043,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__Pyx_m 0, 1) < 0)) { - __PYX_ERR(0, 56, __pyx_L1_error) + __PYX_ERR(0, 57, __pyx_L1_error) } __pyx_v_values = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - /* "src/urh/cythonext/path_creator.pyx":57 + /* "src/urh/cythonext/path_creator.pyx":58 * x = np.arange(start, end, dtype=np.int64) * values = samples[start:end] * scale_factor = 1.0 # <<<<<<<<<<<<<< @@ -2917,132 +3061,318 @@ __pyx_v_values = __pyx_t_10; } __pyx_L3:; - /* "src/urh/cythonext/path_creator.pyx":59 + /* "src/urh/cythonext/path_creator.pyx":60 * scale_factor = 1.0 * * cdef list result = [] # <<<<<<<<<<<<<< * if scale_factor == 0: * scale_factor = 1 # prevent division by zero */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "src/urh/cythonext/path_creator.pyx":60 + /* "src/urh/cythonext/path_creator.pyx":61 * * cdef list result = [] * if scale_factor == 0: # <<<<<<<<<<<<<< * scale_factor = 1 # prevent division by zero - * for subpath_range in subpath_ranges: + * */ __pyx_t_2 = ((__pyx_v_scale_factor == 0.0) != 0); if (__pyx_t_2) { - /* "src/urh/cythonext/path_creator.pyx":61 + /* "src/urh/cythonext/path_creator.pyx":62 * cdef list result = [] * if scale_factor == 0: * scale_factor = 1 # prevent division by zero # <<<<<<<<<<<<<< + * * for subpath_range in subpath_ranges: - * substart = int((subpath_range[0]-start)/scale_factor) */ __pyx_v_scale_factor = 1.0; - /* "src/urh/cythonext/path_creator.pyx":60 + /* "src/urh/cythonext/path_creator.pyx":61 * * cdef list result = [] * if scale_factor == 0: # <<<<<<<<<<<<<< * scale_factor = 1 # prevent division by zero - * for subpath_range in subpath_ranges: + * */ } - /* "src/urh/cythonext/path_creator.pyx":62 - * if scale_factor == 0: + /* "src/urh/cythonext/path_creator.pyx":64 * scale_factor = 1 # prevent division by zero + * * for subpath_range in subpath_ranges: # <<<<<<<<<<<<<< - * substart = int((subpath_range[0]-start)/scale_factor) - * subend = int((subpath_range[1]-start)/scale_factor) + * sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor + * sub_start =int(max(0, math.floor(sub_start))) */ if (unlikely(__pyx_v_subpath_ranges == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 62, __pyx_L1_error) + __PYX_ERR(0, 64, __pyx_L1_error) } __pyx_t_3 = __pyx_v_subpath_ranges; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; for (;;) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 64, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_subpath_range, __pyx_t_1); __pyx_t_1 = 0; - /* "src/urh/cythonext/path_creator.pyx":63 - * scale_factor = 1 # prevent division by zero + /* "src/urh/cythonext/path_creator.pyx":65 + * * for subpath_range in subpath_ranges: - * substart = int((subpath_range[0]-start)/scale_factor) # <<<<<<<<<<<<<< - * subend = int((subpath_range[1]-start)/scale_factor) - * result.append(array_to_QPath(x[substart:subend], values[substart:subend])) + * sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor # <<<<<<<<<<<<<< + * sub_start =int(max(0, math.floor(sub_start))) + * sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_subpath_range, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_subpath_range, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_7 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_substart, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyFloat_FromDouble((2.0 * __pyx_v_scale_factor)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_sub_start, __pyx_t_7); + __pyx_t_7 = 0; - /* "src/urh/cythonext/path_creator.pyx":64 + /* "src/urh/cythonext/path_creator.pyx":66 * for subpath_range in subpath_ranges: - * substart = int((subpath_range[0]-start)/scale_factor) - * subend = int((subpath_range[1]-start)/scale_factor) # <<<<<<<<<<<<<< - * result.append(array_to_QPath(x[substart:subend], values[substart:subend])) - * return result + * sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor + * sub_start =int(max(0, math.floor(sub_start))) # <<<<<<<<<<<<<< + * sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor + * sub_end = int(max(0, math.ceil(sub_end))) + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_floor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (!__pyx_t_4) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sub_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_sub_start}; + __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_7); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_sub_start}; + __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_7); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_sub_start); + __Pyx_GIVEREF(__pyx_v_sub_start); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_sub_start); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_21 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_21); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_21); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_sub_start, __pyx_t_7); + __pyx_t_7 = 0; + + /* "src/urh/cythonext/path_creator.pyx":67 + * sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor + * sub_start =int(max(0, math.floor(sub_start))) + * sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor # <<<<<<<<<<<<<< + * sub_end = int(max(0, math.ceil(sub_end))) + * result.append(array_to_QPath(x[sub_start:sub_end], values[sub_start:sub_end])) */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_subpath_range, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_subpath_range, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Subtract(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyNumber_Subtract(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((2.0 * __pyx_v_scale_factor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_subend, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_sub_end, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/urh/cythonext/path_creator.pyx":65 - * substart = int((subpath_range[0]-start)/scale_factor) - * subend = int((subpath_range[1]-start)/scale_factor) - * result.append(array_to_QPath(x[substart:subend], values[substart:subend])) # <<<<<<<<<<<<<< - * return result + /* "src/urh/cythonext/path_creator.pyx":68 + * sub_start =int(max(0, math.floor(sub_start))) + * sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor + * sub_end = int(max(0, math.ceil(sub_end))) # <<<<<<<<<<<<<< + * result.append(array_to_QPath(x[sub_start:sub_end], values[sub_start:sub_end])) + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ceil); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + if (!__pyx_t_1) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_sub_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_sub_end}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_sub_end}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_sub_end); + __Pyx_GIVEREF(__pyx_v_sub_end); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_sub_end); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_21 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_21); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = __pyx_t_4; + } else { + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_21); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __pyx_t_1; + __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_sub_end, __pyx_t_4); + __pyx_t_4 = 0; + + /* "src/urh/cythonext/path_creator.pyx":69 + * sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor + * sub_end = int(max(0, math.ceil(sub_end))) + * result.append(array_to_QPath(x[sub_start:sub_end], values[sub_start:sub_end])) # <<<<<<<<<<<<<< * + * return result */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_substart); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) - __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_subend); if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_sub_start); if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_23 = __Pyx_PyIndex_AsSsize_t(__pyx_v_sub_end); if (unlikely((__pyx_t_23 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_20.data = __pyx_v_x.data; __pyx_t_20.memview = __pyx_v_x.memview; __PYX_INC_MEMVIEW(&__pyx_t_20, 0); @@ -3053,19 +3383,19 @@ __pyx_v_values = __pyx_t_10; 0, 0, &__pyx_t_19, - __pyx_t_21, __pyx_t_22, + __pyx_t_23, 0, 1, 1, 0, 1) < 0)) { - __PYX_ERR(0, 65, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) } -__pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_substart); if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_subend); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) +__pyx_t_23 = __Pyx_PyIndex_AsSsize_t(__pyx_v_sub_start); if (unlikely((__pyx_t_23 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_sub_end); if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_10.data = __pyx_v_values.data; __pyx_t_10.memview = __pyx_v_values.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); @@ -3076,41 +3406,41 @@ __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_substart); if (unlikely((__pyx_t_22 0, 0, &__pyx_t_19, + __pyx_t_23, __pyx_t_22, - __pyx_t_21, 0, 1, 1, 0, 1) < 0)) { - __PYX_ERR(0, 65, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) } -__pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_20, __pyx_t_10, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); +__pyx_t_4 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_20, __pyx_t_10, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1); __pyx_t_20.memview = NULL; __pyx_t_20.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - __pyx_t_23 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_23 == -1)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_24 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/urh/cythonext/path_creator.pyx":62 - * if scale_factor == 0: + /* "src/urh/cythonext/path_creator.pyx":64 * scale_factor = 1 # prevent division by zero + * * for subpath_range in subpath_ranges: # <<<<<<<<<<<<<< - * substart = int((subpath_range[0]-start)/scale_factor) - * subend = int((subpath_range[1]-start)/scale_factor) + * sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor + * sub_start =int(max(0, math.floor(sub_start))) */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/urh/cythonext/path_creator.pyx":66 - * subend = int((subpath_range[1]-start)/scale_factor) - * result.append(array_to_QPath(x[substart:subend], values[substart:subend])) + /* "src/urh/cythonext/path_creator.pyx":71 + * result.append(array_to_QPath(x[sub_start:sub_end], values[sub_start:sub_end])) + * * return result # <<<<<<<<<<<<<< * * @@ -3120,8 +3450,8 @@ __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_2 __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "src/urh/cythonext/path_creator.pyx":16 - * from urh import constants + /* "src/urh/cythonext/path_creator.pyx":17 + * import math * * cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): # <<<<<<<<<<<<<< * cdef float[:] values @@ -3146,8 +3476,8 @@ __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_2 __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_subpath_range); - __Pyx_XDECREF(__pyx_v_substart); - __Pyx_XDECREF(__pyx_v_subend); + __Pyx_XDECREF(__pyx_v_sub_start); + __Pyx_XDECREF(__pyx_v_sub_end); __Pyx_XDECREF(__pyx_v_subpath_ranges); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -3173,9 +3503,13 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_1create_path(PyObj const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -3184,16 +3518,19 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_1create_path(PyObj case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, 1); __PYX_ERR(0, 16, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, 1); __PYX_ERR(0, 17, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, 2); __PYX_ERR(0, 16, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, 2); __PYX_ERR(0, 17, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_subpath_ranges); @@ -3201,11 +3538,12 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_1create_path(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_path") < 0)) __PYX_ERR(0, 16, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_path") < 0)) __PYX_ERR(0, 17, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3213,20 +3551,20 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_1create_path(PyObj default: goto __pyx_L5_argtuple_error; } } - __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[0]); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 16, __pyx_L3_error) - __pyx_v_start = __Pyx_PyInt_As_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_start == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) - __pyx_v_end = __Pyx_PyInt_As_PY_LONG_LONG(values[2]); if (unlikely((__pyx_v_end == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[0]); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 17, __pyx_L3_error) + __pyx_v_start = __Pyx_PyInt_As_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_start == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) + __pyx_v_end = __Pyx_PyInt_As_PY_LONG_LONG(values[2]); if (unlikely((__pyx_v_end == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) __pyx_v_subpath_ranges = ((PyObject*)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 16, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_path", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 17, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("src.urh.cythonext.path_creator.create_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_subpath_ranges), (&PyList_Type), 1, "subpath_ranges", 1))) __PYX_ERR(0, 16, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_subpath_ranges), (&PyList_Type), 1, "subpath_ranges", 1))) __PYX_ERR(0, 17, __pyx_L1_error) __pyx_r = __pyx_pf_3src_3urh_9cythonext_12path_creator_create_path(__pyx_self, __pyx_v_samples, __pyx_v_start, __pyx_v_end, __pyx_v_subpath_ranges); /* function exit code */ @@ -3247,7 +3585,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_12path_creator_create_path(CYTHON __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.subpath_ranges = __pyx_v_subpath_ranges; - __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__pyx_v_samples, __pyx_v_start, __pyx_v_end, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_create_path(__pyx_v_samples, __pyx_v_start, __pyx_v_end, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3265,7 +3603,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_12path_creator_create_path(CYTHON return __pyx_r; } -/* "src/urh/cythonext/path_creator.pyx":69 +/* "src/urh/cythonext/path_creator.pyx":74 * * * cpdef create_live_path(float[:] samples, unsigned int start, unsigned int end): # <<<<<<<<<<<<<< @@ -3288,7 +3626,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_RefNannySetupContext("create_live_path", 0); - /* "src/urh/cythonext/path_creator.pyx":70 + /* "src/urh/cythonext/path_creator.pyx":75 * * cpdef create_live_path(float[:] samples, unsigned int start, unsigned int end): * return array_to_QPath(np.arange(start, end).astype(np.int64), samples) # <<<<<<<<<<<<<< @@ -3296,14 +3634,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ * cpdef array_to_QPath(np.int64_t[:] x, float[:] y): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; __pyx_t_7 = 0; @@ -3320,7 +3658,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3330,7 +3668,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3338,7 +3676,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -3349,17 +3687,17 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -3373,14 +3711,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -3389,29 +3727,29 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8); __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1); - if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 70, __pyx_L1_error) + if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_9, __pyx_v_samples, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_t_9, __pyx_v_samples, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); __pyx_t_9.memview = NULL; @@ -3420,7 +3758,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__ __pyx_t_1 = 0; goto __pyx_L0; - /* "src/urh/cythonext/path_creator.pyx":69 + /* "src/urh/cythonext/path_creator.pyx":74 * * * cpdef create_live_path(float[:] samples, unsigned int start, unsigned int end): # <<<<<<<<<<<<<< @@ -3463,8 +3801,11 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_3create_live_path( const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -3473,19 +3814,21 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_3create_live_path( case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, 1); __PYX_ERR(0, 69, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, 1); __PYX_ERR(0, 74, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, 2); __PYX_ERR(0, 69, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, 2); __PYX_ERR(0, 74, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_live_path") < 0)) __PYX_ERR(0, 69, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_live_path") < 0)) __PYX_ERR(0, 74, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3494,13 +3837,13 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_3create_live_path( values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[0]); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 69, __pyx_L3_error) - __pyx_v_start = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) - __pyx_v_end = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) + __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[0]); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_start = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_end = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("create_live_path", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("src.urh.cythonext.path_creator.create_live_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3519,7 +3862,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_12path_creator_2create_live_path( PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("create_live_path", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__pyx_v_samples, __pyx_v_start, __pyx_v_end, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_create_live_path(__pyx_v_samples, __pyx_v_start, __pyx_v_end, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3537,7 +3880,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_12path_creator_2create_live_path( return __pyx_r; } -/* "src/urh/cythonext/path_creator.pyx":72 +/* "src/urh/cythonext/path_creator.pyx":77 * return array_to_QPath(np.arange(start, end).astype(np.int64), samples) * * cpdef array_to_QPath(np.int64_t[:] x, float[:] y): # <<<<<<<<<<<<<< @@ -3570,7 +3913,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py PyObject *__pyx_t_12 = NULL; __Pyx_RefNannySetupContext("array_to_QPath", 0); - /* "src/urh/cythonext/path_creator.pyx":86 + /* "src/urh/cythonext/path_creator.pyx":91 * All values are big endian--pack using struct.pack('>d') or struct.pack('>i') * """ * cdef long long n = x.shape[0] # <<<<<<<<<<<<<< @@ -3579,28 +3922,28 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py */ __pyx_v_n = (__pyx_v_x.shape[0]); - /* "src/urh/cythonext/path_creator.pyx":88 + /* "src/urh/cythonext/path_creator.pyx":93 * cdef long long n = x.shape[0] * # create empty array, pad with extra space on either end * arr = np.zeros(n + 2, dtype=[('x', '>f8'), ('y', '>f8'), ('c', '>i4')]) # <<<<<<<<<<<<<< * #arr = arr.byteswap().newbyteorder() # force native byteorder * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG((__pyx_v_n + 2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG((__pyx_v_n + 2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); @@ -3611,9 +3954,9 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_INCREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); PyList_SET_ITEM(__pyx_t_4, 2, __pyx_tuple__3); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3621,53 +3964,53 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __pyx_v_arr = __pyx_t_4; __pyx_t_4 = 0; - /* "src/urh/cythonext/path_creator.pyx":92 + /* "src/urh/cythonext/path_creator.pyx":97 * * # write first two integers * byte_view = arr.view(dtype=np.uint8) # <<<<<<<<<<<<<< * byte_view[:12] = 0 * byte_view.data[12:20] = struct.pack('>ii', n, 0) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_view); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_view); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_byte_view = __pyx_t_2; __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":93 + /* "src/urh/cythonext/path_creator.pyx":98 * # write first two integers * byte_view = arr.view(dtype=np.uint8) * byte_view[:12] = 0 # <<<<<<<<<<<<<< * byte_view.data[12:20] = struct.pack('>ii', n, 0) * */ - if (__Pyx_PyObject_SetSlice(__pyx_v_byte_view, __pyx_int_0, 0, 12, NULL, NULL, &__pyx_slice__4, 0, 1, 0) < 0) __PYX_ERR(0, 93, __pyx_L1_error) + if (__Pyx_PyObject_SetSlice(__pyx_v_byte_view, __pyx_int_0, 0, 12, NULL, NULL, &__pyx_slice__4, 0, 1, 0) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - /* "src/urh/cythonext/path_creator.pyx":94 + /* "src/urh/cythonext/path_creator.pyx":99 * byte_view = arr.view(dtype=np.uint8) * byte_view[:12] = 0 * byte_view.data[12:20] = struct.pack('>ii', n, 0) # <<<<<<<<<<<<<< * * arr[1:-1]['x'] = x */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_pack); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_pack); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; __pyx_t_5 = 0; @@ -3684,7 +4027,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_ii, __pyx_t_1, __pyx_int_0}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3693,14 +4036,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_u_ii, __pyx_t_1, __pyx_int_0}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -3714,45 +4057,45 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_0); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetSlice(__pyx_t_4, __pyx_t_2, 12, 20, NULL, NULL, &__pyx_slice__5, 1, 1, 0) < 0) __PYX_ERR(0, 94, __pyx_L1_error) + if (__Pyx_PyObject_SetSlice(__pyx_t_4, __pyx_t_2, 12, 20, NULL, NULL, &__pyx_slice__5, 1, 1, 0) < 0) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":96 + /* "src/urh/cythonext/path_creator.pyx":101 * byte_view.data[12:20] = struct.pack('>ii', n, 0) * * arr[1:-1]['x'] = x # <<<<<<<<<<<<<< * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht * arr[1:-1]['c'] = 1 */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_int64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_int64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_int64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_int64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__6, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__6, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_u_x, __pyx_t_2) < 0)) __PYX_ERR(0, 96, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_u_x, __pyx_t_2) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":97 + /* "src/urh/cythonext/path_creator.pyx":102 * * arr[1:-1]['x'] = x * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht # <<<<<<<<<<<<<< * arr[1:-1]['c'] = 1 * */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_negative); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_negative); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_y, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_y, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -3765,14 +4108,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py } } if (!__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -3781,44 +4124,44 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__7, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__7, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_n_u_y, __pyx_t_2) < 0)) __PYX_ERR(0, 97, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_n_u_y, __pyx_t_2) < 0)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":98 + /* "src/urh/cythonext/path_creator.pyx":103 * arr[1:-1]['x'] = x * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht * arr[1:-1]['c'] = 1 # <<<<<<<<<<<<<< * * cdef long long last_index = 20 * (n + 1) */ - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__8, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_arr, 1, -1L, NULL, NULL, &__pyx_slice__8, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_c, __pyx_int_1) < 0)) __PYX_ERR(0, 98, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_c, __pyx_int_1) < 0)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":100 + /* "src/urh/cythonext/path_creator.pyx":105 * arr[1:-1]['c'] = 1 * * cdef long long last_index = 20 * (n + 1) # <<<<<<<<<<<<<< @@ -3827,28 +4170,28 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py */ __pyx_v_last_index = (20 * (__pyx_v_n + 1)); - /* "src/urh/cythonext/path_creator.pyx":101 + /* "src/urh/cythonext/path_creator.pyx":106 * * cdef long long last_index = 20 * (n + 1) * byte_view.data[last_index:last_index + 4] = struct.pack('>i', 0) # <<<<<<<<<<<<<< * * try: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_PyObject_SetSlice(__pyx_t_6, __pyx_t_2, __pyx_v_last_index, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0) < 0) __PYX_ERR(0, 101, __pyx_L1_error) + if (__Pyx_PyObject_SetSlice(__pyx_t_6, __pyx_t_2, __pyx_v_last_index, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":103 + /* "src/urh/cythonext/path_creator.pyx":108 * byte_view.data[last_index:last_index + 4] = struct.pack('>i', 0) * * try: # <<<<<<<<<<<<<< @@ -3864,21 +4207,21 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "src/urh/cythonext/path_creator.pyx":104 + /* "src/urh/cythonext/path_creator.pyx":109 * * try: * buf = QByteArray.fromRawData(byte_view.data[12:last_index + 4]) # <<<<<<<<<<<<<< * except TypeError: * buf = QByteArray(byte_view.data[12:last_index + 4]) */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_QByteArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_QByteArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_fromRawData); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_fromRawData); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_6, 12, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_6, 12, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -3892,14 +4235,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py } } if (!__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -3908,20 +4251,20 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } @@ -3930,7 +4273,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __pyx_v_buf = __pyx_t_2; __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":103 + /* "src/urh/cythonext/path_creator.pyx":108 * byte_view.data[last_index:last_index + 4] = struct.pack('>i', 0) * * try: # <<<<<<<<<<<<<< @@ -3941,7 +4284,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -3950,7 +4293,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/urh/cythonext/path_creator.pyx":105 + /* "src/urh/cythonext/path_creator.pyx":110 * try: * buf = QByteArray.fromRawData(byte_view.data[12:last_index + 4]) * except TypeError: # <<<<<<<<<<<<<< @@ -3960,23 +4303,23 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_5) { __Pyx_AddTraceback("src.urh.cythonext.path_creator.array_to_QPath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 105, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 110, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); - /* "src/urh/cythonext/path_creator.pyx":106 + /* "src/urh/cythonext/path_creator.pyx":111 * buf = QByteArray.fromRawData(byte_view.data[12:last_index + 4]) * except TypeError: * buf = QByteArray(byte_view.data[12:last_index + 4]) # <<<<<<<<<<<<<< * * path = QPainterPath() */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_QByteArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_QByteArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_byte_view, __pyx_n_s_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_t_10, 12, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_t_10, 12, (__pyx_v_last_index + 4), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; @@ -3990,14 +4333,14 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py } } if (!__pyx_t_10) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -4006,20 +4349,20 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_11); __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L5_except_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } @@ -4035,7 +4378,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "src/urh/cythonext/path_creator.pyx":103 + /* "src/urh/cythonext/path_creator.pyx":108 * byte_view.data[last_index:last_index + 4] = struct.pack('>i', 0) * * try: # <<<<<<<<<<<<<< @@ -4054,17 +4397,17 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L10_try_end:; + __pyx_L8_try_end:; } - /* "src/urh/cythonext/path_creator.pyx":108 + /* "src/urh/cythonext/path_creator.pyx":113 * buf = QByteArray(byte_view.data[12:last_index + 4]) * * path = QPainterPath() # <<<<<<<<<<<<<< * ds = QDataStream(buf) * ds >> path */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QPainterPath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QPainterPath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4077,24 +4420,24 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py } } if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_path = __pyx_t_1; __pyx_t_1 = 0; - /* "src/urh/cythonext/path_creator.pyx":109 + /* "src/urh/cythonext/path_creator.pyx":114 * * path = QPainterPath() * ds = QDataStream(buf) # <<<<<<<<<<<<<< * ds >> path * */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QDataStream); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QDataStream); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4107,13 +4450,13 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buf}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -4121,19 +4464,19 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buf}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_buf); __Pyx_GIVEREF(__pyx_v_buf); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_buf); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -4142,18 +4485,18 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __pyx_v_ds = __pyx_t_1; __pyx_t_1 = 0; - /* "src/urh/cythonext/path_creator.pyx":110 + /* "src/urh/cythonext/path_creator.pyx":115 * path = QPainterPath() * ds = QDataStream(buf) * ds >> path # <<<<<<<<<<<<<< * * return path */ - __pyx_t_1 = PyNumber_Rshift(__pyx_v_ds, __pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_1 = PyNumber_Rshift(__pyx_v_ds, __pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/urh/cythonext/path_creator.pyx":112 + /* "src/urh/cythonext/path_creator.pyx":117 * ds >> path * * return path # <<<<<<<<<<<<<< @@ -4163,7 +4506,7 @@ static PyObject *__pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__Py __pyx_r = __pyx_v_path; goto __pyx_L0; - /* "src/urh/cythonext/path_creator.pyx":72 + /* "src/urh/cythonext/path_creator.pyx":77 * return array_to_QPath(np.arange(start, end).astype(np.int64), samples) * * cpdef array_to_QPath(np.int64_t[:] x, float[:] y): # <<<<<<<<<<<<<< @@ -4211,7 +4554,9 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_5array_to_QPath(Py const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -4220,14 +4565,15 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_5array_to_QPath(Py case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("array_to_QPath", 1, 2, 2, 1); __PYX_ERR(0, 72, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("array_to_QPath", 1, 2, 2, 1); __PYX_ERR(0, 77, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_to_QPath") < 0)) __PYX_ERR(0, 72, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_to_QPath") < 0)) __PYX_ERR(0, 77, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4235,12 +4581,12 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_12path_creator_5array_to_QPath(Py values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(values[0]); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 72, __pyx_L3_error) - __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[1]); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 72, __pyx_L3_error) + __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(values[0]); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 77, __pyx_L3_error) + __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[1]); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 77, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("array_to_QPath", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 72, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("array_to_QPath", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 77, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("src.urh.cythonext.path_creator.array_to_QPath", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4259,7 +4605,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_12path_creator_4array_to_QPath(CY PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("array_to_QPath", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_v_x, __pyx_v_y, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3src_3urh_9cythonext_12path_creator_array_to_QPath(__pyx_v_x, __pyx_v_y, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6459,7 +6805,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -6507,7 +6853,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":985 @@ -6590,7 +6936,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -6638,7 +6984,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":991 @@ -6721,7 +7067,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -6766,7 +7112,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":997 @@ -6820,10 +7166,15 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -6832,21 +7183,25 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 120, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 120, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode); if (value) { values[3] = value; kw_args--; } } + CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer); @@ -6859,7 +7214,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -7082,7 +7439,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * */ - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 139, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 139, __pyx_L1_error) __pyx_v_self->format = __pyx_t_6; /* "View.MemoryView":142 @@ -8277,34 +8634,141 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struc return __pyx_r; } -/* "View.MemoryView":240 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "View.MemoryView":244 - * cdef array result - * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); - if (__pyx_t_1) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":240 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< + * char *mode, char *buf): + * cdef array result + */ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":244 + * cdef array result + * + * if buf == NULL: # <<<<<<<<<<<<<< + * result = array(shape, itemsize, format, mode.decode('ASCII')) + * else: + */ + __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); + if (__pyx_t_1) { /* "View.MemoryView":245 * @@ -8472,6 +8936,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -8591,6 +9056,293 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ return __pyx_r; } +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef bint use_setstate + * state = (self.name,) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + int __pyx_v_use_setstate; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v__dict = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":4 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += _dict, + */ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":5 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += _dict, + * use_setstate = True + */ + __pyx_t_2 = (__pyx_v__dict != Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":6 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += _dict, # <<<<<<<<<<<<<< + * use_setstate = True + * else: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":7 + * if _dict is not None: + * state += _dict, + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":5 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += _dict, + * use_setstate = True + */ + goto __pyx_L3; + } + + /* "(tree fragment)":9 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_3; + } + __pyx_L3:; + + /* "(tree fragment)":10 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + */ + __pyx_t_3 = (__pyx_v_use_setstate != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":11 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_184977713); + __Pyx_GIVEREF(__pyx_int_184977713); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":10 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + */ + } + + /* "(tree fragment)":13 + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_184977713); + __Pyx_GIVEREF(__pyx_int_184977713); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef bint use_setstate + * state = (self.name,) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":14 + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":14 + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "View.MemoryView":294 * * @cname('__pyx_align_pointer') @@ -8699,8 +9451,11 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -8709,11 +9464,13 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 341, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object); @@ -8726,6 +9483,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; @@ -9858,7 +10616,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L11_try_end; + goto __pyx_L9_try_end; __pyx_L4_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -9918,7 +10676,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L0; - __pyx_L11_try_end:; + __pyx_L9_try_end:; } /* "View.MemoryView":421 @@ -10608,7 +11366,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * else: * if len(self.view.format) == 1: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 484, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 484, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -11449,7 +12207,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 556, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -11563,7 +12321,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__27, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 563, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__29, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -12539,33 +13297,140 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 return __pyx_r; } -/* "View.MemoryView":643 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): */ -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "View.MemoryView":644 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 644, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 644, __pyx_L1_error) + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":643 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + */ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":644 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -12867,9 +13732,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__28); - __Pyx_GIVEREF(__pyx_slice__28); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__28); + __Pyx_INCREF(__pyx_slice__32); + __Pyx_GIVEREF(__pyx_slice__32); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__32); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 668, __pyx_L1_error) @@ -12902,7 +13767,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__29); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 671, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__33); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 671, __pyx_L1_error) } __pyx_L7:; @@ -13047,9 +13912,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__30); - __Pyx_GIVEREF(__pyx_slice__30); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__30); + __Pyx_INCREF(__pyx_slice__34); + __Pyx_GIVEREF(__pyx_slice__34); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__34); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 682, __pyx_L1_error) @@ -13173,7 +14038,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 689, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -14556,11 +15421,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; @@ -15041,11 +15906,11 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = 0; @@ -15313,6 +16178,113 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ return __pyx_r; } +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "View.MemoryView":985 * * @cname('__pyx_memoryview_fromslice') @@ -15757,7 +16729,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_obj); @@ -17014,11 +17986,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = NULL; @@ -17042,7 +18014,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_extents", 0); @@ -17111,7 +18083,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_r = -1; __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -17133,7 +18105,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); @@ -17224,7 +18196,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -17247,7 +18219,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); @@ -17363,7 +18335,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -17930,11 +18902,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; @@ -18114,7 +19086,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); @@ -18138,7 +19110,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da /* function exit code */ __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } @@ -18447,82 +19419,547 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t /* function exit code */ } -static struct __pyx_vtabstruct_array __pyx_vtable_array; -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_array___dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); - } - return v; -} +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v_PickleError = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); -} + /* "(tree fragment)":2 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + */ + __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0); + if (__pyx_t_1) { -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {0, 0, 0, 0} + /* "(tree fragment)":3 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError # <<<<<<<<<<<<<< + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_PickleError = __pyx_t_2; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":4 + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_PickleError); + __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":2 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + */ + } + + /* "(tree fragment)":5 + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v___pyx_type); + __Pyx_GIVEREF(__pyx_v___pyx_type); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + */ + __pyx_t_1 = (__pyx_v___pyx_state != Py_None); + __pyx_t_7 = (__pyx_t_1 != 0); + if (__pyx_t_7) { + + /* "(tree fragment)":7 + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) # <<<<<<<<<<<<<< + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error) + __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + */ + } + + /* "(tree fragment)":8 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_PickleError); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): + */ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":10 + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if hasattr(result, '__dict__'): + * result.__dict__.update(__pyx_state[1]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(2, 10, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_result->name); + __Pyx_DECREF(__pyx_v_result->name); + __pyx_v_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":11 + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<< + * result.__dict__.update(__pyx_state[1]) + */ + __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":12 + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): + * result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_update); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(2, 12, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":11 + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<< + * result.__dict__.update(__pyx_state[1]) + */ + } + + /* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_array___dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_array[] = { @@ -18641,7 +20078,7 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -18669,6 +20106,8 @@ static int __pyx_tp_clear_Enum(PyObject *o) { } static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -18756,7 +20195,7 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -18868,6 +20307,8 @@ static PyMethodDef __pyx_methods_memoryview[] = { {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -18993,7 +20434,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -19037,6 +20478,8 @@ static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UN } static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -19147,6 +20590,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, @@ -19158,6 +20602,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, {&__pyx_n_s_PIXELS_PER_PATH, __pyx_k_PIXELS_PER_PATH, sizeof(__pyx_k_PIXELS_PER_PATH), 0, 0, 1, 1}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_PyQt5_QtCore, __pyx_k_PyQt5_QtCore, sizeof(__pyx_k_PyQt5_QtCore), 0, 0, 1, 1}, {&__pyx_n_s_PyQt5_QtGui, __pyx_k_PyQt5_QtGui, sizeof(__pyx_k_PyQt5_QtGui), 0, 0, 1, 1}, {&__pyx_n_s_QByteArray, __pyx_k_QByteArray, sizeof(__pyx_k_QByteArray), 0, 0, 1, 1}, @@ -19167,17 +20612,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1}, {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_constants, __pyx_k_constants, sizeof(__pyx_k_constants), 0, 0, 1, 1}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, @@ -19187,6 +20636,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_f8, __pyx_k_f8, sizeof(__pyx_k_f8), 0, 1, 0, 0}, {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, + {&__pyx_n_s_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, @@ -19201,6 +20651,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, @@ -19209,6 +20660,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, {&__pyx_n_s_negative, __pyx_k_negative, sizeof(__pyx_k_negative), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0}, @@ -19216,11 +20669,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_repeat, __pyx_k_repeat, sizeof(__pyx_k_repeat), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, @@ -19229,6 +20690,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, {&__pyx_n_s_subpath_ranges, __pyx_k_subpath_ranges, sizeof(__pyx_k_subpath_ranges), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, @@ -19237,6 +20699,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, {&__pyx_n_s_urh, __pyx_k_urh, sizeof(__pyx_k_urh), 0, 0, 1, 1}, {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1}, {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, @@ -19247,8 +20710,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 42, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 110, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error) @@ -19266,86 +20729,86 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "src/urh/cythonext/path_creator.pyx":88 + /* "src/urh/cythonext/path_creator.pyx":93 * cdef long long n = x.shape[0] * # create empty array, pad with extra space on either end * arr = np.zeros(n + 2, dtype=[('x', '>f8'), ('y', '>f8'), ('c', '>i4')]) # <<<<<<<<<<<<<< * #arr = arr.byteswap().newbyteorder() # force native byteorder * */ - __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_u_x, __pyx_kp_u_f8); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_u_x, __pyx_kp_u_f8); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_u_y, __pyx_kp_u_f8); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_u_y, __pyx_kp_u_f8); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_c, __pyx_kp_u_i4); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_c, __pyx_kp_u_i4); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "src/urh/cythonext/path_creator.pyx":93 + /* "src/urh/cythonext/path_creator.pyx":98 * # write first two integers * byte_view = arr.view(dtype=np.uint8) * byte_view[:12] = 0 # <<<<<<<<<<<<<< * byte_view.data[12:20] = struct.pack('>ii', n, 0) * */ - __pyx_slice__4 = PySlice_New(Py_None, __pyx_int_12, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_slice__4 = PySlice_New(Py_None, __pyx_int_12, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__4); __Pyx_GIVEREF(__pyx_slice__4); - /* "src/urh/cythonext/path_creator.pyx":94 + /* "src/urh/cythonext/path_creator.pyx":99 * byte_view = arr.view(dtype=np.uint8) * byte_view[:12] = 0 * byte_view.data[12:20] = struct.pack('>ii', n, 0) # <<<<<<<<<<<<<< * * arr[1:-1]['x'] = x */ - __pyx_slice__5 = PySlice_New(__pyx_int_12, __pyx_int_20, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_slice__5 = PySlice_New(__pyx_int_12, __pyx_int_20, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__5); __Pyx_GIVEREF(__pyx_slice__5); - /* "src/urh/cythonext/path_creator.pyx":96 + /* "src/urh/cythonext/path_creator.pyx":101 * byte_view.data[12:20] = struct.pack('>ii', n, 0) * * arr[1:-1]['x'] = x # <<<<<<<<<<<<<< * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht * arr[1:-1]['c'] = 1 */ - __pyx_slice__6 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_slice__6 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__6); __Pyx_GIVEREF(__pyx_slice__6); - /* "src/urh/cythonext/path_creator.pyx":97 + /* "src/urh/cythonext/path_creator.pyx":102 * * arr[1:-1]['x'] = x * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht # <<<<<<<<<<<<<< * arr[1:-1]['c'] = 1 * */ - __pyx_slice__7 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_slice__7 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__7); __Pyx_GIVEREF(__pyx_slice__7); - /* "src/urh/cythonext/path_creator.pyx":98 + /* "src/urh/cythonext/path_creator.pyx":103 * arr[1:-1]['x'] = x * arr[1:-1]['y'] = np.negative(y) # y negieren, da Koordinatensystem umgedreht * arr[1:-1]['c'] = 1 # <<<<<<<<<<<<<< * * cdef long long last_index = 20 * (n + 1) */ - __pyx_slice__8 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_slice__8 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__8); __Pyx_GIVEREF(__pyx_slice__8); - /* "src/urh/cythonext/path_creator.pyx":101 + /* "src/urh/cythonext/path_creator.pyx":106 * * cdef long long last_index = 20 * (n + 1) * byte_view.data[last_index:last_index + 4] = struct.pack('>i', 0) # <<<<<<<<<<<<<< * * try: */ - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_u_i, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_u_i, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); @@ -19512,6 +20975,25 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + /* "View.MemoryView":484 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: @@ -19519,9 +21001,9 @@ static int __Pyx_InitCachedConstants(void) { * else: * if len(self.view.format) == 1: */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); /* "View.MemoryView":556 * if self.view.strides == NULL: @@ -19530,9 +21012,9 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); /* "View.MemoryView":563 * def suboffsets(self): @@ -19541,12 +21023,31 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__27 = PyTuple_New(1); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); + __pyx_tuple__29 = PyTuple_New(1); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__27, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__27); + PyTuple_SET_ITEM(__pyx_tuple__29, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_tuple__29); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); /* "View.MemoryView":668 * if item is Ellipsis: @@ -19555,9 +21056,9 @@ static int __Pyx_InitCachedConstants(void) { * seen_ellipsis = True * else: */ - __pyx_slice__28 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(2, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__28); - __Pyx_GIVEREF(__pyx_slice__28); + __pyx_slice__32 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__32)) __PYX_ERR(2, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__32); + __Pyx_GIVEREF(__pyx_slice__32); /* "View.MemoryView":671 * seen_ellipsis = True @@ -19566,9 +21067,9 @@ static int __Pyx_InitCachedConstants(void) { * have_slices = True * else: */ - __pyx_slice__29 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__29)) __PYX_ERR(2, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__29); - __Pyx_GIVEREF(__pyx_slice__29); + __pyx_slice__33 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__33)) __PYX_ERR(2, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__33); + __Pyx_GIVEREF(__pyx_slice__33); /* "View.MemoryView":682 * nslices = ndim - len(result) @@ -19577,9 +21078,9 @@ static int __Pyx_InitCachedConstants(void) { * * return have_slices or nslices, tuple(result) */ - __pyx_slice__30 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__30)) __PYX_ERR(2, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__30); - __Pyx_GIVEREF(__pyx_slice__30); + __pyx_slice__34 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__34)) __PYX_ERR(2, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__34); + __Pyx_GIVEREF(__pyx_slice__34); /* "View.MemoryView":689 * for suboffset in suboffsets[:ndim]: @@ -19588,9 +21089,28 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(2, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); /* "View.MemoryView":282 * return self.name @@ -19599,9 +21119,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(2, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); /* "View.MemoryView":283 * @@ -19610,9 +21130,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect = Enum("") * */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(2, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(2, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); /* "View.MemoryView":284 * cdef generic = Enum("") @@ -19621,9 +21141,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(2, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(2, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); /* "View.MemoryView":287 * @@ -19632,9 +21152,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(2, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); /* "View.MemoryView":288 * @@ -19643,9 +21163,19 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(2, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + __pyx_tuple__43 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -19667,6 +21197,7 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -19731,6 +21262,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif @@ -19769,9 +21301,11 @@ PyMODINIT_FUNC PyInit_path_creator(void) if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) __pyx_type___pyx_array.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) __pyx_array_type = &__pyx_type___pyx_array; if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 275, __pyx_L1_error) __pyx_type___pyx_MemviewEnum.tp_print = 0; + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 275, __pyx_L1_error) __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; @@ -19784,6 +21318,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) __pyx_type___pyx_memoryview.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) __pyx_memoryview_type = &__pyx_type___pyx_memoryview; __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; @@ -19793,6 +21328,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) __pyx_type___pyx_memoryviewslice.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -19889,8 +21425,8 @@ PyMODINIT_FUNC PyInit_path_creator(void) * from cython.parallel import prange * * from urh import constants # <<<<<<<<<<<<<< + * import math * - * cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -19906,6 +21442,18 @@ PyMODINIT_FUNC PyInit_path_creator(void) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "src/urh/cythonext/path_creator.pyx":15 + * + * from urh import constants + * import math # <<<<<<<<<<<<<< + * + * cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "src/urh/cythonext/path_creator.pyx":1 * import struct # <<<<<<<<<<<<<< * # noinspection PyUnresolvedReferences @@ -19925,7 +21473,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 207, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_array_type); @@ -19936,7 +21484,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 282, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_2); @@ -19950,7 +21498,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) * cdef indirect = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 283, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_2); @@ -19964,7 +21512,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 284, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_2); @@ -19978,7 +21526,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) * cdef indirect_contiguous = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_2); @@ -19992,7 +21540,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); @@ -20034,7 +21582,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 535, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryview_type); @@ -20047,16 +21595,26 @@ PyMODINIT_FUNC PyInit_path_creator(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 981, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryviewslice_type); - /* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): */ /*--- Wrapped vars code ---*/ @@ -20067,7 +21625,7 @@ PyMODINIT_FUNC PyInit_path_creator(void) __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init src.urh.cythonext.path_creator", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init src.urh.cythonext.path_creator", 0, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { @@ -20269,8 +21827,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_LeaveRecursiveCall(); return result; } -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL +#endif +#endif /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL @@ -20278,17 +21836,22 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + } } -#endif // CYTHON_FAST_PYCCALL +#endif /* BufferFormatCheck */ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { @@ -20987,9 +22550,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -21002,9 +22568,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -21056,6 +22625,66 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallMethO */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -21225,72 +22854,8 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in return 0; } -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - /* SliceObject */ - static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, + static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { @@ -21388,7 +22953,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } /* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { @@ -21485,7 +23050,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->exc_type; *value = tstate->exc_value; @@ -21509,7 +23074,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { PyObject *exc_type = tstate->curexc_type; if (exc_type == err) return 1; @@ -21519,7 +23084,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { @@ -21580,7 +23145,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -21601,7 +23166,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -21625,7 +23190,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #endif /* RaiseException */ - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -21788,25 +23353,25 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; @@ -21819,7 +23384,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -21837,7 +23402,16 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } else if (length == 1) { return (equals == Py_EQ); } else { - int result = memcmp(ps1, ps2, (size_t)length); + int result; +#if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { @@ -21857,7 +23431,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -21897,6 +23471,21 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; @@ -21941,7 +23530,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -21954,7 +23543,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -21986,8 +23575,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } +/* GetAttr3 */ + static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + goto bad; + PyErr_Clear(); + r = d; + Py_INCREF(d); + } + return r; +bad: + return NULL; +} + /* SwapException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; @@ -22012,7 +23616,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -22086,7 +23690,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -22202,12 +23806,12 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } /* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; @@ -22248,8 +23852,40 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif } +/* ImportFrom */ + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* HasAttr */ + static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else @@ -22266,22 +23902,107 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED return -1; } -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif +/* SetupReduce */ + #define __Pyx_setup_reduce_GET_ATTR_OR_BAD(res, obj, name) res = PyObject_GetAttrString(obj, name); if (res == NULL) goto BAD; +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = PyObject_GetAttrString(meth, "__name__"); + if (name_attr) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (ret < 0) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject* builtin_object = NULL; + static PyObject *object_reduce = NULL; + static PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + if (PyObject_HasAttrString(type_obj, "__getstate__")) goto GOOD; + if (object_reduce_ex == NULL) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(builtin_object, __pyx_b, "object"); + __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce, builtin_object, "__reduce__"); + __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce_ex, builtin_object, "__reduce_ex__"); + } + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_ex, type_obj, "__reduce_ex__"); + if (reduce_ex == object_reduce_ex) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce, type_obj, "__reduce__"); + if (object_reduce == reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_cython, type_obj, "__reduce_cython__"); + ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce__", reduce_cython); if (ret < 0) goto BAD; + ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce_cython__"); if (ret < 0) goto BAD; + setstate = PyObject_GetAttrString(type_obj, "__setstate__"); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(setstate_cython, type_obj, "__setstate_cython__"); + ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate__", setstate_cython); if (ret < 0) goto BAD; + ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate_cython__"); if (ret < 0) goto BAD; + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto GOOD; +BAD: + if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + ret = -1; +GOOD: + Py_XDECREF(builtin_object); + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* CLineInTraceback */ + static int __Pyx_CLineForTraceback(int c_line) { +#ifdef CYTHON_CLINE_IN_TRACEBACK + return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0; +#else + PyObject **cython_runtime_dict; + PyObject *use_cline; + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (unlikely(!cython_runtime_dict)) { + PyObject *ptype, *pvalue, *ptraceback; + PyObject *use_cline_obj; + PyErr_Fetch(&ptype, &pvalue, &ptraceback); + use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + use_cline = NULL; + } + PyErr_Restore(ptype, pvalue, ptraceback); + } else { + use_cline = PyDict_GetItem(*_PyObject_GetDictPtr(__pyx_cython_runtime), __pyx_n_s_cline_in_traceback); + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (PyObject_Not(use_cline) != 0) { + c_line = 0; } - return value; + return c_line; +#endif } /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -22361,7 +24082,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -22420,12 +24141,15 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (c_line) { + c_line = __Pyx_CLineForTraceback(c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ @@ -22464,8 +24188,8 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif - /* MemviewSliceIsContig */ - static int + /* MemviewSliceIsContig */ + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { @@ -22488,7 +24212,7 @@ __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, } /* OverlappingSlices */ - static void + static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) @@ -22524,7 +24248,7 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, } /* Capsule */ - static CYTHON_INLINE PyObject * + static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; @@ -22537,7 +24261,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) } /* TypeInfoCompare */ - static int + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; @@ -22578,7 +24302,7 @@ __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) } /* MemviewSliceValidateAndInit */ - static int + static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) @@ -22760,7 +24484,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -22783,7 +24507,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -22805,7 +24529,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -22828,7 +24552,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -22859,7 +24583,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_PY_LONG_LONG(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_PY_LONG_LONG(const char *itemp) { return (PyObject *) __Pyx_PyInt_From_PY_LONG_LONG(*(PY_LONG_LONG *) itemp); } static CYTHON_INLINE int __pyx_memview_set_PY_LONG_LONG(const char *itemp, PyObject *obj) { @@ -22871,7 +24595,7 @@ static CYTHON_INLINE int __pyx_memview_set_PY_LONG_LONG(const char *itemp, PyObj } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -22902,7 +24626,7 @@ static CYTHON_INLINE int __pyx_memview_set_PY_LONG_LONG(const char *itemp, PyObj } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -22933,7 +24657,7 @@ static CYTHON_INLINE int __pyx_memview_set_PY_LONG_LONG(const char *itemp, PyObj } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) { const npy_int64 neg_one = (npy_int64) -1, const_zero = (npy_int64) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -22964,7 +24688,7 @@ static CYTHON_INLINE int __pyx_memview_set_PY_LONG_LONG(const char *itemp, PyObj } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp) { return (PyObject *) __Pyx_PyInt_From_npy_int64(*(__pyx_t_5numpy_int64_t *) itemp); } static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char *itemp, PyObject *obj) { @@ -22976,7 +24700,7 @@ static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) { return (PyObject *) PyFloat_FromDouble(*(float *) itemp); } static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj) { @@ -22988,7 +24712,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -23008,7 +24732,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -23143,7 +24867,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -23163,7 +24887,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -23298,7 +25022,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob #endif /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -23329,7 +25053,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -23360,7 +25084,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice + static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, @@ -23427,7 +25151,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { + static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -23616,7 +25340,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { + static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -23805,7 +25529,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) { + static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) { const npy_int64 neg_one = (npy_int64) -1, const_zero = (npy_int64) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -23994,7 +25718,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -24183,19 +25907,19 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) -1, const_zero = (char) 0; + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (char) val; + return (long) val; } } else #endif @@ -24204,32 +25928,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; @@ -24243,86 +25967,86 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (char) -1; + return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif - if (sizeof(char) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -24331,7 +26055,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - char val; + long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -24351,40 +26075,40 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return val; } #endif - return (char) -1; + return (long) -1; } } else { - char val; + long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (char) -1; - val = __Pyx_PyInt_As_char(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to char"); - return (char) -1; + "value too large to convert to long"); + return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to char"); - return (char) -1; + "can't convert negative value to long"); + return (long) -1; } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; + static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) -1, const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + if (sizeof(char) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (long) val; + return (char) val; } } else #endif @@ -24393,32 +26117,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 0: return (char) 0; + case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; @@ -24432,86 +26156,86 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (long) -1; + return (char) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(char) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case 0: return (char) 0; + case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; } #endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + if (sizeof(char) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -24520,7 +26244,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - long val; + char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -24540,28 +26264,28 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return val; } #endif - return (long) -1; + return (char) -1; } } else { - long val; + char val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); + if (!tmp) return (char) -1; + val = __Pyx_PyInt_As_char(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; + "value too large to convert to char"); + return (char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; + "can't convert negative value to char"); + return (char) -1; } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_PY_LONG_LONG(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_PY_LONG_LONG(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -24584,7 +26308,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -24607,7 +26331,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -24623,7 +26347,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule + #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; @@ -24641,7 +26365,7 @@ static PyObject *__Pyx_ImportModule(const char *name) { #endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) @@ -24706,7 +26430,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class #endif /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -24731,6 +26455,8 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class #endif if (!*t->p) return -1; + if (PyObject_Hash(*t->p) == -1) + PyErr_Clear(); ++t; } return 0; @@ -24739,11 +26465,11 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII diff --git a/src/urh/cythonext/path_creator.pyx b/src/urh/cythonext/path_creator.pyx index 41199ebc77..be5b9a06e0 100644 --- a/src/urh/cythonext/path_creator.pyx +++ b/src/urh/cythonext/path_creator.pyx @@ -12,6 +12,7 @@ from PyQt5.QtGui import QPainterPath from cython.parallel import prange from urh import constants +import math cpdef create_path(float[:] samples, long long start, long long end, list subpath_ranges=None): cdef float[:] values @@ -59,10 +60,14 @@ cpdef create_path(float[:] samples, long long start, long long end, list subpath cdef list result = [] if scale_factor == 0: scale_factor = 1 # prevent division by zero + for subpath_range in subpath_ranges: - substart = int((subpath_range[0]-start)/scale_factor) - subend = int((subpath_range[1]-start)/scale_factor) - result.append(array_to_QPath(x[substart:subend], values[substart:subend])) + sub_start = ((((subpath_range[0]-start)/scale_factor) * scale_factor) - 2*scale_factor) / scale_factor + sub_start =int(max(0, math.floor(sub_start))) + sub_end = ((((subpath_range[1]-start)/scale_factor) * scale_factor) + 2*scale_factor) / scale_factor + sub_end = int(max(0, math.ceil(sub_end))) + result.append(array_to_QPath(x[sub_start:sub_end], values[sub_start:sub_end])) + return result diff --git a/src/urh/cythonext/signalFunctions.cpp b/src/urh/cythonext/signalFunctions.cpp index e396c27049..54c69ee38d 100644 --- a/src/urh/cythonext/signalFunctions.cpp +++ b/src/urh/cythonext/signalFunctions.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.25.2 */ +/* Generated by Cython 0.26 */ /* BEGIN: Cython Metadata { @@ -10,7 +10,11 @@ "extra_link_args": [ "-fopenmp" ], - "language": "c++" + "language": "c++", + "name": "urh.cythonext.signalFunctions", + "sources": [ + "src/urh/cythonext/signalFunctions.pyx" + ] }, "module_name": "urh.cythonext.signalFunctions" } @@ -23,7 +27,7 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else -#define CYTHON_ABI "0_25_2" +#define CYTHON_ABI "0_26" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -45,6 +49,7 @@ END: Cython Metadata */ #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif +#define __PYX_COMMA , #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG @@ -197,16 +202,20 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); +#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif @@ -333,6 +342,12 @@ END: Cython Metadata */ #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -387,6 +402,35 @@ END: Cython Metadata */ # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #ifdef __cplusplus + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__)) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -511,8 +555,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString @@ -525,8 +569,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) @@ -648,10 +695,12 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -997,6 +1046,18 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* Declarations.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< npy_float64 > __pyx_t_npy_float64_complex; + #else + typedef npy_float64 _Complex __pyx_t_npy_float64_complex; + #endif +#else + typedef struct { npy_float64 real, imag; } __pyx_t_npy_float64_complex; +#endif +static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64, npy_float64); + /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1300,6 +1361,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); @@ -1333,7 +1401,7 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); // PROTO + __Pyx_TypeInfo* type); /* MemviewSliceInit.proto */ #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d @@ -1442,11 +1510,9 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); +/* ArgTypeTest.proto */ +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); @@ -1508,10 +1574,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - /* IncludeStringH.proto */ #include @@ -1537,12 +1599,29 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); +/* decode_c_string_utf16.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + /* decode_c_string.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1601,11 +1680,20 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); #define __PYX_FORCE_INIT_THREADS 0 #endif +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* HasAttr.proto */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); + /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* CLineInTraceback.proto */ +static int __Pyx_CLineForTraceback(int c_line); /* CodeObjectCache.proto */ typedef struct { @@ -1818,6 +1906,44 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq_npy_float64(a, b) ((a)==(b)) + #define __Pyx_c_sum_npy_float64(a, b) ((a)+(b)) + #define __Pyx_c_diff_npy_float64(a, b) ((a)-(b)) + #define __Pyx_c_prod_npy_float64(a, b) ((a)*(b)) + #define __Pyx_c_quot_npy_float64(a, b) ((a)/(b)) + #define __Pyx_c_neg_npy_float64(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_npy_float64(z) ((z)==(npy_float64)0) + #define __Pyx_c_conj_npy_float64(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_npy_float64(z) (::std::abs(z)) + #define __Pyx_c_pow_npy_float64(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_npy_float64(z) ((z)==0) + #define __Pyx_c_conj_npy_float64(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_npy_float64(z) (cabs(z)) + #define __Pyx_c_pow_npy_float64(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_sum_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_diff_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_quot_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_neg_npy_float64(__pyx_t_npy_float64_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_npy_float64(__pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_conj_npy_float64(__pyx_t_npy_float64_complex); + #if 1 + static CYTHON_INLINE npy_float64 __Pyx_c_abs_npy_float64(__pyx_t_npy_float64_complex); + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_pow_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex); + #endif +#endif + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); @@ -1841,10 +1967,10 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_PY_LONG_LONG(PyObject *); @@ -1944,6 +2070,7 @@ static unsigned PY_LONG_LONG __pyx_f_3src_3urh_9cythonext_15signalFunctions_esti static int __pyx_f_3src_3urh_9cythonext_15signalFunctions_find_nearest_center(float, __Pyx_memviewslice, int, int __pyx_skip_dispatch); /*proto*/ static float __pyx_f_3src_3urh_9cythonext_15signalFunctions_estimate_qad_center(__Pyx_memviewslice, unsigned int, int __pyx_skip_dispatch); /*proto*/ static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_fir_filter(__Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/ +static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_iir_filter(PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -1976,7 +2103,9 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_float_complex = { "float complex", NULL, sizeof(__pyx_t_float_complex), { 0 }, 0, 'C', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_PY_LONG_LONG = { "unsigned long long", NULL, sizeof(unsigned PY_LONG_LONG), { 0 }, 0, IS_UNSIGNED(unsigned PY_LONG_LONG) ? 'U' : 'I', IS_UNSIGNED(unsigned PY_LONG_LONG), 0 }; #define __Pyx_MODULE_NAME "src.urh.cythonext.signalFunctions" @@ -1989,17 +2118,21 @@ static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; static const char __pyx_k_C[] = "C"; static const char __pyx_k_O[] = "O"; +static const char __pyx_k_a[] = "a"; +static const char __pyx_k_b[] = "b"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; +static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_base[] = "base"; +static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; @@ -2028,10 +2161,14 @@ static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_minmax[] = "minmax"; static const char __pyx_k_name_2[] = "__name__"; +static const char __pyx_k_pickle[] = "pickle"; +static const char __pyx_k_result[] = "result"; static const char __pyx_k_sample[] = "sample"; +static const char __pyx_k_signal[] = "signal"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_uint64[] = "uint64"; static const char __pyx_k_unpack[] = "unpack"; +static const char __pyx_k_update[] = "update"; static const char __pyx_k_argsort[] = "argsort"; static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_centers[] = "centers"; @@ -2042,10 +2179,12 @@ static const char __pyx_k_samples[] = "samples"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_mod_type[] = "mod_type"; +static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_complex64[] = "complex64"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_noise_mag[] = "noise_mag"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_tolerance[] = "tolerance"; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_ValueError[] = "ValueError"; @@ -2054,17 +2193,25 @@ static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_qad_center[] = "qad_center"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; +static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_filter_taps[] = "filter_taps"; static const char __pyx_k_num_centers[] = "num_centers"; static const char __pyx_k_qad_samples[] = "qad_samples"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; +static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_demod_samples[] = "demod_samples"; static const char __pyx_k_input_samples[] = "input_samples"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_urh_cythonext[] = "urh.cythonext"; +static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_modulation_type[] = "modulation_type"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_strided_and_indirect[] = ""; static const char __pyx_k_contiguous_and_direct[] = ""; @@ -2083,6 +2230,7 @@ static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; +static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; @@ -2090,6 +2238,7 @@ static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; +static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; @@ -2103,6 +2252,7 @@ static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; static PyObject *__pyx_n_s_ImportError; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0; static PyObject *__pyx_n_s_IndexError; static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; @@ -2113,14 +2263,18 @@ static PyObject *__pyx_kp_s_MemoryView_of_r_object; static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; static PyObject *__pyx_n_b_O; static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; +static PyObject *__pyx_n_s_PickleError; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_View_MemoryView; +static PyObject *__pyx_n_s_a; static PyObject *__pyx_n_s_allocate_buffer; static PyObject *__pyx_n_s_argsort; static PyObject *__pyx_n_s_array; static PyObject *__pyx_n_s_asarray; +static PyObject *__pyx_n_s_b; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_bit_length; static PyObject *__pyx_n_s_c; @@ -2128,10 +2282,12 @@ static PyObject *__pyx_n_u_c; static PyObject *__pyx_n_s_center; static PyObject *__pyx_n_s_centers; static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_complex64; static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_n_s_demod_samples; +static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_s_dtype; static PyObject *__pyx_n_s_dtype_is_object; static PyObject *__pyx_n_s_encode; @@ -2160,6 +2316,8 @@ static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_ndim; +static PyObject *__pyx_n_s_new; +static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_noise_mag; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_num_centers; @@ -2169,14 +2327,23 @@ static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_order; static PyObject *__pyx_n_s_pack; +static PyObject *__pyx_n_s_pickle; +static PyObject *__pyx_n_s_pyx_checksum; static PyObject *__pyx_n_s_pyx_getbuffer; +static PyObject *__pyx_n_s_pyx_state; +static PyObject *__pyx_n_s_pyx_type; +static PyObject *__pyx_n_s_pyx_unpickle_Enum; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_qad_center; static PyObject *__pyx_n_s_qad_samples; static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reduce_cython; +static PyObject *__pyx_n_s_result; static PyObject *__pyx_n_s_sample; static PyObject *__pyx_n_s_samples; +static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; +static PyObject *__pyx_n_s_signal; static PyObject *__pyx_n_s_size; static PyObject *__pyx_n_s_start; static PyObject *__pyx_n_s_step; @@ -2184,6 +2351,7 @@ static PyObject *__pyx_n_s_stop; static PyObject *__pyx_kp_s_strided_and_direct; static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; static PyObject *__pyx_kp_s_strided_and_indirect; +static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_struct; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_tolerance; @@ -2192,6 +2360,7 @@ static PyObject *__pyx_kp_s_unable_to_allocate_array_data; static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_unpack; +static PyObject *__pyx_n_s_update; static PyObject *__pyx_n_s_urh_cythonext; static PyObject *__pyx_n_s_util; static PyObject *__pyx_n_s_zeros; @@ -2204,6 +2373,7 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_10estimate_bit_ static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_12find_nearest_center(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_sample, __Pyx_memviewslice __pyx_v_centers, int __pyx_v_num_centers); /* proto */ static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_14estimate_qad_center(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_samples, unsigned int __pyx_v_num_centers); /* proto */ static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_16fir_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_input_samples, __Pyx_memviewslice __pyx_v_filter_taps); /* proto */ +static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_18iir_filter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_b, PyArrayObject *__pyx_v_signal); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ @@ -2213,8 +2383,12 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ @@ -2236,8 +2410,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -2245,6 +2424,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; +static PyObject *__pyx_int_184977713; static PyObject *__pyx_int_neg_1; static float __pyx_k_; static float __pyx_k__2; @@ -2255,9 +2435,9 @@ static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__21; -static PyObject *__pyx_slice__22; -static PyObject *__pyx_slice__23; +static PyObject *__pyx_slice__25; +static PyObject *__pyx_slice__26; +static PyObject *__pyx_slice__27; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; @@ -2269,12 +2449,20 @@ static PyObject *__pyx_tuple__17; static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__27; static PyObject *__pyx_tuple__28; static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__31; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_codeobj__37; /* "src/urh/cythonext/signalFunctions.pyx":23 * @@ -3175,6 +3363,7 @@ static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_afp_demod(_ #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); #endif /*try:*/ { __pyx_t_10 = __pyx_v_ns; @@ -3369,6 +3558,7 @@ static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_afp_demod(_ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L7; @@ -3487,8 +3677,11 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_3afp_demod(PyOb const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -3497,11 +3690,13 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_3afp_demod(PyOb case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_noise_mag)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("afp_demod", 1, 3, 3, 1); __PYX_ERR(0, 80, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mod_type)) != 0)) kw_args--; else { @@ -3972,7 +4167,7 @@ static unsigned PY_LONG_LONG __pyx_f_3src_3urh_9cythonext_15signalFunctions_find /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.find_signal_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.find_signal_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3995,7 +4190,9 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_5find_signal_st const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -4004,6 +4201,7 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_5find_signal_st case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_demod_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mod_type)) != 0)) kw_args--; else { @@ -4215,7 +4413,7 @@ static unsigned PY_LONG_LONG __pyx_f_3src_3urh_9cythonext_15signalFunctions_find /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.find_signal_end", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.find_signal_end", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4238,7 +4436,9 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_7find_signal_en const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -4247,6 +4447,7 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_7find_signal_en case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_demod_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mod_type)) != 0)) kw_args--; else { @@ -5241,10 +5442,15 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_9grab_pulse_len const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -5253,21 +5459,25 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_9grab_pulse_len case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_center)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("grab_pulse_lens", 1, 5, 5, 1); __PYX_ERR(0, 198, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tolerance)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("grab_pulse_lens", 1, 5, 5, 2); __PYX_ERR(0, 198, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_modulation_type)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("grab_pulse_lens", 1, 5, 5, 3); __PYX_ERR(0, 198, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bit_length)) != 0)) kw_args--; else { @@ -5502,7 +5712,7 @@ __pyx_t_3 = __pyx_f_3src_3urh_9cythonext_15signalFunctions_grab_pulse_lens(__pyx __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.estimate_bit_len", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.estimate_bit_len", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_ppseq, 1); @@ -5528,9 +5738,13 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_11estimate_bit_ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -5539,16 +5753,19 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_11estimate_bit_ case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_qad_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_qad_center)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("estimate_bit_len", 1, 4, 4, 1); __PYX_ERR(0, 288, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tolerance)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("estimate_bit_len", 1, 4, 4, 2); __PYX_ERR(0, 288, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mod_type)) != 0)) kw_args--; else { @@ -5766,8 +5983,11 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_13find_nearest_ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -5776,11 +5996,13 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_13find_nearest_ case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_centers)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("find_nearest_center", 1, 3, 3, 1); __PYX_ERR(0, 300, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_centers)) != 0)) kw_args--; else { @@ -6463,7 +6685,7 @@ static float __pyx_f_3src_3urh_9cythonext_15signalFunctions_estimate_qad_center( __Pyx_XDECREF(__pyx_t_9); __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1); - __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.estimate_qad_center", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("src.urh.cythonext.signalFunctions.estimate_qad_center", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tmp); @@ -6491,7 +6713,9 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_15estimate_qad_ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -6500,6 +6724,7 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_15estimate_qad_ case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_centers)) != 0)) kw_args--; else { @@ -6709,10 +6934,18 @@ static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_fir_filter( * * * return output[:N] # <<<<<<<<<<<<<< + * + * cpdef np.ndarray[np.complex64_t, ndim=1] iir_filter(np.ndarray[np.float64_t, ndim=1] a, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_6 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_output), 0, __pyx_v_N, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PySlice_New(Py_None, __pyx_t_6, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_output), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 395, __pyx_L1_error) __pyx_r = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; @@ -6767,7 +7000,9 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_17fir_filter(Py const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -6776,6 +7011,7 @@ static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_17fir_filter(Py case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filter_taps)) != 0)) kw_args--; else { @@ -6834,169 +7070,583 @@ static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_16fir_filter(CY return __pyx_r; } -/* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; +/* "src/urh/cythonext/signalFunctions.pyx":397 + * return output[:N] + * + * cpdef np.ndarray[np.complex64_t, ndim=1] iir_filter(np.ndarray[np.float64_t, ndim=1] a, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] b, + * np.ndarray[np.complex64_t, ndim=1] signal): + */ + +static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_19iir_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_3src_3urh_9cythonext_15signalFunctions_iir_filter(PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_b, PyArrayObject *__pyx_v_signal, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyArrayObject *__pyx_v_result = 0; + long __pyx_v_n; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_M; + long __pyx_v_N; + __Pyx_LocalBuf_ND __pyx_pybuffernd_a; + __Pyx_Buffer __pyx_pybuffer_a; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + __Pyx_LocalBuf_ND __pyx_pybuffernd_result; + __Pyx_Buffer __pyx_pybuffer_result; + __Pyx_LocalBuf_ND __pyx_pybuffernd_signal; + __Pyx_Buffer __pyx_pybuffer_signal; + PyArrayObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + PyArrayObject *__pyx_t_7 = NULL; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + __pyx_t_float_complex __pyx_t_14; + __pyx_t_npy_float64_complex __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + __Pyx_RefNannySetupContext("iir_filter", 0); + __pyx_pybuffer_result.pybuffer.buf = NULL; + __pyx_pybuffer_result.refcount = 0; + __pyx_pybuffernd_result.data = NULL; + __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; + __pyx_pybuffer_a.pybuffer.buf = NULL; + __pyx_pybuffer_a.refcount = 0; + __pyx_pybuffernd_a.data = NULL; + __pyx_pybuffernd_a.rcbuffer = &__pyx_pybuffer_a; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + __pyx_pybuffer_signal.pybuffer.buf = NULL; + __pyx_pybuffer_signal.refcount = 0; + __pyx_pybuffernd_signal.data = NULL; + __pyx_pybuffernd_signal.rcbuffer = &__pyx_pybuffer_signal; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a.rcbuffer->pybuffer, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_pybuffernd_a.diminfo[0].strides = __pyx_pybuffernd_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a.diminfo[0].shape = __pyx_pybuffernd_a.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_signal.rcbuffer->pybuffer, (PyObject*)__pyx_v_signal, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) } + __pyx_pybuffernd_signal.diminfo[0].strides = __pyx_pybuffernd_signal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_signal.diminfo[0].shape = __pyx_pybuffernd_signal.rcbuffer->pybuffer.shape[0]; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":203 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< + /* "src/urh/cythonext/signalFunctions.pyx":400 + * np.ndarray[np.float64_t, ndim=1] b, + * np.ndarray[np.complex64_t, ndim=1] signal): + * cdef np.ndarray[np.complex64_t, ndim=1] result = np.zeros(len(signal), dtype=np.complex64) # <<<<<<<<<<<<<< * - * cdef int copy_shape, i, ndim + * cdef long n, j, k */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_signal)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 400, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 400, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 400, __pyx_L1_error) + } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_7 = 0; + __pyx_v_result = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":206 - * - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) + /* "src/urh/cythonext/signalFunctions.pyx":403 * + * cdef long n, j, k + * cdef long M = len(a) # <<<<<<<<<<<<<< + * cdef long N = len(b) + * for n in range(max(M, N+1) , len(signal)): */ - __pyx_v_endian_detector = 1; + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_a)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_v_M = __pyx_t_3; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":207 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) + /* "src/urh/cythonext/signalFunctions.pyx":404 + * cdef long n, j, k + * cdef long M = len(a) + * cdef long N = len(b) # <<<<<<<<<<<<<< + * for n in range(max(M, N+1) , len(signal)): + * for j in range(M): */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_v_N = __pyx_t_3; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":209 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + /* "src/urh/cythonext/signalFunctions.pyx":405 + * cdef long M = len(a) + * cdef long N = len(b) + * for n in range(max(M, N+1) , len(signal)): # <<<<<<<<<<<<<< + * for j in range(M): + * result[n] += a[j] * signal[n-j] */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_signal)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_t_8 = (__pyx_v_N + 1); + __pyx_t_9 = __pyx_v_M; + if (((__pyx_t_8 > __pyx_t_9) != 0)) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + for (__pyx_t_8 = __pyx_t_10; __pyx_t_8 < __pyx_t_3; __pyx_t_8+=1) { + __pyx_v_n = __pyx_t_8; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) + /* "src/urh/cythonext/signalFunctions.pyx":406 + * cdef long N = len(b) + * for n in range(max(M, N+1) , len(signal)): + * for j in range(M): # <<<<<<<<<<<<<< + * result[n] += a[j] * signal[n-j] * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { + __pyx_t_9 = __pyx_v_M; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":212 + /* "src/urh/cythonext/signalFunctions.pyx":407 + * for n in range(max(M, N+1) , len(signal)): + * for j in range(M): + * result[n] += a[j] * signal[n-j] # <<<<<<<<<<<<<< * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 + * for k in range(N): */ - __pyx_v_copy_shape = 1; + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = (__pyx_v_n - __pyx_v_j); + __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_signal.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_signal.diminfo[0].strides)); + __pyx_t_15 = __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex_from_parts((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_a.diminfo[0].strides)), 0), __pyx_t_npy_float64_complex_from_parts(__Pyx_CREAL(__pyx_t_14), __Pyx_CIMAG(__pyx_t_14))); + __pyx_t_16 = __pyx_v_n; + *__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_result.diminfo[0].strides) += __pyx_t_float_complex_from_parts(__Pyx_CREAL(__pyx_t_15), __Pyx_CIMAG(__pyx_t_15)); + } - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) + /* "src/urh/cythonext/signalFunctions.pyx":409 + * result[n] += a[j] * signal[n-j] * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - goto __pyx_L4; - } - - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":214 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< + * for k in range(N): # <<<<<<<<<<<<<< + * result[n] += b[k] * result[n-1-k] * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ - /*else*/ { - __pyx_v_copy_shape = 0; - } - __pyx_L4:; + __pyx_t_9 = __pyx_v_N; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + __pyx_v_k = __pyx_t_11; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 + /* "src/urh/cythonext/signalFunctions.pyx":410 * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") + * for k in range(N): + * result[n] += b[k] * result[n-1-k] # <<<<<<<<<<<<<< + * + * return result */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; + __pyx_t_17 = __pyx_v_k; + __pyx_t_18 = ((__pyx_v_n - 1) - __pyx_v_k); + __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides)); + __pyx_t_15 = __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex_from_parts((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_b.diminfo[0].strides)), 0), __pyx_t_npy_float64_complex_from_parts(__Pyx_CREAL(__pyx_t_14), __Pyx_CIMAG(__pyx_t_14))); + __pyx_t_19 = __pyx_v_n; + *__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_result.diminfo[0].strides) += __pyx_t_float_complex_from_parts(__Pyx_CREAL(__pyx_t_15), __Pyx_CIMAG(__pyx_t_15)); + } } - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":217 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") + /* "src/urh/cythonext/signalFunctions.pyx":412 + * result[n] += b[k] * result[n-1-k] * + * return result # <<<<<<<<<<<<<< */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyArrayObject *)__pyx_v_result); + goto __pyx_L0; - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 + /* "src/urh/cythonext/signalFunctions.pyx":397 + * return output[:N] * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") + * cpdef np.ndarray[np.complex64_t, ndim=1] iir_filter(np.ndarray[np.float64_t, ndim=1] a, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] b, + * np.ndarray[np.complex64_t, ndim=1] signal): */ - if (__pyx_t_1) { - /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":218 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_signal.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("src.urh.cythonext.signalFunctions.iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_signal.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_19iir_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3src_3urh_9cythonext_15signalFunctions_19iir_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_b = 0; + PyArrayObject *__pyx_v_signal = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("iir_filter (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_signal,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("iir_filter", 1, 3, 3, 1); __PYX_ERR(0, 397, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_signal)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("iir_filter", 1, 3, 3, 2); __PYX_ERR(0, 397, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iir_filter") < 0)) __PYX_ERR(0, 397, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_b = ((PyArrayObject *)values[1]); + __pyx_v_signal = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("iir_filter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 397, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("src.urh.cythonext.signalFunctions.iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 397, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) __PYX_ERR(0, 398, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signal), __pyx_ptype_5numpy_ndarray, 1, "signal", 0))) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_r = __pyx_pf_3src_3urh_9cythonext_15signalFunctions_18iir_filter(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_signal); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3src_3urh_9cythonext_15signalFunctions_18iir_filter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_b, PyArrayObject *__pyx_v_signal) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_a; + __Pyx_Buffer __pyx_pybuffer_a; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + __Pyx_LocalBuf_ND __pyx_pybuffernd_signal; + __Pyx_Buffer __pyx_pybuffer_signal; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("iir_filter", 0); + __pyx_pybuffer_a.pybuffer.buf = NULL; + __pyx_pybuffer_a.refcount = 0; + __pyx_pybuffernd_a.data = NULL; + __pyx_pybuffernd_a.rcbuffer = &__pyx_pybuffer_a; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + __pyx_pybuffer_signal.pybuffer.buf = NULL; + __pyx_pybuffer_signal.refcount = 0; + __pyx_pybuffernd_signal.data = NULL; + __pyx_pybuffernd_signal.rcbuffer = &__pyx_pybuffer_signal; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a.rcbuffer->pybuffer, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_pybuffernd_a.diminfo[0].strides = __pyx_pybuffernd_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a.diminfo[0].shape = __pyx_pybuffernd_a.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_signal.rcbuffer->pybuffer, (PyObject*)__pyx_v_signal, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 397, __pyx_L1_error) + } + __pyx_pybuffernd_signal.diminfo[0].strides = __pyx_pybuffernd_signal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_signal.diminfo[0].shape = __pyx_pybuffernd_signal.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_3src_3urh_9cythonext_15signalFunctions_iir_filter(__pyx_v_a, __pyx_v_b, __pyx_v_signal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_signal.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("src.urh.cythonext.signalFunctions.iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_signal.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":197 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":203 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":206 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":207 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":209 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":211 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); + if (__pyx_t_1) { + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":212 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":211 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + goto __pyx_L4; + } + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":214 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + /*else*/ { + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":216 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":217 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":216 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + if (__pyx_t_1) { + + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":218 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -9015,7 +9665,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -9063,7 +9713,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":985 @@ -9146,7 +9796,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -9194,7 +9844,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":991 @@ -9277,7 +9927,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10_try_end; + goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign @@ -9322,7 +9972,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L10_try_end:; + __pyx_L8_try_end:; } /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":997 @@ -9376,10 +10026,15 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -9388,21 +10043,25 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 120, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 120, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode); if (value) { values[3] = value; kw_args--; } } + CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer); @@ -9415,7 +10074,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -9638,7 +10299,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * */ - __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 139, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 139, __pyx_L1_error) __pyx_v_self->format = __pyx_t_6; /* "View.MemoryView":142 @@ -10833,6 +11494,113 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struc return __pyx_r; } +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "View.MemoryView":240 * * @cname("__pyx_array_new") @@ -11028,6 +11796,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -11047,100 +11816,387 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar } __pyx_v_name = values[0]; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 277, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 277, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":278 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name + */ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":277 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":279 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":280 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":279 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef bint use_setstate + * state = (self.name,) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + int __pyx_v_use_setstate; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v__dict = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":4 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += _dict, + */ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":5 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += _dict, + * use_setstate = True + */ + __pyx_t_2 = (__pyx_v__dict != Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":6 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += _dict, # <<<<<<<<<<<<<< + * use_setstate = True + * else: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":7 + * if _dict is not None: + * state += _dict, + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":5 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += _dict, + * use_setstate = True + */ + goto __pyx_L3; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "(tree fragment)":9 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_3; + } + __pyx_L3:; -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + /* "(tree fragment)":10 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + */ + __pyx_t_3 = (__pyx_v_use_setstate != 0); + if (__pyx_t_3) { - /* "View.MemoryView":278 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "(tree fragment)":11 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_184977713); + __Pyx_GIVEREF(__pyx_int_184977713); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "View.MemoryView":277 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "(tree fragment)":10 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + */ + } + + /* "(tree fragment)":13 + * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_184977713); + __Pyx_GIVEREF(__pyx_int_184977713); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef bint use_setstate + * state = (self.name,) */ /* function exit code */ - __pyx_r = 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":279 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * +/* "(tree fragment)":14 + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "View.MemoryView":280 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< - * - * cdef generic = Enum("") + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":279 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * + /* "(tree fragment)":14 + * else: + * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -11255,8 +12311,11 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } @@ -11265,11 +12324,13 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 341, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object); @@ -11282,6 +12343,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; @@ -12414,7 +13476,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L11_try_end; + goto __pyx_L9_try_end; __pyx_L4_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -12474,7 +13536,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L0; - __pyx_L11_try_end:; + __pyx_L9_try_end:; } /* "View.MemoryView":421 @@ -13164,7 +14226,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * else: * if len(self.view.format) == 1: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 484, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 484, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -14005,7 +15067,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 556, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -14119,7 +15181,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__20, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 563, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__22, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -15095,6 +16157,113 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 return __pyx_r; } +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "View.MemoryView":643 * * @cname('__pyx_memoryview_new') @@ -15423,9 +16592,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__21); - __Pyx_GIVEREF(__pyx_slice__21); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__21); + __Pyx_INCREF(__pyx_slice__25); + __Pyx_GIVEREF(__pyx_slice__25); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__25); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 668, __pyx_L1_error) @@ -15458,7 +16627,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__22); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 671, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 671, __pyx_L1_error) } __pyx_L7:; @@ -15603,9 +16772,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__23); - __Pyx_GIVEREF(__pyx_slice__23); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__23); + __Pyx_INCREF(__pyx_slice__27); + __Pyx_GIVEREF(__pyx_slice__27); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__27); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(2, 682, __pyx_L1_error) @@ -15729,7 +16898,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 689, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -17112,11 +18281,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; @@ -17597,11 +18766,11 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = 0; @@ -17849,21 +19018,128 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":978 + * + * @property + * def base(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) - /* "View.MemoryView":978 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object - * + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ - __pyx_L0:; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -18313,7 +19589,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_obj); @@ -19570,11 +20846,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = NULL; @@ -19598,7 +20874,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_extents", 0); @@ -19667,7 +20943,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_r = -1; __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -19689,7 +20965,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); @@ -19780,7 +21056,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -19803,7 +21079,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); @@ -19919,7 +21195,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } @@ -20486,11 +21762,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_L1_error:; { #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; @@ -20670,7 +21946,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); @@ -20694,7 +21970,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da /* function exit code */ __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); + __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } @@ -20899,109 +22175,572 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t * cdef Py_ssize_t extent = shape[0] * */ - __pyx_v_stride = (__pyx_v_strides[0]); + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1396 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: + */ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1398 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) + */ + __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1399 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride + */ + __pyx_t_2 = __pyx_v_extent; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1400 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: + */ + memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize); + + /* "View.MemoryView":1401 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1398 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) + */ + goto __pyx_L3; + } + + /* "View.MemoryView":1403 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, + * ndim - 1, itemsize, item) + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1404 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< + * ndim - 1, itemsize, item) + * data += stride + */ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1406 + * _slice_assign_scalar(data, shape + 1, strides + 1, + * ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) nogil: + */ + + /* function exit code */ +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v_PickleError = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":2 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + */ + __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0); + if (__pyx_t_1) { + + /* "(tree fragment)":3 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError # <<<<<<<<<<<<<< + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_PickleError = __pyx_t_2; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":4 + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_PickleError); + __pyx_t_2 = __pyx_v_PickleError; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(2, 4, __pyx_L1_error) + + /* "(tree fragment)":2 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + */ + } + + /* "(tree fragment)":5 + * from pickle import PickleError + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v___pyx_type); + __Pyx_GIVEREF(__pyx_v___pyx_type); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + */ + __pyx_t_1 = (__pyx_v___pyx_state != Py_None); + __pyx_t_7 = (__pyx_t_1 != 0); + if (__pyx_t_7) { - /* "View.MemoryView":1396 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "(tree fragment)":7 + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) # <<<<<<<<<<<<<< + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): */ - __pyx_v_extent = (__pyx_v_shape[0]); + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error) + __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1398 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) + /* "(tree fragment)":6 + * raise PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) + * result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + } - /* "View.MemoryView":1399 - * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride + /* "(tree fragment)":8 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] */ - __pyx_t_2 = __pyx_v_extent; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "View.MemoryView":1400 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError */ - memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize); - /* "View.MemoryView":1401 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_PickleError); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - /* "View.MemoryView":1398 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":10 + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if hasattr(result, '__dict__'): + * result.__dict__.update(__pyx_state[1]) */ - goto __pyx_L3; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(2, 10, __pyx_L1_error) } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_result->name); + __Pyx_DECREF(__pyx_v_result->name); + __pyx_v_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":1403 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) + /* "(tree fragment)":11 + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<< + * result.__dict__.update(__pyx_state[1]) */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "View.MemoryView":1404 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride + /* "(tree fragment)":12 + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): + * result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_update); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(2, 12, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1406 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * - * + /* "(tree fragment)":11 + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): # <<<<<<<<<<<<<< + * result.__dict__.update(__pyx_state[1]) */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } } - __pyx_L3:; - /* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + /* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } static struct __pyx_vtabstruct_array __pyx_vtable_array; @@ -21028,7 +22767,7 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -21078,6 +22817,8 @@ static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED vo static PyMethodDef __pyx_methods_array[] = { {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -21197,7 +22938,7 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -21225,6 +22966,8 @@ static int __pyx_tp_clear_Enum(PyObject *o) { } static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -21312,7 +23055,7 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -21424,6 +23167,8 @@ static PyMethodDef __pyx_methods_memoryview[] = { {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -21549,7 +23294,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif @@ -21593,6 +23338,8 @@ static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UN } static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -21677,6 +23424,7 @@ static PyMethodDef __pyx_methods[] = { {"find_nearest_center", (PyCFunction)__pyx_pw_3src_3urh_9cythonext_15signalFunctions_13find_nearest_center, METH_VARARGS|METH_KEYWORDS, 0}, {"estimate_qad_center", (PyCFunction)__pyx_pw_3src_3urh_9cythonext_15signalFunctions_15estimate_qad_center, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3src_3urh_9cythonext_15signalFunctions_14estimate_qad_center}, {"fir_filter", (PyCFunction)__pyx_pw_3src_3urh_9cythonext_15signalFunctions_17fir_filter, METH_VARARGS|METH_KEYWORDS, 0}, + {"iir_filter", (PyCFunction)__pyx_pw_3src_3urh_9cythonext_15signalFunctions_19iir_filter, METH_VARARGS|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -21709,6 +23457,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, @@ -21719,14 +23468,18 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1}, {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_s_bit_length, __pyx_k_bit_length, sizeof(__pyx_k_bit_length), 0, 0, 1, 1}, {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, @@ -21734,10 +23487,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, {&__pyx_n_s_centers, __pyx_k_centers, sizeof(__pyx_k_centers), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_complex64, __pyx_k_complex64, sizeof(__pyx_k_complex64), 0, 0, 1, 1}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_n_s_demod_samples, __pyx_k_demod_samples, sizeof(__pyx_k_demod_samples), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, @@ -21766,6 +23521,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_noise_mag, __pyx_k_noise_mag, sizeof(__pyx_k_noise_mag), 0, 0, 1, 1}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_num_centers, __pyx_k_num_centers, sizeof(__pyx_k_num_centers), 0, 0, 1, 1}, @@ -21775,14 +23532,23 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, {&__pyx_n_s_qad_center, __pyx_k_qad_center, sizeof(__pyx_k_qad_center), 0, 0, 1, 1}, {&__pyx_n_s_qad_samples, __pyx_k_qad_samples, sizeof(__pyx_k_qad_samples), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1}, {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, @@ -21790,6 +23556,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_tolerance, __pyx_k_tolerance, sizeof(__pyx_k_tolerance), 0, 0, 1, 1}, @@ -21798,6 +23565,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, {&__pyx_n_s_urh_cythonext, __pyx_k_urh_cythonext, sizeof(__pyx_k_urh_cythonext), 0, 0, 1, 1}, {&__pyx_n_s_util, __pyx_k_util, sizeof(__pyx_k_util), 0, 0, 1, 1}, {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, @@ -21810,8 +23578,8 @@ static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 146, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 149, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 396, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 425, __pyx_L1_error) __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 599, __pyx_L1_error) __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 818, __pyx_L1_error) return 0; @@ -21986,6 +23754,25 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + /* "View.MemoryView":484 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: @@ -21993,9 +23780,9 @@ static int __Pyx_InitCachedConstants(void) { * else: * if len(self.view.format) == 1: */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "View.MemoryView":556 * if self.view.strides == NULL: @@ -22004,9 +23791,9 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); /* "View.MemoryView":563 * def suboffsets(self): @@ -22015,12 +23802,31 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__20 = PyTuple_New(1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); + __pyx_tuple__22 = PyTuple_New(1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__20, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__20); + PyTuple_SET_ITEM(__pyx_tuple__22, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); /* "View.MemoryView":668 * if item is Ellipsis: @@ -22029,9 +23835,9 @@ static int __Pyx_InitCachedConstants(void) { * seen_ellipsis = True * else: */ - __pyx_slice__21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__21)) __PYX_ERR(2, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__21); - __Pyx_GIVEREF(__pyx_slice__21); + __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(2, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__25); + __Pyx_GIVEREF(__pyx_slice__25); /* "View.MemoryView":671 * seen_ellipsis = True @@ -22040,9 +23846,9 @@ static int __Pyx_InitCachedConstants(void) { * have_slices = True * else: */ - __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(2, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__22); - __Pyx_GIVEREF(__pyx_slice__22); + __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__26); + __Pyx_GIVEREF(__pyx_slice__26); /* "View.MemoryView":682 * nslices = ndim - len(result) @@ -22051,9 +23857,9 @@ static int __Pyx_InitCachedConstants(void) { * * return have_slices or nslices, tuple(result) */ - __pyx_slice__23 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__23)) __PYX_ERR(2, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__23); - __Pyx_GIVEREF(__pyx_slice__23); + __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__27); + __Pyx_GIVEREF(__pyx_slice__27); /* "View.MemoryView":689 * for suboffset in suboffsets[:ndim]: @@ -22062,9 +23868,28 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); /* "View.MemoryView":282 * return self.name @@ -22073,9 +23898,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); /* "View.MemoryView":283 * @@ -22084,9 +23909,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect = Enum("") * */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); /* "View.MemoryView":284 * cdef generic = Enum("") @@ -22095,9 +23920,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(2, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); /* "View.MemoryView":287 * @@ -22106,9 +23931,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(2, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); /* "View.MemoryView":288 * @@ -22117,9 +23942,19 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(2, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + __pyx_tuple__36 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_PickleError, __pyx_n_s_result); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -22139,6 +23974,7 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -22204,6 +24040,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif @@ -22242,9 +24079,11 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) __pyx_type___pyx_array.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error) __pyx_array_type = &__pyx_type___pyx_array; if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 275, __pyx_L1_error) __pyx_type___pyx_MemviewEnum.tp_print = 0; + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 275, __pyx_L1_error) __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; @@ -22257,6 +24096,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) __pyx_type___pyx_memoryview.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 326, __pyx_L1_error) __pyx_memoryview_type = &__pyx_type___pyx_memoryview; __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; @@ -22266,6 +24106,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) __pyx_type___pyx_memoryviewslice.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 951, __pyx_L1_error) __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -22385,7 +24226,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 207, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_array_type); @@ -22396,7 +24237,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 282, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_2); @@ -22410,7 +24251,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) * cdef indirect = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 283, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_2); @@ -22424,7 +24265,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 284, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_2); @@ -22438,7 +24279,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) * cdef indirect_contiguous = Enum("") * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_2); @@ -22452,7 +24293,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) * * */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); @@ -22494,7 +24335,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 535, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryview_type); @@ -22507,16 +24348,26 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) */ __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 981, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryviewslice_type); - /* "View.MemoryView":1391 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * if __pyx_checksum != 0xb068931: + * from pickle import PickleError + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":9 + * __pyx_unpickle_Enum__set_state( result, __pyx_state) + * return result + * cdef __pyx_unpickle_Enum__set_state(Enum result, tuple __pyx_state): # <<<<<<<<<<<<<< + * result.name = __pyx_state[0] + * if hasattr(result, '__dict__'): */ /*--- Wrapped vars code ---*/ @@ -22527,7 +24378,7 @@ PyMODINIT_FUNC PyInit_signalFunctions(void) __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init src.urh.cythonext.signalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init src.urh.cythonext.signalFunctions", 0, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { @@ -22631,17 +24482,22 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + } } -#endif // CYTHON_FAST_PYCCALL +#endif /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL @@ -22760,8 +24616,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_LeaveRecursiveCall(); return result; } -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL +#endif +#endif /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON @@ -22801,11 +24657,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else if (likely(PyCFunction_Check(func))) { -#endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL @@ -22828,7 +24680,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec #endif /* BufferFormatCheck */ - static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } @@ -23378,7 +25230,7 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { } /* MemviewSliceInit */ - static int + static int __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int ndim, __Pyx_memviewslice *memviewslice, @@ -23513,7 +25365,7 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } /* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( + static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -23539,7 +25391,7 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } /* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -23553,7 +25405,7 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } /* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( + static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -23655,7 +25507,7 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } /* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -23679,7 +25531,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #endif /* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; @@ -23721,7 +25573,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject } /* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -23732,9 +25584,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -23747,9 +25602,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -23786,120 +25644,50 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; + return NULL; + PyErr_Clear(); } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); } + return m->sq_item(o, i); } - return ms->sq_slice(obj, cstart, cstop); } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); #else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ArgTypeTest */ + static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(PyObject_TypeCheck(obj, type))) return 1; + } + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + return 0; } /* RaiseException */ - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -24062,25 +25850,25 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->exc_type; *value = tstate->exc_value; @@ -24104,7 +25892,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { PyObject *exc_type = tstate->curexc_type; if (exc_type == err) return 1; @@ -24114,7 +25902,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { @@ -24174,35 +25962,8 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -24220,7 +25981,16 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } else if (length == 1) { return (equals == Py_EQ); } else { - int result = memcmp(ps1, ps2, (size_t)length); + int result; +#if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { @@ -24240,7 +26010,7 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -24280,6 +26050,21 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; @@ -24324,7 +26109,7 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } /* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -24337,7 +26122,7 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } /* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -24369,8 +26154,23 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in } } +/* GetAttr3 */ + static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + goto bad; + PyErr_Clear(); + r = d; + Py_INCREF(d); + } + return r; +bad: + return NULL; +} + /* SwapException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; @@ -24395,7 +26195,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -24469,7 +26269,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -24585,12 +26385,44 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } +/* ImportFrom */ + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* HasAttr */ + static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else @@ -24607,22 +26439,107 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED return -1; } -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif +/* SetupReduce */ + #define __Pyx_setup_reduce_GET_ATTR_OR_BAD(res, obj, name) res = PyObject_GetAttrString(obj, name); if (res == NULL) goto BAD; +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = PyObject_GetAttrString(meth, "__name__"); + if (name_attr) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (ret < 0) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject* builtin_object = NULL; + static PyObject *object_reduce = NULL; + static PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + if (PyObject_HasAttrString(type_obj, "__getstate__")) goto GOOD; + if (object_reduce_ex == NULL) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(builtin_object, __pyx_b, "object"); + __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce, builtin_object, "__reduce__"); + __Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce_ex, builtin_object, "__reduce_ex__"); + } + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_ex, type_obj, "__reduce_ex__"); + if (reduce_ex == object_reduce_ex) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce, type_obj, "__reduce__"); + if (object_reduce == reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_cython, type_obj, "__reduce_cython__"); + ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce__", reduce_cython); if (ret < 0) goto BAD; + ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__reduce_cython__"); if (ret < 0) goto BAD; + setstate = PyObject_GetAttrString(type_obj, "__setstate__"); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + __Pyx_setup_reduce_GET_ATTR_OR_BAD(setstate_cython, type_obj, "__setstate_cython__"); + ret = PyDict_SetItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate__", setstate_cython); if (ret < 0) goto BAD; + ret = PyDict_DelItemString(((PyTypeObject*)type_obj)->tp_dict, "__setstate_cython__"); if (ret < 0) goto BAD; + } + PyType_Modified((PyTypeObject*)type_obj); + } } - return value; + goto GOOD; +BAD: + if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + ret = -1; +GOOD: + Py_XDECREF(builtin_object); + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* CLineInTraceback */ + static int __Pyx_CLineForTraceback(int c_line) { +#ifdef CYTHON_CLINE_IN_TRACEBACK + return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0; +#else + PyObject **cython_runtime_dict; + PyObject *use_cline; + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (unlikely(!cython_runtime_dict)) { + PyObject *ptype, *pvalue, *ptraceback; + PyObject *use_cline_obj; + PyErr_Fetch(&ptype, &pvalue, &ptraceback); + use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + use_cline = NULL; + } + PyErr_Restore(ptype, pvalue, ptraceback); + } else { + use_cline = PyDict_GetItem(*_PyObject_GetDictPtr(__pyx_cython_runtime), __pyx_n_s_cline_in_traceback); + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (PyObject_Not(use_cline) != 0) { + c_line = 0; + } + return c_line; +#endif } /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -24702,7 +26619,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -24761,12 +26678,15 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (c_line) { + c_line = __Pyx_CLineForTraceback(c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ @@ -24783,7 +26703,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -24803,7 +26723,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -24960,8 +26880,8 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif - /* MemviewSliceIsContig */ - static int + /* MemviewSliceIsContig */ + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { @@ -24984,7 +26904,7 @@ __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, } /* OverlappingSlices */ - static void + static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) @@ -25020,7 +26940,7 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, } /* Capsule */ - static CYTHON_INLINE PyObject * + static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; @@ -25033,7 +26953,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -25053,7 +26973,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -25188,7 +27108,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) #endif /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -25210,7 +27130,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) } /* TypeInfoCompare */ - static int + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; @@ -25251,7 +27171,7 @@ __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) } /* MemviewSliceValidateAndInit */ - static int + static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) @@ -25433,7 +27353,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc___pyx_t_float_complex(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc___pyx_t_float_complex(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -25456,7 +27376,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_float(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_float(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -25479,7 +27399,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25510,7 +27430,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* FromPy */ - static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject* o) { + static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject* o) { Py_complex cval; #if !CYTHON_COMPILING_IN_PYPY if (PyComplex_CheckExact(o)) @@ -25524,7 +27444,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_float_complex(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_float_complex(const char *itemp) { return (PyObject *) __pyx_PyComplex_FromComplex(*(__pyx_t_float_complex *) itemp); } static CYTHON_INLINE int __pyx_memview_set___pyx_t_float_complex(const char *itemp, PyObject *obj) { @@ -25536,7 +27456,7 @@ static CYTHON_INLINE int __pyx_memview_set___pyx_t_float_complex(const char *ite } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) { return (PyObject *) PyFloat_FromDouble(*(float *) itemp); } static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj) { @@ -25548,7 +27468,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25579,7 +27499,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25610,7 +27530,7 @@ static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *ob } /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_PY_LONG_LONG(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_PY_LONG_LONG(const char *itemp) { return (PyObject *) __Pyx_PyInt_From_unsigned_PY_LONG_LONG(*(unsigned PY_LONG_LONG *) itemp); } static CYTHON_INLINE int __pyx_memview_set_unsigned_PY_LONG_LONG(const char *itemp, PyObject *obj) { @@ -25622,7 +27542,7 @@ static CYTHON_INLINE int __pyx_memview_set_unsigned_PY_LONG_LONG(const char *ite } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25653,7 +27573,7 @@ static CYTHON_INLINE int __pyx_memview_set_unsigned_PY_LONG_LONG(const char *ite } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25683,8 +27603,163 @@ static CYTHON_INLINE int __pyx_memview_set_unsigned_PY_LONG_LONG(const char *ite } } +/* Declarations */ + #if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) { + return ::std::complex< npy_float64 >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) { + return x + y*(__pyx_t_npy_float64_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) { + __pyx_t_npy_float64_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ + #if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_sum_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + __pyx_t_npy_float64_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_diff_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + __pyx_t_npy_float64_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + __pyx_t_npy_float64_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_quot_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + if (b.imag == 0) { + return __pyx_t_npy_float64_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_npy_float64_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + npy_float64 r = b.imag / b.real; + npy_float64 s = 1.0 / (b.real + b.imag * r); + return __pyx_t_npy_float64_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + npy_float64 r = b.real / b.imag; + npy_float64 s = 1.0 / (b.imag + b.real * r); + return __pyx_t_npy_float64_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_quot_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + if (b.imag == 0) { + return __pyx_t_npy_float64_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + npy_float64 denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_npy_float64_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_neg_npy_float64(__pyx_t_npy_float64_complex a) { + __pyx_t_npy_float64_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_npy_float64(__pyx_t_npy_float64_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_conj_npy_float64(__pyx_t_npy_float64_complex a) { + __pyx_t_npy_float64_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE npy_float64 __Pyx_c_abs_npy_float64(__pyx_t_npy_float64_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_pow_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) { + __pyx_t_npy_float64_complex z; + npy_float64 r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + npy_float64 denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod_npy_float64(a, a); + return __Pyx_c_prod_npy_float64(a, a); + case 3: + z = __Pyx_c_prod_npy_float64(a, a); + return __Pyx_c_prod_npy_float64(z, a); + case 4: + z = __Pyx_c_prod_npy_float64(a, a); + return __Pyx_c_prod_npy_float64(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if (b.imag == 0) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0, -1); + } + } else { + r = __Pyx_c_abs_npy_float64(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -25715,7 +27790,7 @@ static CYTHON_INLINE int __pyx_memview_set_unsigned_PY_LONG_LONG(const char *ite } /* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice + static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, @@ -25782,7 +27857,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -25971,7 +28046,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { + static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -26160,7 +28235,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { + static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -26349,7 +28424,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { + static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -26538,19 +28613,19 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) -1, const_zero = (char) 0; + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (char) val; + return (long) val; } } else #endif @@ -26559,32 +28634,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; @@ -26598,86 +28673,86 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (char) -1; + return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif - if (sizeof(char) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -26686,7 +28761,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - char val; + long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -26706,40 +28781,40 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return val; } #endif - return (char) -1; + return (long) -1; } } else { - char val; + long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (char) -1; - val = __Pyx_PyInt_As_char(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to char"); - return (char) -1; + "value too large to convert to long"); + return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to char"); - return (char) -1; + "can't convert negative value to long"); + return (long) -1; } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; + static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) -1, const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + if (sizeof(char) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (long) val; + return (char) val; } } else #endif @@ -26748,32 +28823,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 0: return (char) 0; + case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; @@ -26787,86 +28862,86 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (long) -1; + return (char) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(char) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case 0: return (char) 0; + case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; } #endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + if (sizeof(char) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -26875,7 +28950,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - long val; + char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -26895,28 +28970,28 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return val; } #endif - return (long) -1; + return (char) -1; } } else { - long val; + char val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); + if (!tmp) return (char) -1; + val = __Pyx_PyInt_As_char(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; + "value too large to convert to char"); + return (char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; + "can't convert negative value to char"); + return (char) -1; } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_PY_LONG_LONG(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_PY_LONG_LONG(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -26939,7 +29014,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_PY_LONG_LONG(PyObject *obj) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_PY_LONG_LONG(PyObject *obj) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; @@ -26962,7 +29037,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -26978,7 +29053,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule + #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; @@ -26996,7 +29071,7 @@ static PyObject *__Pyx_ImportModule(const char *name) { #endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) @@ -27061,7 +29136,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class #endif /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -27086,6 +29161,8 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class #endif if (!*t->p) return -1; + if (PyObject_Hash(*t->p) == -1) + PyErr_Clear(); ++t; } return 0; @@ -27094,11 +29171,11 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII diff --git a/src/urh/cythonext/signalFunctions.pyx b/src/urh/cythonext/signalFunctions.pyx index 56ca101e22..136beb931e 100644 --- a/src/urh/cythonext/signalFunctions.pyx +++ b/src/urh/cythonext/signalFunctions.pyx @@ -393,3 +393,20 @@ cpdef np.ndarray[np.complex64_t, ndim=1] fir_filter(float complex[::1] input_sam return output[:N] + +cpdef np.ndarray[np.complex64_t, ndim=1] iir_filter(np.ndarray[np.float64_t, ndim=1] a, + np.ndarray[np.float64_t, ndim=1] b, + np.ndarray[np.complex64_t, ndim=1] signal): + cdef np.ndarray[np.complex64_t, ndim=1] result = np.zeros(len(signal), dtype=np.complex64) + + cdef long n, j, k + cdef long M = len(a) + cdef long N = len(b) + for n in range(max(M, N+1) , len(signal)): + for j in range(M): + result[n] += a[j] * signal[n-j] + + for k in range(N): + result[n] += b[k] * result[n-1-k] + + return result diff --git a/src/urh/plugins/InsertSine/InsertSinePlugin.py b/src/urh/plugins/InsertSine/InsertSinePlugin.py index 9302fe0f6f..02c979566a 100644 --- a/src/urh/plugins/InsertSine/InsertSinePlugin.py +++ b/src/urh/plugins/InsertSine/InsertSinePlugin.py @@ -6,8 +6,8 @@ from PyQt5.QtGui import QBrush, QColor, QPen, QRegExpValidator from PyQt5.QtWidgets import QApplication, QDialog -from urh.SceneManager import SceneManager from urh.plugins.Plugin import SignalEditorPlugin +from urh.ui.painting.SceneManager import SceneManager from urh.util.Formatter import Formatter diff --git a/src/urh/signalprocessing/Filter.py b/src/urh/signalprocessing/Filter.py index b239f46a24..a86dcfeb76 100644 --- a/src/urh/signalprocessing/Filter.py +++ b/src/urh/signalprocessing/Filter.py @@ -1,13 +1,25 @@ import numpy as np +import math + +from urh import constants from urh.cythonext import signalFunctions from enum import Enum +from urh.util.Logger import logger + class FilterType(Enum): moving_average = "moving average" custom = "custom" class Filter(object): + BANDWIDTHS = { + "Very Narrow": 0.001, + "Narrow": 0.01, + "Medium": 0.08, + "Wide": 0.1, + "Very Wide": 0.42 + } def __init__(self, taps: list, filter_type: FilterType = FilterType.custom): self.filter_type = filter_type @@ -18,3 +30,90 @@ def apply_fir_filter(self, input_signal: np.ndarray) -> np.ndarray: input_signal = np.array(input_signal, dtype=np.complex64) return signalFunctions.fir_filter(input_signal, np.array(self.taps, dtype=np.complex64)) + + @classmethod + def read_configured_filter_bw(cls) -> float: + bw_type = constants.SETTINGS.value("bandpass_filter_bw_type", "Medium", str) + + if bw_type in cls.BANDWIDTHS: + return cls.BANDWIDTHS[bw_type] + + if bw_type.lower() == "custom": + return constants.SETTINGS.value("bandpass_filter_custom_bw", 0.1, float) + + return 0.08 + + @classmethod + def get_bandwidth_from_filter_length(cls, N): + return 4 / N + + @classmethod + def get_filter_length_from_bandwidth(cls, bw): + N = int(math.ceil((4 / bw))) + return N + 1 if N % 2 == 0 else N # Ensure N is odd. + + @classmethod + def fft_convolve_1d(cls, x: np.ndarray, h: np.ndarray): + n = len(x) + len(h) - 1 + n_opt = 1 << (n-1).bit_length() # Get next power of 2 + if np.issubdtype(x.dtype, np.complexfloating) or np.issubdtype(h.dtype, np.complexfloating): + fft, ifft = np.fft.fft, np.fft.ifft # use complex fft + else: + fft, ifft = np.fft.rfft, np.fft.irfft # use real fft + + result = ifft(fft(x, n_opt) * fft(h, n_opt), n_opt)[0:n] + too_much = (len(result) - len(x)) // 2 # Center result + return result[too_much: -too_much] + + @classmethod + def apply_bandpass_filter(cls, data, f_low, f_high, sample_rate: float=None, filter_bw=0.08): + if sample_rate is not None: + f_low /= sample_rate + f_high /= sample_rate + + assert 0 <= f_low <= 0.5 + assert 0 <= f_high <= 0.5 + assert f_low <= f_high + + h = cls.design_windowed_sinc_bandpass(f_low, f_high, filter_bw) + + # Choose normal or FFT convolution based on heuristic described in + # https://softwareengineering.stackexchange.com/questions/171757/computational-complexity-of-correlation-in-time-vs-multiplication-in-frequency-s/ + if len(h) < 8 * math.log(math.sqrt(len(data))): + logger.debug("Use normal convolve") + return np.convolve(data, h, 'same') + else: + logger.debug("Use FFT convolve") + return cls.fft_convolve_1d(data, h) + + @classmethod + def design_windowed_sinc_lpf(cls, fc, bw): + N = cls.get_filter_length_from_bandwidth(bw) + + # Compute sinc filter impulse response + h = np.sinc(2 * fc * (np.arange(N) - (N - 1) / 2.)) + + # We use blackman window function + w = np.blackman(N) + + # Multiply sinc filter with window function + h = h * w + + # Normalize to get unity gain + h_unity = h / np.sum(h) + + return h_unity + + @classmethod + def design_windowed_sinc_bandpass(cls, f_low, f_high, bw): + lp1 = cls.design_windowed_sinc_lpf(f_low, bw) + lp2 = cls.design_windowed_sinc_lpf(f_high, bw) + + lp2_spectral_inverse = np.negative(lp2) + lp2_spectral_inverse[len(lp2_spectral_inverse) // 2] += 1 + + band_reject_kernel = lp1 + lp2_spectral_inverse + band_pass_kernel = np.negative(band_reject_kernel) + band_pass_kernel[len(band_pass_kernel) // 2] += 1 + + return band_pass_kernel diff --git a/src/urh/signalprocessing/Modulator.py b/src/urh/signalprocessing/Modulator.py index 4de398fa5a..1e0be1e200 100644 --- a/src/urh/signalprocessing/Modulator.py +++ b/src/urh/signalprocessing/Modulator.py @@ -8,7 +8,7 @@ from urh import constants from urh.cythonext import path_creator -from urh.ui.ZoomableScene import ZoomableScene +from urh.ui.painting.ZoomableScene import ZoomableScene from urh.util.Formatter import Formatter diff --git a/src/urh/signalprocessing/Signal.py b/src/urh/signalprocessing/Signal.py index 89dce7ebcf..4f141fff4f 100644 --- a/src/urh/signalprocessing/Signal.py +++ b/src/urh/signalprocessing/Signal.py @@ -318,15 +318,18 @@ def estimate_qad_center(self) -> float: self.__parameter_cache[self.modulation_type_str]["qad_center"] = center return center - def create_new(self, start:int, end:int): + def create_new(self, start=0, end=0, new_data=None): new_signal = Signal("", "New " + self.name) - new_signal._fulldata = self.data[start:end] + + if new_data is None: + new_signal._fulldata = self.data[start:end] + else: + new_signal._fulldata = new_data + new_signal._noise_threshold = self.noise_threshold new_signal.noise_min_plot = self.noise_min_plot new_signal.noise_max_plot = self.noise_max_plot new_signal.__bit_len = self.bit_len - new_signal.history = [("Crop", 0, len(self._fulldata))] - new_signal.cur_history_index = 0 new_signal.__qad_center = self.qad_center new_signal.changed = True return new_signal diff --git a/src/urh/signalprocessing/Spectrogram.py b/src/urh/signalprocessing/Spectrogram.py new file mode 100644 index 0000000000..7b71ab05d4 --- /dev/null +++ b/src/urh/signalprocessing/Spectrogram.py @@ -0,0 +1,163 @@ +import numpy as np +import math +from PyQt5.QtGui import QImage + +from urh import colormaps +from urh.util.Logger import logger + + +class Spectrogram(object): + MAX_LINES_PER_VIEW = 1000 + DEFAULT_FFT_WINDOW_SIZE = 1024 + + def __init__(self, samples: np.ndarray, window_size=DEFAULT_FFT_WINDOW_SIZE, + overlap_factor=0.5, window_function=np.hanning): + """ + + :param samples: Complex samples + :param window_size: Size of DFT window + :param overlap_factor: Value between 0 (= No Overlapping) and 1 (= Full overlapping) of windows + :param window_function: Function for DFT window + """ + self.__samples = samples + self.__window_size = window_size + self.__overlap_factor = overlap_factor + self.__window_function = window_function + + self.data_min, self.data_max = -140, 10 + + @property + def samples(self): + return self.__samples + + @samples.setter + def samples(self, value): + self.__samples = value + + @property + def window_size(self): + return self.__window_size + + @window_size.setter + def window_size(self, value): + self.__window_size = value + + @property + def overlap_factor(self): + return self.__overlap_factor + + @overlap_factor.setter + def overlap_factor(self, value): + self.__overlap_factor = value + + @property + def window_function(self): + return self.__window_function + + @window_function.setter + def window_function(self, value): + self.__window_function = value + + @property + def time_bins(self): + return int(math.ceil(len(self.samples) / self.hop_size)) + + @property + def freq_bins(self): + return self.window_size + + @property + def hop_size(self): + """ + hop size determines by how many samples the window is advanced + """ + return self.window_size - int(self.overlap_factor * self.window_size) + + def stft(self, samples: np.ndarray): + """ + Perform Short-time Fourier transform to get the spectrogram for the given samples + :return: short-time Fourier transform of the given signal + """ + window = self.window_function(self.window_size) + hop_size = self.hop_size + + if len(self.samples) < self.window_size: + samples = np.append(self.samples, np.zeros(self.window_size - len(samples))) + else: + samples = samples + + num_frames = max(1, (len(samples) - self.window_size) // hop_size + 1) + + # Get frames as numpy view with stride_tricks to save RAM + # Same as: frames = [padded_samples[i*hop_size:i*hop_size+self.window_size] for i in range(num_frames)] + shape = (num_frames, self.window_size) + strides = (hop_size * samples.strides[-1], samples.strides[-1]) + frames = np.lib.stride_tricks.as_strided(samples, shape=shape, strides=strides) + + return np.fft.fft(frames * window, self.window_size) / np.atleast_1d(self.window_size) + + def __calculate_spectrogram(self, samples: np.ndarray) -> np.ndarray: + # Only shift axis 1 (frequency) and not time + spectrogram = np.fft.fftshift(self.stft(samples), axes=(1,)) + spectrogram = np.atleast_1d(10) * np.log10(spectrogram.real ** 2 + spectrogram.imag ** 2) # convert magnitudes to decibel + # Flip Array so Y axis goes from negative to positive + return np.fliplr(spectrogram) + + def create_spectrogram_image(self, sample_start: int=None, sample_end: int=None, step: int=None): + spectrogram = self.__calculate_spectrogram(self.samples[sample_start:sample_end:step]) + return self.create_image(spectrogram, colormaps.chosen_colormap_numpy_bgra, self.data_min, self.data_max) + + def create_image_segments(self): + n_segments = max(1, self.time_bins // self.MAX_LINES_PER_VIEW) + step = self.time_bins / n_segments + step = max(1, int((step / self.hop_size) * self.hop_size ** 2)) + + for i in range(0, len(self.samples), step): + image = self.create_spectrogram_image(sample_start=i, sample_end=i+step) + yield image + + @staticmethod + def apply_bgra_lookup(data: np.ndarray, colormap, data_min=None, data_max=None, normalize=True) -> np.ndarray: + if normalize and (data_min is None or data_max is None): + raise ValueError("Can't normalize without data min and data max") + + if normalize: + normalized_values = (len(colormap) - 1) * ((data.T - data_min) / (data_max - data_min)) + else: + normalized_values = data.T + + return np.take(colormap, normalized_values.astype(np.int), axis=0, mode='clip') + + @staticmethod + def create_image(data: np.ndarray, colormap, data_min=None, data_max=None, normalize=True) -> QImage: + """ + Create QImage from ARGB array. + The ARGB must have shape (width, height, 4) and dtype=ubyte. + NOTE: The order of values in the 3rd axis must be (blue, green, red, alpha). + :return: + """ + image_data = Spectrogram.apply_bgra_lookup(data, colormap, data_min, data_max, normalize) + + if not image_data.flags['C_CONTIGUOUS']: + logger.debug("Array was not C_CONTIGUOUS. Converting it.") + image_data = np.ascontiguousarray(image_data) + + try: + # QImage constructor needs inverted row/column order + image = QImage(image_data.ctypes.data, image_data.shape[1], image_data.shape[0], QImage.Format_ARGB32) + except Exception as e: + logger.error("could not create image " + str(e)) + return QImage() + + image.data = image_data + return image + + @staticmethod + def create_colormap_image(colormap_name: str, height=100) -> QImage: + colormap = colormaps.calculate_numpy_brga_for(colormap_name) + + indices = np.zeros((len(colormap), height), dtype=np.int64) + for i in np.arange(len(colormap), dtype=np.int64): + indices[i, :] = np.repeat(i, height) + + return Spectrogram.create_image(indices, colormap, normalize=False) diff --git a/src/urh/ContinuousSceneManager.py b/src/urh/ui/painting/ContinuousSceneManager.py similarity index 91% rename from src/urh/ContinuousSceneManager.py rename to src/urh/ui/painting/ContinuousSceneManager.py index 802de0d8d4..5c30b95114 100644 --- a/src/urh/ContinuousSceneManager.py +++ b/src/urh/ui/painting/ContinuousSceneManager.py @@ -1,4 +1,4 @@ -from urh.SceneManager import SceneManager +from urh.ui.painting.SceneManager import SceneManager from urh.util.RingBuffer import RingBuffer diff --git a/src/urh/FFTSceneManager.py b/src/urh/ui/painting/FFTSceneManager.py similarity index 93% rename from src/urh/FFTSceneManager.py rename to src/urh/ui/painting/FFTSceneManager.py index 9d82b74210..7d5c105444 100644 --- a/src/urh/FFTSceneManager.py +++ b/src/urh/ui/painting/FFTSceneManager.py @@ -1,12 +1,12 @@ import numpy as np from PyQt5.QtCore import Qt -from PyQt5.QtGui import QPainterPath, QFont, QPen +from PyQt5.QtGui import QPainterPath, QPen from PyQt5.QtWidgets import QGraphicsPathItem from urh import constants -from urh.SceneManager import SceneManager from urh.cythonext import path_creator -from urh.ui.GridScene import GridScene +from urh.ui.painting.GridScene import GridScene +from urh.ui.painting.SceneManager import SceneManager class FFTSceneManager(SceneManager): diff --git a/src/urh/ui/GridScene.py b/src/urh/ui/painting/GridScene.py similarity index 97% rename from src/urh/ui/GridScene.py rename to src/urh/ui/painting/GridScene.py index 8742d9028c..37b9f1f761 100644 --- a/src/urh/ui/GridScene.py +++ b/src/urh/ui/painting/GridScene.py @@ -1,9 +1,8 @@ -import locale +import numpy as np from PyQt5.QtCore import QRectF, QLineF, Qt from PyQt5.QtGui import QPainter, QFont, QFontMetrics, QPen -import numpy as np -from urh.ui.ZoomableScene import ZoomableScene +from urh.ui.painting.ZoomableScene import ZoomableScene from urh.util.Formatter import Formatter @@ -70,4 +69,4 @@ def get_freq_for_pos(self, x: int) -> float: f = self.frequencies[x] except IndexError: return None - return self.center_freq + f \ No newline at end of file + return self.center_freq + f diff --git a/src/urh/ui/painting/HorizontalSelection.py b/src/urh/ui/painting/HorizontalSelection.py new file mode 100644 index 0000000000..75480dc015 --- /dev/null +++ b/src/urh/ui/painting/HorizontalSelection.py @@ -0,0 +1,46 @@ +from PyQt5.QtCore import QPointF +from PyQt5.QtGui import QTransform + +from urh.ui.painting.Selection import Selection + + +class HorizontalSelection(Selection): + def __init__(self, *args, fillcolor, opacity, parent=None): + super().__init__(*args, fillcolor=fillcolor, opacity=opacity, parent=parent) + + @property + def length(self): + return self.width + + @property + def is_empty(self) -> bool: + return self.width == 0 + + @property + def start(self): + if self.width < 0: + return self.x + self.width + else: + return self.x + + @start.setter + def start(self, value): + self.setX(value) + + @property + def end(self): + if self.width < 0: + return self.x + else: + return self.x + self.width + + @end.setter + def end(self, value): + self.width = value - self.start + + def clear(self): + self.width = 0 + super().clear() + + def get_selected_edge(self, pos: QPointF, transform: QTransform): + return super()._get_selected_edge(pos, transform, horizontal_selection=True) diff --git a/src/urh/ui/LabeledArrow.py b/src/urh/ui/painting/LabeledArrow.py similarity index 100% rename from src/urh/ui/LabeledArrow.py rename to src/urh/ui/painting/LabeledArrow.py diff --git a/src/urh/ui/LegendScene.py b/src/urh/ui/painting/LegendScene.py similarity index 94% rename from src/urh/ui/LegendScene.py rename to src/urh/ui/painting/LegendScene.py index 73b4e79d40..712489bc48 100644 --- a/src/urh/ui/LegendScene.py +++ b/src/urh/ui/painting/LegendScene.py @@ -1,6 +1,6 @@ from PyQt5.QtWidgets import QGraphicsScene -from urh.ui.LabeledArrow import LabeledArrow +from urh.ui.painting.LabeledArrow import LabeledArrow class LegendScene(QGraphicsScene): diff --git a/src/urh/LiveSceneManager.py b/src/urh/ui/painting/LiveSceneManager.py similarity index 84% rename from src/urh/LiveSceneManager.py rename to src/urh/ui/painting/LiveSceneManager.py index 00b63b6178..0edc48a03e 100644 --- a/src/urh/LiveSceneManager.py +++ b/src/urh/ui/painting/LiveSceneManager.py @@ -1,5 +1,5 @@ -from urh.SceneManager import SceneManager +from urh.ui.painting.SceneManager import SceneManager class LiveSceneManager(SceneManager): def __init__(self, data_array, parent): diff --git a/src/urh/SceneManager.py b/src/urh/ui/painting/SceneManager.py similarity index 94% rename from src/urh/SceneManager.py rename to src/urh/ui/painting/SceneManager.py index c7a112e29f..778f3a11bc 100644 --- a/src/urh/SceneManager.py +++ b/src/urh/ui/painting/SceneManager.py @@ -2,13 +2,12 @@ import numpy as np from PyQt5.QtCore import QObject, Qt -from PyQt5.QtGui import QFont, QPen, QColor +from PyQt5.QtGui import QPen, QColor from PyQt5.QtWidgets import QGraphicsPathItem from urh import constants from urh.cythonext import path_creator, util -from urh.ui.ZoomableScene import ZoomableScene -from urh.util.Logger import logger +from urh.ui.painting.ZoomableScene import ZoomableScene class SceneManager(QObject): @@ -55,7 +54,9 @@ def set_path(self, paths: list, colors=None): colors = [constants.LINECOLOR] * len(paths) if colors is None else colors assert len(paths) == len(colors) for path, color in zip(paths, colors): - self.scene.addPath(path, QPen(color if color else constants.LINECOLOR, Qt.FlatCap)) + path_object = self.scene.addPath(path, QPen(color if color else constants.LINECOLOR, Qt.FlatCap)) + if color: + path_object.setZValue(1) def __limit_value(self, val: float) -> int: return 0 if val < 0 else self.num_samples if val > self.num_samples else int(val) diff --git a/src/urh/ui/ROI.py b/src/urh/ui/painting/Selection.py similarity index 54% rename from src/urh/ui/ROI.py rename to src/urh/ui/painting/Selection.py index 5b4169a879..db3eb06e5e 100644 --- a/src/urh/ui/ROI.py +++ b/src/urh/ui/painting/Selection.py @@ -1,29 +1,20 @@ from PyQt5.QtCore import Qt, QPointF -from PyQt5.QtGui import QColor, QPen +from PyQt5.QtGui import QColor, QPen, QTransform from PyQt5.QtWidgets import QGraphicsRectItem -from urh import constants - -class ROI(QGraphicsRectItem): +class Selection(QGraphicsRectItem): def __init__(self, *args, fillcolor, opacity, parent=None): - self.padding = 0 if len(args) == 0: super().__init__(parent) elif len(args) == 1: super().__init__(args[0], parent) elif len(args) == 4: - x0 = args[0] - y0 = args[1] - w = args[2] - h = args[3] - ymin = y0 + self.padding * h - roi_height = (1 - 2 * self.padding) * h - super().__init__(x0, ymin, w, roi_height, parent) + x0, y0, w, h = args + super().__init__(x0, y0, w, h, parent) self.finished = False - self.selected_edge = None - """:type: int """ + self.selected_edge = None # type: int self.resizing = False self.setBrush(fillcolor) @@ -32,7 +23,7 @@ def __init__(self, *args, fillcolor, opacity, parent=None): @property def is_empty(self) -> bool: - return self.width == 0 + raise NotImplementedError("Overwrite in subclass") @property def width(self): @@ -72,28 +63,6 @@ def setX(self, p_float): r.setX(p_float) self.setRect(r) - @property - def start(self): - if self.width < 0: - return self.x + self.width - else: - return self.x - - @start.setter - def start(self, value): - self.setX(value) - - @property - def end(self): - if self.width < 0: - return self.x - else: - return self.x + self.width - - @end.setter - def end(self, value): - self.width = value - self.start - @property def y(self): return self.rect().y() @@ -106,36 +75,45 @@ def setY(self, p_float): r.setY(p_float) self.setRect(r) - def is_in_roi(self, pos: QPointF): - x1 = self.rect().x() - x2 = x1 + self.rect().width() - y1 = self.rect().y() - y2 = y1 + self.rect().width() + @property + def start(self): + raise NotImplementedError("Overwrite in subclass") - if x1 < pos.x() < x2 and y1 < pos.y() < y2: - return True + @start.setter + def start(self, value): + raise NotImplementedError("Overwrite in subclass") - return False + @property + def end(self): + raise NotImplementedError("Overwrite in subclass") - def get_selected_edge(self, pos: QPointF, width_view: float): - """ - Bestimmt auf welcher Ecke der ROI der Mauszeiger gerade ist. - 0 = links, 1 = rechts + @end.setter + def end(self, value): + raise NotImplementedError("Overwrite in subclass") + + def _get_selected_edge(self, pos: QPointF, transform: QTransform, horizontal_selection: bool): + x1, x2 = self.x, self.x + self.width + y1, y2 = self.y, self.y + self.height + x, y = pos.x(), pos.y() - :param pos: In die Szene gemappte Position des Mauszeigers - """ - x1 = self.rect().x() - x2 = x1 + self.rect().width() - y1 = self.rect().y() - y2 = y1 + self.rect().height() - x = pos.x() - y = pos.y() + spacing = 5 + spacing /= transform.m11() if horizontal_selection else transform.m22() + + if horizontal_selection: + x1a, x1b = x1 - spacing, x1 + spacing + y1a, y1b = y1, y2 + x2a, x2b = x2 - spacing, x2 + spacing + y2a, y2b = y1, y2 + else: + x1a, x1b, x2a, x2b = x1, x2, x1, x2 + y1a, y1b = min(y1 - spacing, y1 + spacing), max(y1 - spacing, y1 + spacing) + y2a, y2b = min(y2 - spacing, y2 + spacing), max(y2 - spacing, y2 + spacing) - if x1 - 0.025 * width_view < x < x1 + 0.025 * width_view and y1 < y < y2: + if x1a < x < x1b and y1a < y < y1b: self.selected_edge = 0 return 0 - if x2 - 0.025 * width_view < x < x2 + 0.025 * width_view and y1 < y < y2: + if x2a < x < x2b and y2a < y < y2b: self.selected_edge = 1 return 1 @@ -143,10 +121,6 @@ def get_selected_edge(self, pos: QPointF, width_view: float): return None def clear(self): - self.width = 0 self.resizing = False self.selected_edge = None self.finished = False - - - diff --git a/src/urh/SignalSceneManager.py b/src/urh/ui/painting/SignalSceneManager.py similarity index 96% rename from src/urh/SignalSceneManager.py rename to src/urh/ui/painting/SignalSceneManager.py index 316c08883f..b01d0a3152 100644 --- a/src/urh/SignalSceneManager.py +++ b/src/urh/ui/painting/SignalSceneManager.py @@ -1,9 +1,8 @@ import numpy as np -from PyQt5.QtGui import QFont -from urh.SceneManager import SceneManager from urh.cythonext import signalFunctions from urh.signalprocessing.Signal import Signal +from urh.ui.painting.SceneManager import SceneManager class SignalSceneManager(SceneManager): diff --git a/src/urh/SniffSceneManager.py b/src/urh/ui/painting/SniffSceneManager.py similarity index 93% rename from src/urh/SniffSceneManager.py rename to src/urh/ui/painting/SniffSceneManager.py index c385fbab79..8be36b036e 100644 --- a/src/urh/SniffSceneManager.py +++ b/src/urh/ui/painting/SniffSceneManager.py @@ -1,4 +1,4 @@ -from urh.SceneManager import SceneManager +from urh.ui.painting.SceneManager import SceneManager class SniffSceneManager(SceneManager): diff --git a/src/urh/ui/painting/SpectrogramScene.py b/src/urh/ui/painting/SpectrogramScene.py new file mode 100644 index 0000000000..9983471126 --- /dev/null +++ b/src/urh/ui/painting/SpectrogramScene.py @@ -0,0 +1,19 @@ +from PyQt5.QtCore import QRectF +from PyQt5.QtGui import QImage, QPixmap + +from urh import constants +from urh.ui.painting.VerticalSelection import VerticalSelection +from urh.ui.painting.ZoomableScene import ZoomableScene + + +class SpectrogramScene(ZoomableScene): + def __init__(self, parent=None): + super().__init__(parent) + self.removeItem(self.selection_area) + + self.selection_area = VerticalSelection(0, 0, 0, 0, fillcolor=constants.SELECTION_COLOR, opacity=0.6) + self.selection_area.setZValue(1) + self.addItem(self.selection_area) + + def width_spectrogram(self): + return self.spectrogram_image.pixmap().width() diff --git a/src/urh/ui/painting/SpectrogramSceneManager.py b/src/urh/ui/painting/SpectrogramSceneManager.py new file mode 100644 index 0000000000..ccc1365170 --- /dev/null +++ b/src/urh/ui/painting/SpectrogramSceneManager.py @@ -0,0 +1,76 @@ +import numpy as np +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import QGraphicsPixmapItem, QApplication + +from urh.signalprocessing.Spectrogram import Spectrogram +from urh.ui.painting.SceneManager import SceneManager +from urh.ui.painting.SpectrogramScene import SpectrogramScene + + +class SpectrogramSceneManager(SceneManager): + def __init__(self, samples, parent): + super().__init__(parent) + + self.samples_need_update = True + + self.scene.clear() + self.spectrogram = Spectrogram(samples) + self.scene = SpectrogramScene() + + @property + def num_samples(self): + return len(self.spectrogram.samples) + + def set_parameters(self, samples: np.ndarray, window_size, data_min, data_max) -> bool: + """ + Return true if redraw is needed + """ + redraw_needed = False + if self.samples_need_update: + self.spectrogram.samples = samples + redraw_needed = True + self.samples_need_update = False + + if window_size != self.spectrogram.window_size: + self.spectrogram.window_size = window_size + redraw_needed = True + + if data_min != self.spectrogram.data_min: + self.spectrogram.data_min = data_min + redraw_needed = True + + if data_max != self.spectrogram.data_max: + self.spectrogram.data_max = data_max + redraw_needed = True + + return redraw_needed + + def show_scene_section(self, x1: float, x2: float, subpath_ranges=None, colors=None): + pass + + def update_scene_rect(self): + self.scene.setSceneRect(0, 0, self.spectrogram.time_bins, self.spectrogram.freq_bins) + + def show_full_scene(self): + for item in self.scene.items(): + if isinstance(item, QGraphicsPixmapItem): + self.scene.removeItem(item) + + x_pos = 0 + for image in self.spectrogram.create_image_segments(): + item = self.scene.addPixmap(QPixmap.fromImage(image)) + item.setPos(x_pos, 0) + x_pos += image.width() + QApplication.instance().processEvents() + + # Estimated time_bins from update_scene_rect may be too many for small signals so we update the scene rect + # after we know how wide the spectrogram actually is + self.scene.setSceneRect(0, 0, x_pos, self.spectrogram.freq_bins) + + def init_scene(self, apply_padding=True): + pass + + def eliminate(self): + self.spectrogram.samples = None + self.spectrogram = None + super().eliminate() diff --git a/src/urh/ui/painting/VerticalSelection.py b/src/urh/ui/painting/VerticalSelection.py new file mode 100644 index 0000000000..e226ff1890 --- /dev/null +++ b/src/urh/ui/painting/VerticalSelection.py @@ -0,0 +1,46 @@ +from PyQt5.QtCore import QPointF +from PyQt5.QtGui import QTransform + +from urh.ui.painting.Selection import Selection + + +class VerticalSelection(Selection): + def __init__(self, *args, fillcolor, opacity, parent=None): + super().__init__(*args, fillcolor=fillcolor, opacity=opacity, parent=parent) + + @property + def length(self): + return self.height + + @property + def is_empty(self) -> bool: + return self.height == 0 + + @property + def start(self): + if self.height < 0: + return self.y + self.height + else: + return self.y + + @start.setter + def start(self, value): + self.setY(value) + + @property + def end(self): + if self.height < 0: + return self.y + else: + return self.y + self.height + + @end.setter + def end(self, value): + self.height = value - self.start + + def clear(self): + self.height = 0 + super().clear() + + def get_selected_edge(self, pos: QPointF, transform: QTransform): + return super()._get_selected_edge(pos, transform, horizontal_selection=False) diff --git a/src/urh/ui/ZoomableScene.py b/src/urh/ui/painting/ZoomableScene.py similarity index 87% rename from src/urh/ui/ZoomableScene.py rename to src/urh/ui/painting/ZoomableScene.py index 7ae9a4055e..3dc2970970 100644 --- a/src/urh/ui/ZoomableScene.py +++ b/src/urh/ui/painting/ZoomableScene.py @@ -1,9 +1,9 @@ from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QGraphicsScene, QGraphicsRectItem, QGraphicsSceneDragDropEvent from PyQt5.QtGui import QPen +from PyQt5.QtWidgets import QGraphicsScene, QGraphicsRectItem, QGraphicsSceneDragDropEvent from urh import constants -from urh.ui.ROI import ROI +from urh.ui.painting.HorizontalSelection import HorizontalSelection class ZoomableScene(QGraphicsScene): @@ -14,7 +14,8 @@ def __init__(self, parent=None): self.zeros_area = None self.ones_arrow = None self.zeros_arrow = None - self.selection_area = ROI(0, 0, 0, 0, fillcolor=constants.SELECTION_COLOR, opacity=constants.SELECTION_OPACITY) + self.selection_area = HorizontalSelection(0, 0, 0, 0, fillcolor=constants.SELECTION_COLOR, + opacity=constants.SELECTION_OPACITY) self.addItem(self.selection_area) def draw_noise_area(self, y, h): @@ -27,8 +28,7 @@ def draw_noise_area(self, y, h): self.zeros_area.hide() if self.noise_area is None or self.noise_area.scene() != self: - roi = ROI(x, y, w, h, fillcolor=constants.NOISE_COLOR, opacity=constants.NOISE_OPACITY) - # roi.setPen(QPen(constants.NOISE_COLOR, Qt.FlatCap)) + roi = HorizontalSelection(x, y, w, h, fillcolor=constants.NOISE_COLOR, opacity=constants.NOISE_OPACITY) self.noise_area = roi self.addItem(self.noise_area) else: diff --git a/src/urh/ui/painting/__init__.py b/src/urh/ui/painting/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/urh/ui/ui_filter_bandwidth_dialog.py b/src/urh/ui/ui_filter_bandwidth_dialog.py new file mode 100644 index 0000000000..4d86721d21 --- /dev/null +++ b/src/urh/ui/ui_filter_bandwidth_dialog.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- + +# +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_DialogFilterBandwidth(object): + def setupUi(self, DialogFilterBandwidth): + DialogFilterBandwidth.setObjectName("DialogFilterBandwidth") + DialogFilterBandwidth.resize(497, 382) + self.verticalLayout = QtWidgets.QVBoxLayout(DialogFilterBandwidth) + self.verticalLayout.setSpacing(7) + self.verticalLayout.setObjectName("verticalLayout") + self.labelExplanation = QtWidgets.QLabel(DialogFilterBandwidth) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.labelExplanation.sizePolicy().hasHeightForWidth()) + self.labelExplanation.setSizePolicy(sizePolicy) + self.labelExplanation.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignTop) + self.labelExplanation.setWordWrap(True) + self.labelExplanation.setObjectName("labelExplanation") + self.verticalLayout.addWidget(self.labelExplanation) + self.gridLayout = QtWidgets.QGridLayout() + self.gridLayout.setObjectName("gridLayout") + self.doubleSpinBoxCustomBandwidth = QtWidgets.QDoubleSpinBox(DialogFilterBandwidth) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.doubleSpinBoxCustomBandwidth.sizePolicy().hasHeightForWidth()) + self.doubleSpinBoxCustomBandwidth.setSizePolicy(sizePolicy) + self.doubleSpinBoxCustomBandwidth.setDecimals(4) + self.doubleSpinBoxCustomBandwidth.setMinimum(0.0001) + self.doubleSpinBoxCustomBandwidth.setMaximum(0.5) + self.doubleSpinBoxCustomBandwidth.setObjectName("doubleSpinBoxCustomBandwidth") + self.gridLayout.addWidget(self.doubleSpinBoxCustomBandwidth, 7, 1, 1, 1) + self.spinBoxCustomKernelLength = QtWidgets.QSpinBox(DialogFilterBandwidth) + self.spinBoxCustomKernelLength.setMinimum(8) + self.spinBoxCustomKernelLength.setMaximum(999999999) + self.spinBoxCustomKernelLength.setObjectName("spinBoxCustomKernelLength") + self.gridLayout.addWidget(self.spinBoxCustomKernelLength, 7, 2, 1, 1) + self.radioButtonCustom = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonCustom.setObjectName("radioButtonCustom") + self.gridLayout.addWidget(self.radioButtonCustom, 7, 0, 1, 1) + self.labelMediumKernelLength = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelMediumKernelLength.setObjectName("labelMediumKernelLength") + self.gridLayout.addWidget(self.labelMediumKernelLength, 4, 2, 1, 1) + self.radioButtonWide = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonWide.setObjectName("radioButtonWide") + self.gridLayout.addWidget(self.radioButtonWide, 5, 0, 1, 1) + self.labelVeryWideKernelLength = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelVeryWideKernelLength.setObjectName("labelVeryWideKernelLength") + self.gridLayout.addWidget(self.labelVeryWideKernelLength, 6, 2, 1, 1) + self.radioButtonNarrow = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonNarrow.setObjectName("radioButtonNarrow") + self.gridLayout.addWidget(self.radioButtonNarrow, 3, 0, 1, 1) + self.labelWideBandwidth = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelWideBandwidth.setObjectName("labelWideBandwidth") + self.gridLayout.addWidget(self.labelWideBandwidth, 5, 1, 1, 1) + self.labelVeryNarrowKernelLength = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelVeryNarrowKernelLength.setObjectName("labelVeryNarrowKernelLength") + self.gridLayout.addWidget(self.labelVeryNarrowKernelLength, 2, 2, 1, 1) + self.labelBandwidthCaption = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelBandwidthCaption.setObjectName("labelBandwidthCaption") + self.gridLayout.addWidget(self.labelBandwidthCaption, 0, 1, 1, 1) + self.labelNarrowBandwidth = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelNarrowBandwidth.setObjectName("labelNarrowBandwidth") + self.gridLayout.addWidget(self.labelNarrowBandwidth, 3, 1, 1, 1) + self.labelNarrowKernelLength = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelNarrowKernelLength.setObjectName("labelNarrowKernelLength") + self.gridLayout.addWidget(self.labelNarrowKernelLength, 3, 2, 1, 1) + self.labelVeryNarrowBandwidth = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelVeryNarrowBandwidth.setObjectName("labelVeryNarrowBandwidth") + self.gridLayout.addWidget(self.labelVeryNarrowBandwidth, 2, 1, 1, 1) + self.labelKernelLengthCaption = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelKernelLengthCaption.setObjectName("labelKernelLengthCaption") + self.gridLayout.addWidget(self.labelKernelLengthCaption, 0, 2, 1, 1) + self.labelWideKernelLength = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelWideKernelLength.setObjectName("labelWideKernelLength") + self.gridLayout.addWidget(self.labelWideKernelLength, 5, 2, 1, 1) + self.radioButtonVery_Wide = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonVery_Wide.setObjectName("radioButtonVery_Wide") + self.gridLayout.addWidget(self.radioButtonVery_Wide, 6, 0, 1, 1) + self.radioButtonVery_Narrow = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonVery_Narrow.setObjectName("radioButtonVery_Narrow") + self.gridLayout.addWidget(self.radioButtonVery_Narrow, 2, 0, 1, 1) + self.label = QtWidgets.QLabel(DialogFilterBandwidth) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) + self.label.setSizePolicy(sizePolicy) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.labelVeryWideBandwidth = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelVeryWideBandwidth.setObjectName("labelVeryWideBandwidth") + self.gridLayout.addWidget(self.labelVeryWideBandwidth, 6, 1, 1, 1) + self.radioButtonMedium = QtWidgets.QRadioButton(DialogFilterBandwidth) + self.radioButtonMedium.setObjectName("radioButtonMedium") + self.gridLayout.addWidget(self.radioButtonMedium, 4, 0, 1, 1) + self.labelMediumBandwidth = QtWidgets.QLabel(DialogFilterBandwidth) + self.labelMediumBandwidth.setObjectName("labelMediumBandwidth") + self.gridLayout.addWidget(self.labelMediumBandwidth, 4, 1, 1, 1) + self.line = QtWidgets.QFrame(DialogFilterBandwidth) + self.line.setFrameShape(QtWidgets.QFrame.HLine) + self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setObjectName("line") + self.gridLayout.addWidget(self.line, 1, 0, 1, 3) + self.verticalLayout.addLayout(self.gridLayout) + self.buttonBox = QtWidgets.QDialogButtonBox(DialogFilterBandwidth) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setCenterButtons(True) + self.buttonBox.setObjectName("buttonBox") + self.verticalLayout.addWidget(self.buttonBox) + self.verticalLayout.setStretch(0, 1) + self.verticalLayout.setStretch(1, 3) + self.verticalLayout.setStretch(2, 1) + + self.retranslateUi(DialogFilterBandwidth) + self.buttonBox.accepted.connect(DialogFilterBandwidth.accept) + self.buttonBox.rejected.connect(DialogFilterBandwidth.reject) + QtCore.QMetaObject.connectSlotsByName(DialogFilterBandwidth) + + def retranslateUi(self, DialogFilterBandwidth): + _translate = QtCore.QCoreApplication.translate + DialogFilterBandwidth.setWindowTitle(_translate("DialogFilterBandwidth", "Configure Filter Bandwidth")) + self.labelExplanation.setText(_translate("DialogFilterBandwidth", "To separate the frequency bands from each other a bandpass filter is used. You can configure the bandwidth of this filter here. The bandwidth determines the length N of the filter kernel. Decreasing the bandwidth will increase the accuracy of the filter, at cost of higher computation time.")) + self.radioButtonCustom.setText(_translate("DialogFilterBandwidth", "Custom")) + self.labelMediumKernelLength.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.radioButtonWide.setText(_translate("DialogFilterBandwidth", "Wide")) + self.labelVeryWideKernelLength.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.radioButtonNarrow.setText(_translate("DialogFilterBandwidth", "Narrow")) + self.labelWideBandwidth.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.labelVeryNarrowKernelLength.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.labelBandwidthCaption.setText(_translate("DialogFilterBandwidth", "Bandwidth (Hz)")) + self.labelNarrowBandwidth.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.labelNarrowKernelLength.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.labelVeryNarrowBandwidth.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.labelKernelLengthCaption.setText(_translate("DialogFilterBandwidth", "Kernel Length N")) + self.labelWideKernelLength.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.radioButtonVery_Wide.setText(_translate("DialogFilterBandwidth", "Very Wide")) + self.radioButtonVery_Narrow.setText(_translate("DialogFilterBandwidth", "Very Narrow")) + self.label.setText(_translate("DialogFilterBandwidth", "Choose ")) + self.labelVeryWideBandwidth.setText(_translate("DialogFilterBandwidth", "TextLabel")) + self.radioButtonMedium.setText(_translate("DialogFilterBandwidth", "Medium")) + self.labelMediumBandwidth.setText(_translate("DialogFilterBandwidth", "TextLabel")) + diff --git a/src/urh/ui/ui_options.py b/src/urh/ui/ui_options.py index cd98e345d9..62c7cd342a 100644 --- a/src/urh/ui/ui_options.py +++ b/src/urh/ui/ui_options.py @@ -38,8 +38,8 @@ def setupUi(self, DialogOptions): self.tabWidget.addTab(self.tabGeneration, "") self.tabView = QtWidgets.QWidget() self.tabView.setObjectName("tabView") - self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.tabView) - self.verticalLayout_4.setObjectName("verticalLayout_4") + self.verticalLayout = QtWidgets.QVBoxLayout(self.tabView) + self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_7 = QtWidgets.QLabel(self.tabView) @@ -56,32 +56,47 @@ def setupUi(self, DialogOptions): self.comboBoxDefaultView.addItem("") self.comboBoxDefaultView.addItem("") self.horizontalLayout_2.addWidget(self.comboBoxDefaultView) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.verticalLayout_4.addLayout(self.horizontalLayout_2) + self.verticalLayout.addLayout(self.horizontalLayout_2) self.checkBoxShowConfirmCloseDialog = QtWidgets.QCheckBox(self.tabView) self.checkBoxShowConfirmCloseDialog.setObjectName("checkBoxShowConfirmCloseDialog") - self.verticalLayout_4.addWidget(self.checkBoxShowConfirmCloseDialog) + self.verticalLayout.addWidget(self.checkBoxShowConfirmCloseDialog) self.checkBoxHoldShiftToDrag = QtWidgets.QCheckBox(self.tabView) self.checkBoxHoldShiftToDrag.setObjectName("checkBoxHoldShiftToDrag") - self.verticalLayout_4.addWidget(self.checkBoxHoldShiftToDrag) + self.verticalLayout.addWidget(self.checkBoxHoldShiftToDrag) self.checkBoxPauseTime = QtWidgets.QCheckBox(self.tabView) self.checkBoxPauseTime.setObjectName("checkBoxPauseTime") - self.verticalLayout_4.addWidget(self.checkBoxPauseTime) + self.verticalLayout.addWidget(self.checkBoxPauseTime) self.checkBoxAlignLabels = QtWidgets.QCheckBox(self.tabView) self.checkBoxAlignLabels.setObjectName("checkBoxAlignLabels") - self.verticalLayout_4.addWidget(self.checkBoxAlignLabels) + self.verticalLayout.addWidget(self.checkBoxAlignLabels) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_9 = QtWidgets.QLabel(self.tabView) self.label_9.setObjectName("label_9") - self.verticalLayout_4.addWidget(self.label_9) + self.horizontalLayout_4.addWidget(self.label_9) self.comboBoxTheme = QtWidgets.QComboBox(self.tabView) self.comboBoxTheme.setObjectName("comboBoxTheme") self.comboBoxTheme.addItem("") self.comboBoxTheme.addItem("") self.comboBoxTheme.addItem("") - self.verticalLayout_4.addWidget(self.comboBoxTheme) - spacerItem1 = QtWidgets.QSpacerItem(20, 383, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_4.addItem(spacerItem1) + self.horizontalLayout_4.addWidget(self.comboBoxTheme) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.groupBoxSpectrogramColormap = QtWidgets.QGroupBox(self.tabView) + self.groupBoxSpectrogramColormap.setObjectName("groupBoxSpectrogramColormap") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBoxSpectrogramColormap) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.scrollAreaSpectrogramColormap = QtWidgets.QScrollArea(self.groupBoxSpectrogramColormap) + self.scrollAreaSpectrogramColormap.setWidgetResizable(True) + self.scrollAreaSpectrogramColormap.setObjectName("scrollAreaSpectrogramColormap") + self.scrollAreaWidgetSpectrogramColormapContents = QtWidgets.QWidget() + self.scrollAreaWidgetSpectrogramColormapContents.setGeometry(QtCore.QRect(0, 0, 616, 307)) + self.scrollAreaWidgetSpectrogramColormapContents.setObjectName("scrollAreaWidgetSpectrogramColormapContents") + self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetSpectrogramColormapContents) + self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.scrollAreaSpectrogramColormap.setWidget(self.scrollAreaWidgetSpectrogramColormapContents) + self.verticalLayout_2.addWidget(self.scrollAreaSpectrogramColormap) + self.verticalLayout.addWidget(self.groupBoxSpectrogramColormap) self.tabWidget.addTab(self.tabView, "") self.tabFieldtypes = QtWidgets.QWidget() self.tabFieldtypes.setObjectName("tabFieldtypes") @@ -105,12 +120,12 @@ def setupUi(self, DialogOptions): self.btnRemoveLabeltype.setIcon(icon) self.btnRemoveLabeltype.setObjectName("btnRemoveLabeltype") self.verticalLayout_3.addWidget(self.btnRemoveLabeltype) - spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem2) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem) self.horizontalLayout_3.addLayout(self.verticalLayout_3) self.verticalLayout_5.addLayout(self.horizontalLayout_3) - spacerItem3 = QtWidgets.QSpacerItem(20, 203, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_5.addItem(spacerItem3) + spacerItem1 = QtWidgets.QSpacerItem(20, 203, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout_5.addItem(spacerItem1) self.tabWidget.addTab(self.tabFieldtypes, "") self.tab_plugins = QtWidgets.QWidget() self.tab_plugins.setObjectName("tab_plugins") @@ -138,8 +153,8 @@ def setupUi(self, DialogOptions): self.rbGnuradioBackend = QtWidgets.QRadioButton(self.tabDevices) self.rbGnuradioBackend.setObjectName("rbGnuradioBackend") self.verticalLayout_7.addWidget(self.rbGnuradioBackend) - spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_7.addItem(spacerItem4) + spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout_7.addItem(spacerItem2) self.horizontalLayout.addLayout(self.verticalLayout_7) self.verticalLayout_8.addLayout(self.horizontalLayout) self.lSupport = QtWidgets.QLabel(self.tabDevices) @@ -247,7 +262,7 @@ def setupUi(self, DialogOptions): self.verticalLayout_6.addWidget(self.tabWidget) self.retranslateUi(DialogOptions) - self.tabWidget.setCurrentIndex(0) + self.tabWidget.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(DialogOptions) def retranslateUi(self, DialogOptions): @@ -262,6 +277,7 @@ def retranslateUi(self, DialogOptions): self.comboBoxDefaultView.setItemText(1, _translate("DialogOptions", "Hex")) self.comboBoxDefaultView.setItemText(2, _translate("DialogOptions", "ASCII")) self.checkBoxShowConfirmCloseDialog.setText(_translate("DialogOptions", "Show \"confirm close\" dialog")) + self.checkBoxHoldShiftToDrag.setToolTip(_translate("DialogOptions", "

If checked, you need to hold the Shift key to drag with the mouse inside graphic views like the drawn signal in Interpreation tab, while making a selection with the mouse does not require holding any buttons.

If unchecked, this is inverted: Hold shift to make a selection, and drag by default.

")) self.checkBoxHoldShiftToDrag.setText(_translate("DialogOptions", "Hold shift to drag")) self.checkBoxPauseTime.setText(_translate("DialogOptions", "Show pauses as time")) self.checkBoxAlignLabels.setText(_translate("DialogOptions", "Align on labels")) @@ -269,6 +285,7 @@ def retranslateUi(self, DialogOptions): self.comboBoxTheme.setItemText(0, _translate("DialogOptions", "native look (default)")) self.comboBoxTheme.setItemText(1, _translate("DialogOptions", "fallback theme")) self.comboBoxTheme.setItemText(2, _translate("DialogOptions", "fallback theme (dark)")) + self.groupBoxSpectrogramColormap.setTitle(_translate("DialogOptions", "Spectrogram Colormap")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabView), _translate("DialogOptions", "View")) self.btnAddLabelType.setText(_translate("DialogOptions", "...")) self.btnRemoveLabeltype.setText(_translate("DialogOptions", "...")) diff --git a/src/urh/ui/ui_signal_frame.py b/src/urh/ui/ui_signal_frame.py index 10ef259b9e..ef397311e8 100644 --- a/src/urh/ui/ui_signal_frame.py +++ b/src/urh/ui/ui_signal_frame.py @@ -34,7 +34,18 @@ def setupUi(self, SignalFrame): self.chkBoxSyncSelection = QtWidgets.QCheckBox(SignalFrame) self.chkBoxSyncSelection.setChecked(True) self.chkBoxSyncSelection.setObjectName("chkBoxSyncSelection") - self.gridLayout_2.addWidget(self.chkBoxSyncSelection, 18, 0, 1, 1) + self.gridLayout_2.addWidget(self.chkBoxSyncSelection, 21, 0, 1, 1) + self.sliderSpectrogramMin = QtWidgets.QSlider(SignalFrame) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sliderSpectrogramMin.sizePolicy().hasHeightForWidth()) + self.sliderSpectrogramMin.setSizePolicy(sizePolicy) + self.sliderSpectrogramMin.setMinimum(-150) + self.sliderSpectrogramMin.setMaximum(10) + self.sliderSpectrogramMin.setOrientation(QtCore.Qt.Horizontal) + self.sliderSpectrogramMin.setObjectName("sliderSpectrogramMin") + self.gridLayout_2.addWidget(self.sliderSpectrogramMin, 18, 1, 1, 1) self.spinBoxNoiseTreshold = QtWidgets.QDoubleSpinBox(SignalFrame) self.spinBoxNoiseTreshold.setDecimals(4) self.spinBoxNoiseTreshold.setMaximum(1.0) @@ -43,7 +54,7 @@ def setupUi(self, SignalFrame): self.gridLayout_2.addWidget(self.spinBoxNoiseTreshold, 2, 1, 1, 1) self.chkBoxShowProtocol = QtWidgets.QCheckBox(SignalFrame) self.chkBoxShowProtocol.setObjectName("chkBoxShowProtocol") - self.gridLayout_2.addWidget(self.chkBoxShowProtocol, 17, 0, 1, 1) + self.gridLayout_2.addWidget(self.chkBoxShowProtocol, 20, 0, 1, 1) self.label = QtWidgets.QLabel(SignalFrame) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1) @@ -58,6 +69,12 @@ def setupUi(self, SignalFrame): self.lineEditSignalName.setAcceptDrops(False) self.lineEditSignalName.setObjectName("lineEditSignalName") self.gridLayout_2.addWidget(self.lineEditSignalName, 1, 0, 1, 2) + self.cbProtoView = QtWidgets.QComboBox(SignalFrame) + self.cbProtoView.setObjectName("cbProtoView") + self.cbProtoView.addItem("") + self.cbProtoView.addItem("") + self.cbProtoView.addItem("") + self.gridLayout_2.addWidget(self.cbProtoView, 20, 1, 1, 1) self.lInfoLenText = QtWidgets.QLabel(SignalFrame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -100,12 +117,6 @@ def setupUi(self, SignalFrame): self.lSignalViewText.setFont(font) self.lSignalViewText.setObjectName("lSignalViewText") self.gridLayout_2.addWidget(self.lSignalViewText, 14, 0, 1, 1) - self.cbProtoView = QtWidgets.QComboBox(SignalFrame) - self.cbProtoView.setObjectName("cbProtoView") - self.cbProtoView.addItem("") - self.cbProtoView.addItem("") - self.cbProtoView.addItem("") - self.gridLayout_2.addWidget(self.cbProtoView, 17, 1, 1, 1) self.line = QtWidgets.QFrame(SignalFrame) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) @@ -211,6 +222,7 @@ def setupUi(self, SignalFrame): self.cbSignalView.setObjectName("cbSignalView") self.cbSignalView.addItem("") self.cbSignalView.addItem("") + self.cbSignalView.addItem("") self.gridLayout_2.addWidget(self.cbSignalView, 14, 1, 1, 1) self.cbModulationType = QtWidgets.QComboBox(SignalFrame) self.cbModulationType.setObjectName("cbModulationType") @@ -218,6 +230,37 @@ def setupUi(self, SignalFrame): self.cbModulationType.addItem("") self.cbModulationType.addItem("") self.gridLayout_2.addWidget(self.cbModulationType, 9, 1, 1, 1) + self.labelFFTWindowSize = QtWidgets.QLabel(SignalFrame) + self.labelFFTWindowSize.setObjectName("labelFFTWindowSize") + self.gridLayout_2.addWidget(self.labelFFTWindowSize, 17, 0, 1, 1) + self.sliderFFTWindowSize = QtWidgets.QSlider(SignalFrame) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sliderFFTWindowSize.sizePolicy().hasHeightForWidth()) + self.sliderFFTWindowSize.setSizePolicy(sizePolicy) + self.sliderFFTWindowSize.setMinimum(6) + self.sliderFFTWindowSize.setMaximum(15) + self.sliderFFTWindowSize.setOrientation(QtCore.Qt.Horizontal) + self.sliderFFTWindowSize.setObjectName("sliderFFTWindowSize") + self.gridLayout_2.addWidget(self.sliderFFTWindowSize, 17, 1, 1, 1) + self.sliderSpectrogramMax = QtWidgets.QSlider(SignalFrame) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sliderSpectrogramMax.sizePolicy().hasHeightForWidth()) + self.sliderSpectrogramMax.setSizePolicy(sizePolicy) + self.sliderSpectrogramMax.setMinimum(-150) + self.sliderSpectrogramMax.setMaximum(10) + self.sliderSpectrogramMax.setOrientation(QtCore.Qt.Horizontal) + self.sliderSpectrogramMax.setObjectName("sliderSpectrogramMax") + self.gridLayout_2.addWidget(self.sliderSpectrogramMax, 19, 1, 1, 1) + self.labelSpectrogramMin = QtWidgets.QLabel(SignalFrame) + self.labelSpectrogramMin.setObjectName("labelSpectrogramMin") + self.gridLayout_2.addWidget(self.labelSpectrogramMin, 18, 0, 1, 1) + self.labelSpectrogramMax = QtWidgets.QLabel(SignalFrame) + self.labelSpectrogramMax.setObjectName("labelSpectrogramMax") + self.gridLayout_2.addWidget(self.labelSpectrogramMax, 19, 0, 1, 1) self.horizontalLayout.addLayout(self.gridLayout_2) self.splitter = QtWidgets.QSplitter(SignalFrame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) @@ -245,12 +288,18 @@ def setupUi(self, SignalFrame): self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout_4 = QtWidgets.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.gvLegend = LegendGraphicView(self.layoutWidget) + self.stackedWidget = QtWidgets.QStackedWidget(self.layoutWidget) + self.stackedWidget.setLineWidth(0) + self.stackedWidget.setObjectName("stackedWidget") + self.pageSignal = QtWidgets.QWidget() + self.pageSignal.setObjectName("pageSignal") + self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.pageSignal) + self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_6.setSpacing(0) + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + self.gvLegend = LegendGraphicView(self.pageSignal) self.gvLegend.setMinimumSize(QtCore.QSize(0, 150)) self.gvLegend.setMaximumSize(QtCore.QSize(30, 16777215)) self.gvLegend.setFrameShape(QtWidgets.QFrame.NoFrame) @@ -261,8 +310,8 @@ def setupUi(self, SignalFrame): self.gvLegend.setRubberBandSelectionMode(QtCore.Qt.ContainsItemShape) self.gvLegend.setOptimizationFlags(QtWidgets.QGraphicsView.DontSavePainterState) self.gvLegend.setObjectName("gvLegend") - self.horizontalLayout_2.addWidget(self.gvLegend) - self.gvSignal = EpicGraphicView(self.layoutWidget) + self.horizontalLayout_6.addWidget(self.gvLegend) + self.gvSignal = EpicGraphicView(self.pageSignal) self.gvSignal.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) @@ -290,23 +339,42 @@ def setupUi(self, SignalFrame): self.gvSignal.setRubberBandSelectionMode(QtCore.Qt.ContainsItemShape) self.gvSignal.setOptimizationFlags(QtWidgets.QGraphicsView.DontClipPainter|QtWidgets.QGraphicsView.DontSavePainterState) self.gvSignal.setObjectName("gvSignal") - self.horizontalLayout_2.addWidget(self.gvSignal) - self.horizontalLayout_4.addLayout(self.horizontalLayout_2) - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout_6.addWidget(self.gvSignal) + self.stackedWidget.addWidget(self.pageSignal) + self.pageSpectrogram = QtWidgets.QWidget() + self.pageSpectrogram.setObjectName("pageSpectrogram") + self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.pageSpectrogram) + self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_4.setSpacing(0) + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.gvSpectrogram = SpectrogramGraphicView(self.pageSpectrogram) + self.gvSpectrogram.setMouseTracking(True) + self.gvSpectrogram.setFrameShape(QtWidgets.QFrame.NoFrame) + self.gvSpectrogram.setInteractive(False) + self.gvSpectrogram.setRenderHints(QtGui.QPainter.TextAntialiasing) + self.gvSpectrogram.setCacheMode(QtWidgets.QGraphicsView.CacheNone) + self.gvSpectrogram.setTransformationAnchor(QtWidgets.QGraphicsView.NoAnchor) + self.gvSpectrogram.setViewportUpdateMode(QtWidgets.QGraphicsView.MinimalViewportUpdate) + self.gvSpectrogram.setOptimizationFlags(QtWidgets.QGraphicsView.DontClipPainter|QtWidgets.QGraphicsView.DontSavePainterState) + self.gvSpectrogram.setObjectName("gvSpectrogram") + self.horizontalLayout_4.addWidget(self.gvSpectrogram) + self.stackedWidget.addWidget(self.pageSpectrogram) + self.horizontalLayout_2.addWidget(self.stackedWidget) + self.verticalLayout_5 = QtWidgets.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") self.lYScale = QtWidgets.QLabel(self.layoutWidget) self.lYScale.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.lYScale.setObjectName("lYScale") - self.verticalLayout_2.addWidget(self.lYScale) + self.verticalLayout_5.addWidget(self.lYScale) self.sliderYScale = QtWidgets.QSlider(self.layoutWidget) self.sliderYScale.setMinimum(1) self.sliderYScale.setMaximum(100) self.sliderYScale.setOrientation(QtCore.Qt.Vertical) self.sliderYScale.setTickPosition(QtWidgets.QSlider.TicksBelow) self.sliderYScale.setObjectName("sliderYScale") - self.verticalLayout_2.addWidget(self.sliderYScale) - self.horizontalLayout_4.addLayout(self.verticalLayout_2) - self.verticalLayout.addLayout(self.horizontalLayout_4) + self.verticalLayout_5.addWidget(self.sliderYScale) + self.horizontalLayout_2.addLayout(self.verticalLayout_5) + self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.btnShowHideStartEnd = QtWidgets.QToolButton(self.layoutWidget) @@ -426,6 +494,7 @@ def setupUi(self, SignalFrame): self.horizontalLayout.addWidget(self.splitter) self.retranslateUi(SignalFrame) + self.stackedWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(SignalFrame) SignalFrame.setTabOrder(self.btnSaveSignal, self.btnInfo) SignalFrame.setTabOrder(self.btnInfo, self.btnCloseSignal) @@ -438,10 +507,7 @@ def setupUi(self, SignalFrame): SignalFrame.setTabOrder(self.chkBoxShowProtocol, self.cbProtoView) SignalFrame.setTabOrder(self.cbProtoView, self.chkBoxSyncSelection) SignalFrame.setTabOrder(self.chkBoxSyncSelection, self.txtEdProto) - SignalFrame.setTabOrder(self.txtEdProto, self.gvLegend) - SignalFrame.setTabOrder(self.gvLegend, self.gvSignal) - SignalFrame.setTabOrder(self.gvSignal, self.sliderYScale) - SignalFrame.setTabOrder(self.sliderYScale, self.btnShowHideStartEnd) + SignalFrame.setTabOrder(self.txtEdProto, self.btnShowHideStartEnd) SignalFrame.setTabOrder(self.btnShowHideStartEnd, self.spinBoxSelectionStart) SignalFrame.setTabOrder(self.spinBoxSelectionStart, self.spinBoxSelectionEnd) @@ -458,6 +524,9 @@ def retranslateUi(self, SignalFrame): self.label.setToolTip(_translate("SignalFrame", "

Set the noise magnitude of your signal. You can tune this value to mute noise in your signal and reveal the true data.

")) self.label.setText(_translate("SignalFrame", "Noise:")) self.lineEditSignalName.setText(_translate("SignalFrame", "SignalName")) + self.cbProtoView.setItemText(0, _translate("SignalFrame", "Bits")) + self.cbProtoView.setItemText(1, _translate("SignalFrame", "Hex")) + self.cbProtoView.setItemText(2, _translate("SignalFrame", "ASCII")) self.lInfoLenText.setToolTip(_translate("SignalFrame", "

This is the length of one (raw) bit in samples.


Tune this value using either the spinbox on the right or the context-menu of the SignalView.

")) self.lInfoLenText.setText(_translate("SignalFrame", "Bit Length:")) self.spinBoxInfoLen.setToolTip(_translate("SignalFrame", "

This is the length of one (raw) bit in samples.


Tune this value using either the spinbox on the right or the context-menu of the SignalView.

")) @@ -465,9 +534,6 @@ def retranslateUi(self, SignalFrame): self.lErrorTolerance.setToolTip(_translate("SignalFrame", "

This is the error tolerance for determining the pulse lengths in the demodulated signal.

Example: Say, we are reading a ones pulse and the tolerance value was set to 5. Then 5 errors (which must follow sequentially) are accepted.

Tune this value if you have spiky data after demodulation.

")) self.lErrorTolerance.setText(_translate("SignalFrame", "Error Tolerance:")) self.lSignalViewText.setText(_translate("SignalFrame", "Signal View:")) - self.cbProtoView.setItemText(0, _translate("SignalFrame", "Bits")) - self.cbProtoView.setItemText(1, _translate("SignalFrame", "Hex")) - self.cbProtoView.setItemText(2, _translate("SignalFrame", "ASCII")) self.lCenterOffset.setToolTip(_translate("SignalFrame", "

This is the threshold used for determining if a bit is one or zero. You can set it here or grab the middle of the area in Quadrature Demod View.

")) self.lCenterOffset.setText(_translate("SignalFrame", "Center:")) self.btnAutoDetect.setToolTip(_translate("SignalFrame", "

Automatically detect Center and Bit Length, when you change the demodulation type. You can disable this behaviour for faster switching between demodulations.

")) @@ -483,10 +549,14 @@ def retranslateUi(self, SignalFrame): self.cbSignalView.setToolTip(_translate("SignalFrame", "

Choose the view of your signal.

The quadrature demodulation uses a treshold of magnitude, to supress noise. All samples with a magnitude lower than this treshold will be eliminated (set to -127) after demod.

Tune this value by selecting a noisy area and mark it as noise using context menu.

Current noise treshold is:

")) self.cbSignalView.setItemText(0, _translate("SignalFrame", "Analog")) self.cbSignalView.setItemText(1, _translate("SignalFrame", "Demodulated")) + self.cbSignalView.setItemText(2, _translate("SignalFrame", "Spectrogram")) self.cbModulationType.setToolTip(_translate("SignalFrame", "

Choose signals modulation:

  • Amplitude Shift Keying (ASK)
  • Frequency Shift Keying (FSK)
  • Phase Shift Keying (PSK)
")) self.cbModulationType.setItemText(0, _translate("SignalFrame", "ASK")) self.cbModulationType.setItemText(1, _translate("SignalFrame", "FSK")) self.cbModulationType.setItemText(2, _translate("SignalFrame", "PSK")) + self.labelFFTWindowSize.setText(_translate("SignalFrame", "FFT Window Size:")) + self.labelSpectrogramMin.setText(_translate("SignalFrame", "Datamin:")) + self.labelSpectrogramMax.setText(_translate("SignalFrame", "Datamax:")) self.lYScale.setText(_translate("SignalFrame", "Y-Scale")) self.btnShowHideStartEnd.setText(_translate("SignalFrame", "-")) self.lNumSelectedSamples.setToolTip(_translate("SignalFrame", "Number of currently selected samples.")) @@ -509,5 +579,6 @@ def retranslateUi(self, SignalFrame): from urh.ui.views.EpicGraphicView import EpicGraphicView from urh.ui.views.LegendGraphicView import LegendGraphicView +from urh.ui.views.SpectrogramGraphicView import SpectrogramGraphicView from urh.ui.views.TextEditProtocolView import TextEditProtocolView from . import urh_rc diff --git a/src/urh/ui/ui_tab_interpretation.py b/src/urh/ui/ui_tab_interpretation.py index b99c8b19db..06aa8af7c4 100644 --- a/src/urh/ui/ui_tab_interpretation.py +++ b/src/urh/ui/ui_tab_interpretation.py @@ -10,10 +10,10 @@ class Ui_Interpretation(object): def setupUi(self, Interpretation): Interpretation.setObjectName("Interpretation") Interpretation.resize(631, 561) - self.verticalLayout = QtWidgets.QVBoxLayout(Interpretation) - self.verticalLayout.setContentsMargins(0, 0, 0, 0) - self.verticalLayout.setSpacing(0) - self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout(Interpretation) + self.horizontalLayout.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout.setSpacing(0) + self.horizontalLayout.setObjectName("horizontalLayout") self.scrollArea = ScrollArea(Interpretation) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) @@ -37,8 +37,36 @@ def setupUi(self, Interpretation): self.scrlAreaSignals.setAutoFillBackground(True) self.scrlAreaSignals.setStyleSheet("") self.scrlAreaSignals.setObjectName("scrlAreaSignals") + self.verticalLayout = QtWidgets.QVBoxLayout(self.scrlAreaSignals) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.splitter = QtWidgets.QSplitter(self.scrlAreaSignals) + self.splitter.setStyleSheet("QSplitter::handle:vertical {\n" +"margin: 4px 0px;\n" +" background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, \n" +"stop:0 rgba(255, 255, 255, 0), \n" +"stop:0.5 rgba(100, 100, 100, 100), \n" +"stop:1 rgba(255, 255, 255, 0));\n" +" image: url(:/icons/data/icons/splitter_handle_horizontal.svg);\n" +"}") + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setHandleWidth(6) + self.splitter.setObjectName("splitter") + self.labelGettingStarted = QtWidgets.QLabel(self.splitter) + font = QtGui.QFont() + font.setPointSize(32) + self.labelGettingStarted.setFont(font) + self.labelGettingStarted.setStyleSheet("") + self.labelGettingStarted.setAlignment(QtCore.Qt.AlignCenter) + self.labelGettingStarted.setWordWrap(True) + self.labelGettingStarted.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) + self.labelGettingStarted.setObjectName("labelGettingStarted") + self.placeholderLabel = QtWidgets.QLabel(self.splitter) + self.placeholderLabel.setText("") + self.placeholderLabel.setObjectName("placeholderLabel") + self.verticalLayout.addWidget(self.splitter) self.scrollArea.setWidget(self.scrlAreaSignals) - self.verticalLayout.addWidget(self.scrollArea) + self.horizontalLayout.addWidget(self.scrollArea) self.retranslateUi(Interpretation) QtCore.QMetaObject.connectSlotsByName(Interpretation) @@ -46,5 +74,7 @@ def setupUi(self, Interpretation): def retranslateUi(self, Interpretation): _translate = QtCore.QCoreApplication.translate Interpretation.setWindowTitle(_translate("Interpretation", "Form")) + self.labelGettingStarted.setText(_translate("Interpretation", "

Open a file or record a new signal using the File menu to get started.

")) from urh.ui.ScrollArea import ScrollArea +from . import urh_rc diff --git a/src/urh/ui/views/EditableGraphicView.py b/src/urh/ui/views/EditableGraphicView.py index 46488ef160..1c8309e46d 100644 --- a/src/urh/ui/views/EditableGraphicView.py +++ b/src/urh/ui/views/EditableGraphicView.py @@ -1,13 +1,12 @@ -from PyQt5.QtCore import QPoint, Qt, pyqtSlot, pyqtSignal -from PyQt5.QtGui import QContextMenuEvent, QIcon, QKeySequence +from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal +from PyQt5.QtGui import QIcon, QKeySequence from PyQt5.QtWidgets import QAction, QActionGroup, QMenu, QUndoStack from urh.plugins.InsertSine.InsertSinePlugin import InsertSinePlugin from urh.plugins.PluginManager import PluginManager -from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.signalprocessing.Signal import Signal -from urh.ui.ROI import ROI from urh.ui.actions.EditSignalAction import EditSignalAction, EditAction +from urh.ui.painting.HorizontalSelection import HorizontalSelection from urh.ui.views.ZoomableGraphicView import ZoomableGraphicView @@ -22,6 +21,7 @@ def __init__(self, parent=None): self.participants = [] self.__sample_rate = None # For default sample rate in insert sine dialog + self.protocol = None # gets overwritten in epic graphic view self.autoRangeY = True self.save_enabled = False # Signal is can be saved @@ -33,9 +33,8 @@ def __init__(self, parent=None): self.stored_item = None # For copy/paste self.paste_position = 0 # Where to paste? Set in contextmenuevent - self.context_menu_position = None # type: QPoint - self._init_undo_stack(QUndoStack()) + self.init_undo_stack(QUndoStack()) self.addAction(self.undo_action) self.addAction(self.redo_action) @@ -77,7 +76,7 @@ def __init__(self, parent=None): self.insert_sine_plugin = InsertSinePlugin() self.insert_sine_plugin.insert_sine_wave_clicked.connect(self.on_insert_sine_wave_clicked) - def _init_undo_stack(self, undo_stack): + def init_undo_stack(self, undo_stack): self.undo_stack = undo_stack self.undo_action = self.undo_stack.createUndoAction(self) @@ -117,11 +116,7 @@ def signal(self) -> Signal: return self.__signal @property - def protocol(self) -> ProtocolAnalyzer: - return None # Gets overwritten in EpicGraphicView - - @property - def selection_area(self) -> ROI: + def selection_area(self) -> HorizontalSelection: return self.scene().selection_area @selection_area.setter @@ -142,38 +137,30 @@ def create_context_menu(self): menu.addSeparator() menu.addAction(self.copy_action) - self.copy_action.setEnabled(not self.selection_area.is_empty) + self.copy_action.setEnabled(self.something_is_selected) menu.addAction(self.paste_action) self.paste_action.setEnabled(self.stored_item is not None) menu.addSeparator() if PluginManager().is_plugin_enabled("InsertSine"): menu.addAction(self.insert_sine_action) - if not self.selection_area.is_empty: - menu.addSeparator() - - menu.addAction(self.zoom_in_action) - menu.addAction(self.zoom_out_action) - if not self.selection_area.is_empty: - zoom_action = menu.addAction(self.tr("Zoom selection")) - zoom_action.setIcon(QIcon.fromTheme("zoom-fit-best")) - zoom_action.triggered.connect(self.on_zoom_action_triggered) + self._add_zoom_actions_to_menu(menu) - menu.addSeparator() + if self.something_is_selected: menu.addAction(self.delete_action) crop_action = menu.addAction(self.tr("Crop to selection")) crop_action.triggered.connect(self.on_crop_action_triggered) mute_action = menu.addAction(self.tr("Mute selection")) mute_action.triggered.connect(self.on_mute_action_triggered) - menu.addSeparator() - if self.create_new_signal_enabled: create_action = menu.addAction(self.tr("Create signal from selection")) create_action.setIcon(QIcon.fromTheme("document-new")) create_action.triggered.connect(self.on_create_action_triggered) + menu.addSeparator() + if hasattr(self, "selected_messages"): selected_messages = self.selected_messages else: @@ -207,11 +194,10 @@ def create_context_menu(self): self.participant_actions[pa] = participant pa.triggered.connect(self.on_participant_action_triggered) - if hasattr(self, "scene_type") and self.scene_type == 0: - if not self.selection_area.is_empty: - menu.addSeparator() - noise_action = menu.addAction(self.tr("Set noise level from Selection")) - noise_action.triggered.connect(self.on_noise_action_triggered) + if self.scene_type == 0 and self.something_is_selected: + menu.addSeparator() + noise_action = menu.addAction(self.tr("Set noise level from Selection")) + noise_action.triggered.connect(self.on_noise_action_triggered) menu.addSeparator() menu.addAction(self.undo_action) @@ -219,18 +205,12 @@ def create_context_menu(self): return menu - def contextMenuEvent(self, event: QContextMenuEvent): - self.context_menu_position = event.pos() - menu = self.create_context_menu() - menu.exec_(self.mapToGlobal(event.pos())) - self.context_menu_position = None - - def clear_selection(self): - self.set_selection_area(0, 0) + def clear_horizontal_selection(self): + self.set_horizontal_selection(0, 0) @pyqtSlot() def on_insert_sine_action_triggered(self): - if not self.selection_area.is_empty: + if self.something_is_selected: num_samples = self.selection_area.width else: num_samples = None @@ -245,7 +225,7 @@ def on_insert_sine_action_triggered(self): @pyqtSlot() def on_insert_sine_wave_clicked(self): if self.insert_sine_plugin.complex_wave is not None: - self.clear_selection() + self.clear_horizontal_selection() insert_action = EditSignalAction(signal=self.signal, protocol=self.protocol, data_to_insert=self.insert_sine_plugin.complex_wave, position=self.paste_position, @@ -254,14 +234,14 @@ def on_insert_sine_wave_clicked(self): @pyqtSlot() def on_copy_action_triggered(self): - if not self.selection_area.is_empty: + if self.something_is_selected: self.stored_item = self.signal._fulldata[int(self.selection_area.start):int(self.selection_area.end)] @pyqtSlot() def on_paste_action_triggered(self): if self.stored_item is not None: # paste_position is set in ContextMenuEvent - self.clear_selection() + self.clear_horizontal_selection() paste_action = EditSignalAction(signal=self.signal, protocol=self.protocol, start=self.selection_area.start, end=self.selection_area.end, data_to_insert=self.stored_item, position=self.paste_position, @@ -270,9 +250,9 @@ def on_paste_action_triggered(self): @pyqtSlot() def on_delete_action_triggered(self): - if not self.selection_area.is_empty: + if self.something_is_selected: start, end = self.selection_area.start, self.selection_area.end - self.clear_selection() + self.clear_horizontal_selection() del_action = EditSignalAction(signal=self.signal, protocol=self.protocol, start=start, end=end, mode=EditAction.delete, cache_qad=self.cache_qad) @@ -280,9 +260,9 @@ def on_delete_action_triggered(self): @pyqtSlot() def on_crop_action_triggered(self): - if not self.selection_area.is_empty: + if self.something_is_selected: start, end = self.selection_area.start, self.selection_area.end - self.clear_selection() + self.clear_horizontal_selection() crop_action = EditSignalAction(signal=self.signal, protocol=self.protocol, start=start, end=end, mode=EditAction.crop, cache_qad=self.cache_qad) @@ -295,10 +275,6 @@ def on_mute_action_triggered(self): mode=EditAction.mute, cache_qad=self.cache_qad) self.undo_stack.push(mute_action) - @pyqtSlot() - def on_zoom_action_triggered(self): - self.zoom_to_selection(self.selection_area.start, self.selection_area.end) - @pyqtSlot() def on_create_action_triggered(self): self.create_clicked.emit(self.selection_area.start, self.selection_area.end) diff --git a/src/urh/ui/views/EpicGraphicView.py b/src/urh/ui/views/EpicGraphicView.py index 5e38426876..9dbc29b87c 100644 --- a/src/urh/ui/views/EpicGraphicView.py +++ b/src/urh/ui/views/EpicGraphicView.py @@ -1,9 +1,9 @@ +import math from PyQt5.QtCore import Qt, QPoint, pyqtSignal, pyqtSlot from PyQt5.QtGui import QIcon, QKeySequence from PyQt5.QtWidgets import QAction from urh import constants -from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.ui.views.EditableGraphicView import EditableGraphicView @@ -22,8 +22,6 @@ def __init__(self, parent=None): self.cache_qad = True self.y_sep = 0 - self._init_undo_stack(self.parent_frame.undo_stack) - self.save_action = QAction(self.tr("Save"), self) # type: QAction self.save_action.setIcon(QIcon.fromTheme("document-save")) self.save_action.setShortcut(QKeySequence.Save) @@ -31,10 +29,6 @@ def __init__(self, parent=None): self.save_action.setShortcutContext(Qt.WidgetWithChildrenShortcut) self.addAction(self.save_action) - @property - def parent_frame(self): - return self.parent().parent().parent() - @property def sample_rate(self): try: @@ -46,32 +40,16 @@ def sample_rate(self): def sample_rate(self, value): raise ValueError("Not implemented for epic graphic view") - @property - def signal(self): - if self.parent_frame is not None: - return self.parent_frame.signal - else: - return None - - @property - def protocol(self) -> ProtocolAnalyzer: - return self.parent_frame.proto_analyzer - - @property - def scene_type(self): - return self.parent_frame.ui.cbSignalView.currentIndex() - @property def selected_messages(self): - if not self.selection_area.is_empty: - pa = self.parent_frame.proto_analyzer - sb, _, eb, _ = pa.get_bitseq_from_selection(self.selection_area.start, abs(self.selection_area.width)) - return pa.messages[sb:eb + 1] + if self.something_is_selected and self.protocol: + sb, _, eb, _ = self.protocol.get_bitseq_from_selection(self.selection_area.start, abs(self.selection_area.width)) + return self.protocol.messages[sb:eb + 1] else: return [] def is_pos_in_separea(self, pos: QPoint): - if self.scene_type == 0: + if self.scene_type != 1: return False padding = constants.SEPARATION_PADDING * self.view_rect().height() return self.y_sep - padding <= pos.y() <= self.y_sep + padding @@ -79,8 +57,8 @@ def is_pos_in_separea(self, pos: QPoint): def _get_sub_path_ranges_and_colors(self, start: float, end: float): sub_path_ranges = [] colors = [] - start = int(start) if start > 0 else 0 - end = int(end) if end == int(end) else int(end) + 1 + start = max(0, int(start)) + end = int(math.ceil(end)) if not self.protocol.messages: return None, None @@ -92,6 +70,9 @@ def _get_sub_path_ranges_and_colors(self, start: float, end: float): color = None if message.participant is None else constants.PARTICIPANT_COLORS[ message.participant.color_index] + if color is None: + continue + # Append the pause until first bit of message sub_path_ranges.append((start, message.bit_sample_pos[0])) if start < message.bit_sample_pos[0]: @@ -105,7 +86,7 @@ def _get_sub_path_ranges_and_colors(self, start: float, end: float): break # Data part of the message - sub_path_ranges.append((message.bit_sample_pos[0], message.bit_sample_pos[-2])) + sub_path_ranges.append((message.bit_sample_pos[0], message.bit_sample_pos[-2] + 1)) colors.append(color) start = message.bit_sample_pos[-2] + 1 diff --git a/src/urh/ui/views/LiveGraphicView.py b/src/urh/ui/views/LiveGraphicView.py index 0361a94dc0..f2c1d4c12e 100644 --- a/src/urh/ui/views/LiveGraphicView.py +++ b/src/urh/ui/views/LiveGraphicView.py @@ -2,7 +2,7 @@ from PyQt5.QtGui import QWheelEvent, QMouseEvent from PyQt5.QtWidgets import QToolTip -from urh.ui.GridScene import GridScene +from urh.ui.painting.GridScene import GridScene from urh.ui.views.ZoomableGraphicView import ZoomableGraphicView from urh.util.Formatter import Formatter diff --git a/src/urh/ui/views/SelectableGraphicView.py b/src/urh/ui/views/SelectableGraphicView.py index fc6d7518ef..6fc6030d9b 100644 --- a/src/urh/ui/views/SelectableGraphicView.py +++ b/src/urh/ui/views/SelectableGraphicView.py @@ -1,17 +1,19 @@ from PyQt5.QtCore import QRectF, pyqtSignal, Qt, QPoint -from PyQt5.QtGui import QMouseEvent, QKeyEvent, QPainter -from PyQt5.QtWidgets import QGraphicsView +from PyQt5.QtGui import QMouseEvent, QKeyEvent, QPainter, QKeySequence, QIcon +from PyQt5.QtWidgets import QGraphicsView, QAction from urh import constants -from urh.SceneManager import SceneManager -from urh.ui.ROI import ROI -from urh.ui.ZoomableScene import ZoomableScene +from urh.ui.painting.HorizontalSelection import HorizontalSelection +from urh.ui.painting.SceneManager import SceneManager +from urh.ui.painting.ZoomableScene import ZoomableScene +from urh.util import util class SelectableGraphicView(QGraphicsView): sep_area_moving = pyqtSignal(float) sep_area_changed = pyqtSignal(float) - sel_area_width_changed = pyqtSignal(int) + selection_width_changed = pyqtSignal(int) + selection_height_changed = pyqtSignal(int) sel_area_start_end_changed = pyqtSignal(int, int) def __init__(self, parent=None): @@ -26,26 +28,43 @@ def __init__(self, parent=None): self.mouse_pos = None # type: QPoint self.grab_start = None # type: QPoint + self.move_y_with_drag = False + self.xmove = 0 self.separation_area_moving = False self.shift_mode = False # Shift Key currently pressed? + self.select_all_action = QAction(self.tr("Select all"), self) + self.select_all_action.setShortcut(QKeySequence.SelectAll) + self.select_all_action.triggered.connect(self.select_all) + self.select_all_action.setShortcutContext(Qt.WidgetWithChildrenShortcut) + self.select_all_action.setIcon(QIcon.fromTheme("edit-select-all")) + self.addAction(self.select_all_action) + def scene(self) -> ZoomableScene: return super().scene() @property - def selection_area(self) -> ROI: + def selection_area(self) -> HorizontalSelection: return self.scene().selection_area @selection_area.setter def selection_area(self, value): self.scene().selection_area = value + @property + def has_horizontal_selection(self) -> bool: + return isinstance(self.scene().selection_area, HorizontalSelection) + @property def hold_shift_to_drag(self) -> bool: - return constants.SETTINGS.value('hold_shift_to_drag', False, type=bool) + return constants.SETTINGS.value('hold_shift_to_drag', True, type=bool) + + @property + def something_is_selected(self) -> bool: + return hasattr(self, "selection_area") and self.selection_area is not None and not self.selection_area.is_empty def is_pos_in_separea(self, pos: QPoint): """ @@ -101,12 +120,11 @@ def mousePressEvent(self, event: QMouseEvent): self.setCursor(Qt.SplitVCursor) elif self.selection_area.is_empty or self.selection_area.selected_edge is None: - # Neue ROI anlegen + # Create new selection self.mouse_press_pos = event.pos() self.mouse_pos = event.pos() scene_pos = self.mapToScene(self.mouse_press_pos) - x = scene_pos.x() - self.set_selection_area(x=x, w=0) + self.__set_selection_area(x=scene_pos.x(), y=scene_pos.y(), w=0, h=0) self.selection_area.finished = False elif self.selection_area.selected_edge is not None: @@ -119,8 +137,13 @@ def mouseMoveEvent(self, event: QMouseEvent): cursor = self.cursor().shape() if self.grab_start is not None: - move = self.grab_start.x() - event.pos().x() - self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() + move) + move_x = self.grab_start.x() - event.pos().x() + self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() + move_x) + + if self.move_y_with_drag: + move_y = self.grab_start.y() - event.pos().y() + self.verticalScrollBar().setValue(self.verticalScrollBar().value() + move_y) + self.grab_start = event.pos() return @@ -133,32 +156,41 @@ def mouseMoveEvent(self, event: QMouseEvent): self.sep_area_moving.emit(y_sep) elif self.is_pos_in_separea(self.mapToScene(event.pos())): self.setCursor(Qt.SplitVCursor) - elif cursor == Qt.SplitVCursor: + elif cursor == Qt.SplitVCursor and self.has_horizontal_selection: self.unsetCursor() if self.selection_area.finished and not self.selection_area.resizing: pos = self.mapToScene(event.pos()) - roi_edge = self.selection_area.get_selected_edge(pos, self.view_rect().width()) - if roi_edge is None and cursor == Qt.SplitHCursor: - self.unsetCursor() - return + roi_edge = self.selection_area.get_selected_edge(pos, self.transform()) + if roi_edge is None: + if (cursor == Qt.SplitHCursor and self.has_horizontal_selection) \ + or (cursor == Qt.SplitVCursor and not self.has_horizontal_selection): + self.unsetCursor() + return elif roi_edge == 0 or roi_edge == 1: - self.setCursor(Qt.SplitHCursor) + if self.has_horizontal_selection: + self.setCursor(Qt.SplitHCursor) + else: + self.setCursor(Qt.SplitVCursor) if event.buttons() == Qt.LeftButton and self.selection_area.resizing: if self.selection_area.selected_edge == 0: start = self.mapToScene(event.pos()) - self.set_selection_area(x=start.x()) - self.scroll_mouse(start.x()) + self.__set_selection_area(x=start.x(), y=start.y()) + if self.has_horizontal_selection: + self.scroll_mouse(start.x()) return if self.selection_area.selected_edge == 1: - start = QPoint(self.selection_area.rect().x(), self.selection_area.rect().y()) + start = QPoint(self.selection_area.x, self.selection_area.y) end = self.mapToScene(event.pos()) - self.set_selection_area(w=end.x() - start.x()) - self.scroll_mouse(end.x()) + self.__set_selection_area(w=end.x() - start.x(), h=end.y() - start.y()) + + if self.has_horizontal_selection: + self.scroll_mouse(end.x()) + return if self.mouse_press_pos is None: @@ -168,8 +200,9 @@ def mouseMoveEvent(self, event: QMouseEvent): if event.buttons() == Qt.LeftButton and not self.selection_area.finished: start = self.mapToScene(self.mouse_press_pos) end = self.mapToScene(self.mouse_pos) - self.set_selection_area(w=end.x() - start.x()) - self.scroll_mouse(end.x()) + self.__set_selection_area(w=end.x() - start.x(), h=end.y() - start.y()) + if self.has_horizontal_selection: + self.scroll_mouse(end.x()) def scroll_mouse(self, mouse_x: int): """ @@ -213,8 +246,8 @@ def mouseReleaseEvent(self, event: QMouseEvent): self.selection_area.finished = True self.selection_area.resizing = False - self.emit_sel_area_width_changed() - self.sel_area_start_end_changed.emit(self.selection_area.start, self.selection_area.end) + self.emit_selection_size_changed() + self.emit_selection_start_end_changed() def refresh_selection_area(self): """ @@ -222,18 +255,34 @@ def refresh_selection_area(self): This happens e.g. when switching from Signal View to Quad Demod view :return: """ - self.set_selection_area(x=self.selection_area.x, w=self.selection_area.width) + self.__set_selection_area(x=self.selection_area.x, y=self.selection_area.y, + w=self.selection_area.width, h=self.selection_area.height) + + def set_vertical_selection(self, y=None, h=None): + self.selection_area.setX(self.sceneRect().x()) + self.selection_area.width = self.sceneRect().width() + + if y is not None: + y = util.clip(y, self.sceneRect().y(), self.sceneRect().y() + self.sceneRect().height()) + self.selection_area.setY(y) + + if h is not None: + y = self.selection_area.y + if y + h < self.sceneRect().y(): + h = self.sceneRect().y() - y + elif y + h > self.sceneRect().y() + self.sceneRect().height(): + h = (self.sceneRect().y() + self.sceneRect().height()) - y + + self.selection_area.height = h - def set_selection_area(self, x=None, w=None): + self.emit_selection_size_changed() + + def set_horizontal_selection(self, x=None, w=None): self.selection_area.setY(self.view_rect().y()) self.selection_area.height = self.view_rect().height() if x is not None: - if x < self.sceneRect().x(): - x = self.sceneRect().x() - elif x > self.sceneRect().x() + self.sceneRect().width(): - x = self.sceneRect().x() + self.sceneRect().width() - + x = util.clip(x, self.sceneRect().x(), self.sceneRect().x() + self.sceneRect().width()) self.selection_area.setX(x) if w is not None: @@ -245,10 +294,25 @@ def set_selection_area(self, x=None, w=None): self.selection_area.width = w - self.emit_sel_area_width_changed() + self.emit_selection_size_changed() + + def __set_selection_area(self, x=None, y=None, w=None, h=None): + if self.has_horizontal_selection: + self.set_horizontal_selection(x, w) + else: + self.set_vertical_selection(y, h) - def emit_sel_area_width_changed(self): - self.sel_area_width_changed.emit(int(self.selection_area.width)) + def select_all(self): + self.__set_selection_area(*self.sceneRect().getCoords()) + + def emit_selection_size_changed(self): + if self.has_horizontal_selection: + self.selection_width_changed.emit(int(self.selection_area.width)) + else: + self.selection_height_changed.emit(int(self.selection_area.height)) + + def emit_selection_start_end_changed(self): + self.sel_area_start_end_changed.emit(self.selection_area.start, self.selection_area.end) def view_rect(self) -> QRectF: """ diff --git a/src/urh/ui/views/SpectrogramGraphicView.py b/src/urh/ui/views/SpectrogramGraphicView.py new file mode 100644 index 0000000000..abb56ff79b --- /dev/null +++ b/src/urh/ui/views/SpectrogramGraphicView.py @@ -0,0 +1,97 @@ +import numpy as np +from PyQt5.QtCore import pyqtSlot, pyqtSignal +from PyQt5.QtGui import QIcon +from PyQt5.QtWidgets import QMenu + +from urh.controller.FilterBandwidthDialogController import FilterBandwidthDialogController +from urh.signalprocessing.Filter import Filter +from urh.ui.painting.SpectrogramScene import SpectrogramScene +from urh.ui.painting.SpectrogramSceneManager import SpectrogramSceneManager +from urh.ui.views.ZoomableGraphicView import ZoomableGraphicView +from urh.util import util + + +class SpectrogramGraphicView(ZoomableGraphicView): + MINIMUM_VIEW_WIDTH = 10 + y_scale_changed = pyqtSignal(float) + bandpass_filter_triggered = pyqtSignal(float, float) + + def __init__(self, parent=None): + super().__init__(parent) + + self.move_y_with_drag = True + self.scene_manager = SpectrogramSceneManager(np.zeros(1), parent=self) + self.setScene(self.scene_manager.scene) + + @property + def y_center(self): + return self.sceneRect().height() // 2 + + @property + def height_spectrogram(self): + if self.scene_manager and self.scene_manager.spectrogram: + return self.scene_manager.spectrogram.freq_bins + else: + return 0 + + @property + def width_spectrogram(self): + if self.scene_manager and self.scene_manager.spectrogram: + return self.scene_manager.spectrogram.time_bins + else: + return 0 + + def scene(self) -> SpectrogramScene: + return super().scene() + + def create_context_menu(self): + menu = QMenu() + self._add_zoom_actions_to_menu(menu) + + if self.something_is_selected: + filter_bw = Filter.read_configured_filter_bw() + text = self.tr("Create signal from frequency selection (filter bw={0:n})".format(filter_bw)) + create_from_frequency_selection = menu.addAction(text) + create_from_frequency_selection.triggered.connect(self.on_create_from_frequency_selection_triggered) + create_from_frequency_selection.setIcon(QIcon.fromTheme("view-filter")) + + configure_filter_bw = menu.addAction(self.tr("Configure filter bandwidth...")) + configure_filter_bw.triggered.connect(self.on_configure_filter_bw_triggered) + configure_filter_bw.setIcon(QIcon.fromTheme("configure")) + + return menu + + def zoom_to_selection(self, start: int, end: int): + if start == end: + return + + x_center = self.view_rect().x() + self.view_rect().width() / 2 + y_factor = self.view_rect().height() / (end - start) + self.scale(1, y_factor) + self.centerOn(x_center, start + (end - start) / 2) + self.y_scale_changed.emit(y_factor) + + def auto_fit_view(self): + pass + + def emit_selection_start_end_changed(self): + h = self.sceneRect().height() + self.sel_area_start_end_changed.emit(h - self.selection_area.end, h - self.selection_area.start) + + @pyqtSlot() + def on_create_from_frequency_selection_triggered(self): + sh = self.sceneRect().height() + y1, y2 = sh / 2 - self.selection_area.start, sh / 2 - self.selection_area.end + f_low, f_high = y1 / self.sceneRect().height(), y2 / self.sceneRect().height() + f_low = util.clip(f_low, 0, 0.5) + f_high = util.clip(f_high, 0, 0.5) + + if f_low > f_high: + f_low, f_high = f_high, f_low + + self.bandpass_filter_triggered.emit(f_low, f_high) + + @pyqtSlot() + def on_configure_filter_bw_triggered(self): + dialog = FilterBandwidthDialogController(parent=self) + dialog.show() diff --git a/src/urh/ui/views/ZoomAndDropableGraphicView.py b/src/urh/ui/views/ZoomAndDropableGraphicView.py index 1cf091e6e9..f31326f22e 100644 --- a/src/urh/ui/views/ZoomAndDropableGraphicView.py +++ b/src/urh/ui/views/ZoomAndDropableGraphicView.py @@ -1,9 +1,9 @@ from PyQt5.QtCore import pyqtSignal from PyQt5.QtGui import QDragEnterEvent, QDropEvent -from urh.SignalSceneManager import SignalSceneManager from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer from urh.signalprocessing.Signal import Signal +from urh.ui.painting.SignalSceneManager import SignalSceneManager from urh.ui.views.ZoomableGraphicView import ZoomableGraphicView diff --git a/src/urh/ui/views/ZoomableGraphicView.py b/src/urh/ui/views/ZoomableGraphicView.py index cb64e06251..6b4414a912 100644 --- a/src/urh/ui/views/ZoomableGraphicView.py +++ b/src/urh/ui/views/ZoomableGraphicView.py @@ -1,13 +1,14 @@ from PyQt5.QtCore import QTimer, pyqtSlot, Qt, pyqtSignal -from PyQt5.QtGui import QIcon, QKeySequence, QWheelEvent, QCursor -from PyQt5.QtWidgets import QAction, QGraphicsScene +from PyQt5.QtGui import QIcon, QKeySequence, QWheelEvent, QCursor, QContextMenuEvent +from PyQt5.QtWidgets import QAction, QMenu -from urh.SceneManager import SceneManager +from urh.ui.painting.SceneManager import SceneManager from urh.ui.views.SelectableGraphicView import SelectableGraphicView from urh.util.Logger import logger class ZoomableGraphicView(SelectableGraphicView): + MINIMUM_VIEW_WIDTH = 300 # argument is x zoom factor # if argument is -1, then show_full_scene was triggered during zoom @@ -16,6 +17,9 @@ class ZoomableGraphicView(SelectableGraphicView): def __init__(self, parent=None): super().__init__(parent) + self.context_menu_position = None # type: QPoint + self.scene_type = 0 + self.zoom_in_action = QAction(self.tr("Zoom in"), self) self.zoom_in_action.setShortcut(QKeySequence.ZoomIn) self.zoom_in_action.triggered.connect(self.on_zoom_in_action_triggered) @@ -50,15 +54,33 @@ def __init__(self, parent=None): @property def y_center(self): - if not hasattr(self, "scene_type") or self.scene_type == 0: + if self.scene_type == 0: # Normal scene return 0 else: return -self.signal.qad_center - @property - def scene_type(self): - return 0 # gets overwritten in Epic Graphic View + def create_context_menu(self): + menu = QMenu() + self._add_zoom_actions_to_menu(menu) + return menu + + def contextMenuEvent(self, event: QContextMenuEvent): + self.context_menu_position = event.pos() + menu = self.create_context_menu() + menu.exec_(self.mapToGlobal(event.pos())) + self.context_menu_position = None + + def _add_zoom_actions_to_menu(self, menu: QMenu): + menu.addAction(self.zoom_in_action) + menu.addAction(self.zoom_out_action) + + if self.something_is_selected: + zoom_action = menu.addAction(self.tr("Zoom selection")) + zoom_action.setIcon(QIcon.fromTheme("zoom-fit-best")) + zoom_action.triggered.connect(self.on_zoom_action_triggered) + + menu.addSeparator() def scrollContentsBy(self, dx: int, dy: int): try: @@ -68,8 +90,8 @@ def scrollContentsBy(self, dx: int, dy: int): logger.warning("Graphic View already closed: " + str(e)) def zoom(self, factor, zoom_to_mouse_cursor=True, cursor_pos=None): - if factor > 1 and self.view_rect().width() / factor < 300: - factor = self.view_rect().width() / 300 + if factor > 1 and self.view_rect().width() / factor < self.MINIMUM_VIEW_WIDTH: + factor = self.view_rect().width() / self.MINIMUM_VIEW_WIDTH if zoom_to_mouse_cursor: pos = self.mapFromGlobal(QCursor.pos()) if cursor_pos is None else cursor_pos @@ -115,7 +137,8 @@ def show_full_scene(self, reinitialize=False): y_factor = self.transform().m22() self.resetTransform() # Use full self.width() here to enable show_full_scene when view_rect not yet set e.g. in Record Signal Dialog - x_factor = self.width() / (self.sceneRect().width() * self.scene_x_zoom_stretch) if self.sceneRect().width() else 1 + x_factor = self.width() / ( + self.sceneRect().width() * self.scene_x_zoom_stretch) if self.sceneRect().width() else 1 self.scale(x_factor, y_factor) self.centerOn(0, self.y_center) @@ -174,3 +197,7 @@ def on_zoom_out_action_triggered(self): def on_zoom_original_action_triggered(self): self.show_full_scene(reinitialize=False) self.zoomed.emit(-1) + + @pyqtSlot() + def on_zoom_action_triggered(self): + self.zoom_to_selection(self.selection_area.start, self.selection_area.end) diff --git a/src/urh/util/Formatter.py b/src/urh/util/Formatter.py index 96e0e27e4a..e1c42e3d4b 100644 --- a/src/urh/util/Formatter.py +++ b/src/urh/util/Formatter.py @@ -38,7 +38,7 @@ def big_value_with_suffix(value: float, decimals=3) -> str: elif abs(value) >= 1e6: return locale.format_string(fmt_str+"M", value / 1e6) elif abs(value) >= 1e3: - return locale.format_string(fmt_str+"K", value / 1e3) + return locale.format_string(fmt_str+"k", value / 1e3) else: return locale.format_string(fmt_str, value) diff --git a/src/urh/util/util.py b/src/urh/util/util.py index 208a816909..3e19ef2500 100644 --- a/src/urh/util/util.py +++ b/src/urh/util/util.py @@ -83,3 +83,7 @@ def aggregate_bits(bits: array.array, size=4) -> array.array: result.append(h) return result + + +def clip(value, minimum, maximum): + return max(minimum, min(value, maximum)) diff --git a/tests/QtTestCase.py b/tests/QtTestCase.py index 98085b55ce..49a3a5e1e9 100644 --- a/tests/QtTestCase.py +++ b/tests/QtTestCase.py @@ -45,6 +45,9 @@ def add_signal_to_form(self, filename: str): self.wait_before_new_file() self.form.add_signalfile(get_path_for_data_file(filename)) + def get_path_for_filename(self, filename) -> str: + return get_path_for_data_file(filename) + def add_signal_to_generator(self, signal_index: int): gframe = self.form.generator_tab_controller item = gframe.tree_model.rootItem.children[0].children[signal_index] diff --git a/tests/SpectrogramTest.py b/tests/SpectrogramTest.py new file mode 100644 index 0000000000..05d61c45f4 --- /dev/null +++ b/tests/SpectrogramTest.py @@ -0,0 +1,207 @@ +import unittest +import numpy as np +from tests.utils_testing import get_path_for_data_file +from urh.signalprocessing.Filter import Filter +from urh.signalprocessing.Modulator import Modulator +from urh.signalprocessing.Signal import Signal +import array + +from matplotlib import pyplot as plt +from urh.cythonext import signalFunctions +from urh.signalprocessing.Spectrogram import Spectrogram + + +class SpectrogramTest(unittest.TestCase): + """ short time fourier transform of audio signal """ + + def stft(self, samples, window_size, overlap_factor=0.5, window_function=np.hanning): + """ + Perform Short-time Fourier transform to get the spectrogram for the given samples + + :param samples: Complex samples + :param window_size: Size of DFT window + :param overlap_factor: Value between 0 (= No Overlapping) and 1 (= Full overlapping) of windows + :param window_function: Function for DFT window + :return: short-time Fourier transform of the given signal + """ + window = window_function(window_size) + + # hop size determines by how many samples the window is advanced + hop_size = window_size - int(overlap_factor * window_size) + + # pad with zeros to ensure last window fits signal + padded_samples = np.append(samples, np.zeros((len(samples) - window_size) % hop_size)) + num_frames = ((len(padded_samples) - window_size) // hop_size) + 1 + frames = [padded_samples[i*hop_size:i*hop_size+window_size] * window for i in range(num_frames)] + return np.fft.fft(frames) + + def setUp(self): + self.signal = Signal(get_path_for_data_file("two_participants.complex"), "test") + + def test_numpy_impl(self): + sample_rate = 1e6 + spectrogram = np.fft.fftshift(self.stft(self.signal.data, 2**10, overlap_factor=0.5)) / 1024 + + ims = 10 * np.log10(spectrogram.real ** 2 + spectrogram.imag ** 2) # convert amplitudes to decibel + num_time_bins, num_freq_bins = np.shape(ims) + + plt.imshow(np.transpose(ims), aspect="auto", cmap="magma") + plt.colorbar() + + plt.xlabel("time in seconds") + plt.ylabel("frequency in Hz") + plt.ylim(ymin=0, ymax=num_freq_bins) + + x_tick_pos = np.linspace(0, num_time_bins - 1, 5, dtype=np.float32) + plt.xticks(x_tick_pos, ["%.02f" % l for l in (x_tick_pos * len(self.signal.data) / num_time_bins) / sample_rate]) + y_tick_pos = np.linspace(0, num_freq_bins - 1, 10, dtype=np.int16) + frequencies = np.fft.fftshift(np.fft.fftfreq(num_freq_bins, 1/sample_rate)) + plt.yticks(y_tick_pos, ["%.02f" % frequencies[i] for i in y_tick_pos]) + + plt.show() + + def narrowband_iir(self, fc, bw, fs): + fc /= fs + bw /= fs + + R = 1 - 3 * bw + K = (1 - 2 * R * np.cos(2 * np.pi * fc) + R ** 2) / (2 - 2*np.cos(2 * np.pi * fc)) + + a = np.array([K, -2*K*np.cos(2 * np.pi * fc), K], dtype=np.float64) + b = np.array([2 * R * np.cos(2 * np.pi * fc), -R**2], dtype=np.float64) + + return a, b + + def test_bandpass(self): + # Generate a noisy signal + fs = 2000 + T = 0.1 + nsamples = T * fs + t = np.linspace(0, T, nsamples, endpoint=False) + a = 0.02 + f0 = 600 + x = 0.25 * np.sin(2 * np.pi * 0.25*f0 * t) + x += 0.25 * np.sin(2 * np.pi * f0 * t) + x += 0.25 * np.sin(2 * np.pi * 2*f0 * t) + x += 0.25 * np.sin(2 * np.pi * 3*f0 * t) + + import time + + lowcut = f0 - 200 + highcut = f0 + 200 + + # Define the parameters + fc = f0 / fs + b = 0.05 + data = x + + y = Filter.apply_bandpass_filter(data, lowcut, highcut, fs, filter_bw=b) + + plt.plot(y, label='Filtered signal (%g Hz)' % f0) + plt.plot(data, label='Noisy signal') + plt.legend(loc='upper left') + plt.show() + + def test_iir_bandpass(self): + # Generate a noisy signal + fs = 2400 + T = 6 + nsamples = T * fs + t = np.linspace(0, T, nsamples, endpoint=False) + a = 0.02 + f0 = 300 + x = 0.5 * np.sin(2 * np.pi * f0 * t) + x += 0.25 * np.sin(2 * np.pi * 2 * f0 * t) + x += 0.25 * np.sin(2 * np.pi * 3 * f0 * t) + + #data = x.astype(np.complex64) + data = np.sin(2 * np.pi * f0 * t).astype(np.complex64) + + print("Len data", len(data)) + a, b = self.narrowband_iir(f0, 100, fs) + s = a.sum() + b.sum() + #a /= s + #b /= s + print(a, b) + + filtered_data = signalFunctions.iir_filter(a, b, data) + + #plt.plot(data, label='Noisy signal') + plt.plot(np.fft.fft(filtered_data), label='Filtered signal (%g Hz)' % f0) + + + + plt.legend(loc='upper left') + plt.show() + + def test_channels(self): + sample_rate = 10 ** 6 + + channel1_freq = 40 * 10 ** 3 + channel2_freq = 240 * 10 ** 3 + + channel1_data = array.array("B", [1, 0, 1, 0, 1, 0, 0, 1]) + channel2_data = array.array("B", [1, 1, 0, 0, 1, 1, 0, 1]) + + filter_bw = 0.1 + + filter_freq1_high = 1.5 * channel1_freq + filter_freq1_low = 0.5 * channel1_freq + filter_freq2_high = 1.5*channel2_freq + filter_freq2_low = 0.5 * channel2_freq + + modulator1, modulator2 = Modulator("test"), Modulator("test2") + modulator1.carrier_freq_hz = channel1_freq + modulator2.carrier_freq_hz = channel2_freq + modulator1.sample_rate = modulator2.sample_rate = sample_rate + modulator1.modulate(channel1_data) + modulator2.modulate(channel2_data) + data1, data2 = modulator1.modulated_samples, modulator2.modulated_samples + + mixed_signal = data1 + data2 + + plt.subplot("221") + plt.title("Signal") + plt.plot(mixed_signal) + + spectrogram = Spectrogram(mixed_signal) + plt.subplot("222") + plt.title("Spectrogram") + plt.imshow(np.transpose(spectrogram.data), aspect="auto", cmap="magma") + plt.ylim(0, spectrogram.freq_bins) + + chann1_filtered = Filter.apply_bandpass_filter(mixed_signal, filter_freq1_low, filter_freq1_high, sample_rate, filter_bw) + plt.subplot("223") + plt.title("Channel 1 Filtered ({})".format("".join(map(str, channel1_data)))) + plt.plot(chann1_filtered) + + chann2_filtered = Filter.apply_bandpass_filter(mixed_signal, filter_freq2_low, filter_freq2_high, sample_rate, filter_bw) + plt.subplot("224") + plt.title("Channel 2 Filtered ({})".format("".join(map(str, channel2_data)))) + plt.plot(chann2_filtered) + + plt.show() + + + def test_bandpass_h(self): + f_low = 0.31 + f_high = 0.44 + bw = 0.01 + + h = Filter.design_windowed_sinc_bandpass(f_low=f_low, f_high=f_high, bw=bw) + #h = Filter.design_windowed_sinc_lpf(0.42, bw=0.08) + + impulse = np.exp(1j * np.linspace(0, 1, 50)) + + plt.subplot("221") + plt.title("f_low={} f_high={} bw=0.05".format(f_low, f_high, bw)) + plt.plot(np.fft.rfft(h)) + + plt.subplot("222") + plt.plot(h) + + plt.show() + + + + # h = cls.design_windowed_sinc_bandpass(f_low, f_high, filter_bw) diff --git a/tests/data/two_channels.complex b/tests/data/two_channels.complex new file mode 100644 index 0000000000000000000000000000000000000000..0e9be96e22d0738ef43f7aff7084134a300950ed GIT binary patch literal 6400 zcmb`MdsI~A8iz;C3y7knGzpPuB7%yYK+&B2nJYYMr!=)BQ!~5ZrAWoNJ5GgURz^xl z3In2Y5d)81q+)*`oz%$7Fx@-@Dw-*whEnFJ$JFyo?z0x_{L`9M{4;Cze!utqJ^Ov} z{cSXvOk+&^bh{}-%+D?mwS!x9zXgFJaf`2bdU39NDXT{4X=af)B3LX*J}>tEGE4b2 zR){+;1*w&r?3P!{o3!5fF3o(iQxAIIA!-8aRIijA;kUk4IXgOJ(5IQQG}K=O^SL$D zUzoUlsiQ-a#NC>bqb~Jy>bJk|PzmI@nCFtWkT-UdUH_6g-5M*@D(c23pI06od(zBm zExO_t=V~r={%3xm^0}c~fiR|Dz}t~s_&yH~C-*PR4-~P)$HHOdd?_3@@-2d+*5C-B z-gr1ls6QHxV{nAR@ge&9!_n2?=!5=Zg99GXjq9~=yiZ&R995hPfy47WLi1g6DtU)( zw(BRU(|V*rO{8uz9GU1i4o5b+mcZe8-k0IN>_!{Atru6b}AL+5oky0+=Zys_^`dN>xs z(aL={967`G1RYt!-SqbaJbO-OLC4l_-?Iws*^+3 zp#LHq$)9A(>2Mt7dP*mUc8Iuh$vG;kms5{~V?TLv=*QuUK`N`rt~VMSQ;dFip64N> zAIWfRN9RR2JiiZ5|K1Oq7}~f$a^E_erP8`wXjhi0)<;d+!^eb-OiEL?Uq}-FF0o3# z5q9mBGO3S}g}s z*P5K5ZbOHEsa1OoU4KhT6Qj{NXu3&ixi(9Mbvbio6GwbaQK}8cDL5t)A7yZS1&5Ep zagO|x;TS@_@8NJze?J`g=m~)18u}z04d^X}<8kzV2gfx&L*Z!VdOjS#5_bTOZEZNt z!118L(M+AiaD=tt=ncnP=(^kBh=AjPHXKF8w?*w}!|?+g_Zu9+JcoU7bZo=%ARJ-T zI}S%39DCu|fSz07xQ;#@j(YT#!7&s4-@==*MpIoP}dD zdF$zihhr%my++!#q4cBv*CcVJ+^S`q5V9Q{LG)wj<0d&X%Vv>AKkD}_-MO*AW+`B< z?%@7+GfdiG;ycohM$T_3x5`t|b}fpzT0{PU>DAgrQ-gdFj%n0?wahJ-4E7Ok4Tu#B z(D!;ufXE-(Uv-9K7W%(|<2OFT;5ZG(1~`5pt`3e0IJ&~Ii#$KWF%=FM96wSg365br zzh!Wkd7k~~M_!wLjHVyYwCTrC{nMzf#QjX%JLFqm>elk9n?+q0bz0H)5&7ca82hfx zvJKt@^4-I8Sxw!&)E$8Ch3Kn9UpO2G&~b&nMe|&?PB&>5K5wD!A+CRbzCFbGr39$4 zoSO>oH{|(*=i>9dkb`-CHyirmsha@DS#%s95UVQCwT$OdgwE$n-LfaT-z>FC&+i9w z71@LDg>V#d|3x^;iMM&4ALmcP@eKKv!g0o!zaZ*`!*PiERd9?$&ty1i(bolzBj_!M z!}ITk2@VgB4#z&OcSx(2+lY&R<4(@S!?A)q`{9^L-cUFeP-i>yGLE__a2!U*SvU&O z^#&Zd=v)JbAG(hk9GO$!`LH+NAA(~m_b0>gG4YGx_>J=oaNI(^m*99O$7cB_{n$;t z{%{OpzKY?9Lr)|e$I;is?}v`w32D{ZJ?MWp)})Q)bK#>Vd4}uH(2qvqPBT|?ITsDb z9pov6qmsOL!SUIRIx3jDHaPa7<1!p?qiX{ktI@d=j?U;FR(7Kwtu4VH_2K)~607zB z_ru|+CH_e`x-<6O(ko6W5J? z+y{qeuD&wnsuLWZxiTAb^#XO5z;O-^&sclDS4*u2Q*O{^Db z|B_H|w0RTzmx%Ksi8tE3iS-Z8>-;Qr@<@gF@^X;MEwx)-#^2@P+b8=t^}-zv;l%%4!zZr7 z*JgKc$Wi#iD+B%2*pD-1<3N8gh3kp<-JwBsDjlD=sJl~d*x^vqwl!%!1uofzyqC7v z^=GM*iQf&Q?lgRR7CIWz&1&vuUs1a#SDQ1mMIVVzd>h?M4c~r8;)Tz6!s)299a? z_67LbPdYnfA%6ELes`LlDNhXY7tLH>fZrWM+%9~3U;J)3epi+?Y0dAtC$1<}x4aaOaR?zR~ zn5#zKKl*O5TT+>aXA4|fbPuQA#9ZCZyks+1APswyV!4q z?HgoI_HV-@b3_q-cjOQs(Sv>I7c@zgv(KkQ^jC{Tj0&`m5>OJ$!o-dpd=E-VR?o^S&7MJp1=^kB`V3B`O6zhwE?R zU#j{{Qp-~V)MxDJ>u`KNZH{=i+^wat*X!WuN1ey4)$(!nc_JKZ(Gk7fs{M+O7=j;4 zLFbl9CTYImFMfZIYJU3c&Xb03YRCQOXPdO6M}-^(#}>{HthCDShTFB*J-&qe2bWcA zzg?@BE%f6A^@GdZG7~)m;P@VWe@_h%yV3gzenX-^T|}tS@VN0g(Oi$XFGf5F?+$#) z8Tentw_A7~hs)erCC}&HO>x3T9b0;}Op3B=yWsd59ZzhtYJNwAoC(Km=v>SD$Dp@u zmTIFP?zlB0zO&mb8|lYf?k}HW(!TgXNMAUfrk^iwvdWKn|FFO@oqmhtYONMuXMNFe{I9_AkVwkHR;5fltEoC0h+!d>; z;0VUo_3h9g&u@$qjc}CU!y@jrYX_4O)XnHvfsY+fFXS6=c>Hq_er@DyHp~9sIsRz9 zczxfS-R4cK*Fyf}0dKT<6Zu-eB=f(hYyL3x72azciP9o&`rJ{;D4wD-4cd?Yc*wgJTgK!{Bh>uN)hFMe7T> za*wAUaCF6&ybQ+#IKF^m_LU$tr_yfO`(Be4w~@c^1~~Q6aLjhw4`&f~AP;ji5ID^sCe{|t_T!xbuZRIvCJ z4v+8NjK5l5e8XS0!qF)%P!)H~5YYz5$K!U4n2*0ohr<=tqPIR5DAtzxipluhY|e+{ zufBz2E*t@Hh@%za?hEu|9sh5Dzj_6KRg1qmjlT+l!wtuKxwXo-t3w{fU+utO+3{B) z_^Ti|BD*-Wm3`_|O)7KM!Kqil5k;QW_^T%Jy7KIL`=4j2V@E604*XRw=4vxKUcq0j X!(SER6URri=s!FYsD{814#$51Ufvb$ literal 0 HcmV?d00001 diff --git a/tests/test_filter.py b/tests/test_filter.py index 78954fba6a..2d80089fa0 100644 --- a/tests/test_filter.py +++ b/tests/test_filter.py @@ -1,6 +1,7 @@ import unittest import numpy as np +import time from tests.QtTestCase import QtTestCase from urh.signalprocessing.Filter import Filter @@ -81,6 +82,31 @@ def test_filter_caption(self): self.assertIn("custom", self.sig_frame.ui.btnFilter.text()) + def test_fft_convolution(self): + x = np.array([1, 2, 3]) + h = np.array([0, 1, 0.5]) + expected_result = np.array([1., 2.5, 4.]) + result_np = np.convolve(x, h, 'same') + self.assertTrue(np.array_equal(result_np, expected_result)) + + result_fft = Filter.fft_convolve_1d(x, h) + self.assertTrue(np.array_equal(result_fft, expected_result)) + + x = np.linspace(0, 1, num=10 ** 3).astype(np.complex64) + h = Filter.design_windowed_sinc_bandpass(0.1, 0.4, 0.01) + # fft convolve is faster if IR is round about 400 samples or windowed sinc has bandwidth of 0.01 + print(len(h)) + + t_np = time.time() + result_np = np.convolve(x, h, mode="same") + t_np = time.time() - t_np + + t_fft = time.time() + result_fft = Filter.fft_convolve_1d(x, h) + t_fft = time.time() - t_fft + + np.testing.assert_array_almost_equal(result_np, result_fft) + print("fft convolve time", t_fft, "np convolve time", t_np) if __name__ == '__main__': unittest.main() diff --git a/tests/test_filter_bandwidth_dialog.py b/tests/test_filter_bandwidth_dialog.py new file mode 100644 index 0000000000..14909bdaf6 --- /dev/null +++ b/tests/test_filter_bandwidth_dialog.py @@ -0,0 +1,21 @@ +from tests.QtTestCase import QtTestCase +from urh.controller.FilterBandwidthDialogController import FilterBandwidthDialogController +from urh.signalprocessing.Filter import Filter + + +class TestFilterBandwidthDialog(QtTestCase): + def setUp(self): + super().setUp() + self.dialog = FilterBandwidthDialogController() + + def test_change_custom_bw(self): + bw = 0.3 + N = Filter.get_filter_length_from_bandwidth(bw) + self.dialog.ui.doubleSpinBoxCustomBandwidth.setValue(bw) + self.assertEqual(N, self.dialog.ui.spinBoxCustomKernelLength.value()) + + N = 401 + bw = Filter.get_bandwidth_from_filter_length(N) + self.dialog.ui.spinBoxCustomKernelLength.setValue(N) + self.assertAlmostEqual(bw, self.dialog.ui.doubleSpinBoxCustomBandwidth.value(), + places=self.dialog.ui.doubleSpinBoxCustomBandwidth.decimals()) diff --git a/tests/test_send_recv_dialog_gui.py b/tests/test_send_recv_dialog_gui.py index 7fc7897fbc..8557b15d72 100644 --- a/tests/test_send_recv_dialog_gui.py +++ b/tests/test_send_recv_dialog_gui.py @@ -270,7 +270,7 @@ def test_send_dialog_delete(self): send_dialog = self.__get_send_dialog() self.assertEqual(num_samples, send_dialog.scene_manager.signal.num_samples) self.assertEqual(num_samples, len(send_dialog.device.samples_to_send)) - send_dialog.graphics_view.set_selection_area(0, 1337) + send_dialog.graphics_view.set_horizontal_selection(0, 1337) send_dialog.graphics_view.delete_action.trigger() self.assertEqual(send_dialog.scene_manager.signal.num_samples, num_samples - 1337) self.assertEqual(len(send_dialog.device.samples_to_send), num_samples - 1337) diff --git a/tests/test_spectrogram.py b/tests/test_spectrogram.py new file mode 100644 index 0000000000..d398527444 --- /dev/null +++ b/tests/test_spectrogram.py @@ -0,0 +1,66 @@ +from tests.QtTestCase import QtTestCase +from urh import colormaps +from urh.signalprocessing.Signal import Signal +from urh.signalprocessing.Spectrogram import Spectrogram + + +class TestSpectrogram(QtTestCase): + def setUp(self): + self.signal = Signal(self.get_path_for_filename("two_participants.complex"), "test") + self.spectrogram = Spectrogram(self.signal.data) + + def test_create_spectrogram_image(self): + image = self.spectrogram.create_spectrogram_image() + self.assertEqual(image.width(), self.spectrogram.time_bins - 2) + self.assertEqual(image.height(), self.spectrogram.freq_bins) + + def test_create_colormap_image(self): + image = self.spectrogram.create_colormap_image("magma", height=42) + self.assertEqual(image.height(), 42) + self.assertEqual(image.width(), len(colormaps.chosen_colormap_numpy_bgra)) + + def test_channel_separation(self): + super().setUp() + self.add_signal_to_form("two_channels.complex") + self.assertEqual(self.form.signal_tab_controller.num_frames, 1) + signal_frame = self.form.signal_tab_controller.signal_frames[0] + signal_frame.ui.spinBoxNoiseTreshold.setValue(0) + signal_frame.ui.spinBoxNoiseTreshold.editingFinished.emit() + self.assertEqual(signal_frame.signal.num_samples, 800) + signal_frame.ui.cbSignalView.setCurrentIndex(2) + self.assertTrue(signal_frame.spectrogram_is_active) + signal_frame.ui.spinBoxSelectionStart.setValue(650) + signal_frame.ui.spinBoxSelectionEnd.setValue(849) + signal_frame.ui.spinBoxSelectionEnd.setValue(850) + + self.assertEqual(signal_frame.ui.lNumSelectedSamples.text(), "200") + self.assertEqual(signal_frame.ui.lDuration.text().replace(".", ","), "195,312kHz") + menu = signal_frame.ui.gvSpectrogram.create_context_menu() + create_action = next(action for action in menu.actions() if action.text().startswith("Create")) + create_action.trigger() + + self.assertEqual(self.form.signal_tab_controller.num_frames, 2) + filtered_frame1 = self.form.signal_tab_controller.signal_frames[1] + filtered_frame1.ui.cbModulationType.setCurrentText("ASK") + filtered_frame1.ui.spinBoxInfoLen.setValue(100) + filtered_frame1.ui.spinBoxInfoLen.editingFinished.emit() + + self.assertEqual(len(filtered_frame1.proto_analyzer.plain_bits_str), 1) + self.assertEqual(filtered_frame1.proto_analyzer.plain_bits_str[0], "11001101") + + signal_frame.ui.spinBoxSelectionStart.setValue(500) + signal_frame.ui.spinBoxSelectionEnd.setValue(620) + self.assertEqual(signal_frame.ui.lNumSelectedSamples.text(), "120") + self.assertEqual(signal_frame.ui.lDuration.text().replace(".", ","), "117,188kHz") + menu = signal_frame.ui.gvSpectrogram.create_context_menu() + create_action = next(action for action in menu.actions() if action.text().startswith("Create")) + create_action.trigger() + + self.assertEqual(self.form.signal_tab_controller.num_frames, 3) + filtered_frame2 = self.form.signal_tab_controller.signal_frames[1] + filtered_frame2.ui.cbModulationType.setCurrentText("ASK") + filtered_frame2.ui.spinBoxInfoLen.setValue(100) + filtered_frame2.ui.spinBoxInfoLen.editingFinished.emit() + + self.assertEqual(len(filtered_frame2.proto_analyzer.plain_bits_str), 1) + self.assertEqual(filtered_frame2.proto_analyzer.plain_bits_str[0], "10101001") diff --git a/ui/filter_bandwidth_dialog.ui b/ui/filter_bandwidth_dialog.ui new file mode 100644 index 0000000000..7a91cee63a --- /dev/null +++ b/ui/filter_bandwidth_dialog.ui @@ -0,0 +1,268 @@ + + + DialogFilterBandwidth + + + + 0 + 0 + 497 + 382 + + + + Configure Filter Bandwidth + + + + 7 + + + + + + 0 + 0 + + + + <html><head/><body>To separate the frequency bands from each other a <b>bandpass</b> filter is used. You can configure the <b>bandwidth</b> of this filter here. The bandwidth determines the <b>length N</b> of the<b> filter kernel</b>. Decreasing the bandwidth will increase the accuracy of the filter, at cost of higher computation time.</body></html> + + + Qt::AlignJustify|Qt::AlignTop + + + true + + + + + + + + + + 0 + 0 + + + + 4 + + + 0.000100000000000 + + + 0.500000000000000 + + + + + + + 8 + + + 999999999 + + + + + + + Custom + + + + + + + TextLabel + + + + + + + Wide + + + + + + + TextLabel + + + + + + + Narrow + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + <b>Bandwidth (Hz)</b> + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + <b >Kernel Length N</b> + + + + + + + TextLabel + + + + + + + Very Wide + + + + + + + Very Narrow + + + + + + + + 0 + 0 + + + + <b>Choose </b> + + + + + + + TextLabel + + + + + + + Medium + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + + + + + + + buttonBox + accepted() + DialogFilterBandwidth + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogFilterBandwidth + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/ui/options.ui b/ui/options.ui index 79e8814554..2646fc5f7a 100644 --- a/ui/options.ui +++ b/ui/options.ui @@ -14,13 +14,14 @@ Options - + + .. - 0 + 1 @@ -70,7 +71,7 @@ View - + @@ -105,19 +106,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -129,6 +117,9 @@ + + <html><head/><body><p>If checked, you need to <span style=" font-weight:600;">hold the Shift key to drag</span> with the mouse inside graphic views like the drawn signal in Interpreation tab, while making a selection with the mouse does not require holding any buttons.</p><p>If unchecked, this is inverted: Hold shift to make a selection, and drag by default.</p></body></html> + Hold shift to drag @@ -149,43 +140,61 @@ - - - Choose application theme (requires restart): - - - - - - - - native look (default) - - + - - fallback theme - + + + Choose application theme (requires restart): + + - - fallback theme (dark) - + + + + native look (default) + + + + + fallback theme + + + + + fallback theme (dark) + + + - + - - - Qt::Vertical - - - - 20 - 383 - + + + Spectrogram Colormap - + + + + + true + + + + + 0 + 0 + 616 + 307 + + + + + + + + diff --git a/ui/signal_frame.ui b/ui/signal_frame.ui index 54d8747bef..a39d19ecac 100644 --- a/ui/signal_frame.ui +++ b/ui/signal_frame.ui @@ -70,7 +70,7 @@ QLayout::SetFixedSize - + If this is set to true, your selected protocol bits will show up in the signal view, and vice versa. @@ -83,6 +83,25 @@ + + + + + 0 + 0 + + + + -150 + + + 10 + + + Qt::Horizontal + + + @@ -99,7 +118,7 @@ - + Show the extracted protocol based on the parameters InfoLen, PauseLen and ZeroTreshold (in QuadratureDemod-View). @@ -149,6 +168,25 @@ If you want your protocol to be better seperated, edit the PauseLen using right- + + + + + Bits + + + + + Hex + + + + + ASCII + + + + @@ -255,25 +293,6 @@ If you want your protocol to be better seperated, edit the PauseLen using right- - - - - - Bits - - - - - Hex - - - - - ASCII - - - - @@ -566,6 +585,11 @@ If you want your protocol to be better seperated, edit the PauseLen using right- Demodulated + + + Spectrogram + + @@ -590,6 +614,65 @@ If you want your protocol to be better seperated, edit the PauseLen using right- + + + + FFT Window Size: + + + + + + + + 0 + 0 + + + + 6 + + + 15 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + -150 + + + 10 + + + Qt::Horizontal + + + + + + + Data<sub>min</sub>: + + + + + + + Data<sub>max</sub>: + + + @@ -634,132 +717,201 @@ stop:1 rgba(255, 255, 255, 0)); 0 - + - - + + 0 - - - - - 0 - 150 - - - - - 30 - 16777215 - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOn - - - false - - - QGraphicsView::AnchorViewCenter - - - Qt::ContainsItemShape - - - QGraphicsView::DontSavePainterState - - - - - - - true - - - - 0 - 0 - - - - - 0 - 150 - - - - - 16777215 - 16777215 - - - - true - - - Qt::WheelFocus - - - Qt::DefaultContextMenu - - - false - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOn + + 0 + + + + + 0 - - false + + 0 - - QPainter::Antialiasing|QPainter::TextAntialiasing + + 0 - - QGraphicsView::NoDrag + + 0 - - QGraphicsView::CacheNone + + 0 - - QGraphicsView::NoAnchor + + + + + 0 + 150 + + + + + 30 + 16777215 + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOn + + + false + + + QGraphicsView::AnchorViewCenter + + + Qt::ContainsItemShape + + + QGraphicsView::DontSavePainterState + + + + + + + true + + + + 0 + 0 + + + + + 0 + 150 + + + + + 16777215 + 16777215 + + + + true + + + Qt::WheelFocus + + + Qt::DefaultContextMenu + + + false + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOn + + + false + + + QPainter::Antialiasing|QPainter::TextAntialiasing + + + QGraphicsView::NoDrag + + + QGraphicsView::CacheNone + + + QGraphicsView::NoAnchor + + + QGraphicsView::NoAnchor + + + QGraphicsView::MinimalViewportUpdate + + + Qt::ContainsItemShape + + + QGraphicsView::DontClipPainter|QGraphicsView::DontSavePainterState + + + + + + + + + 0 - - QGraphicsView::NoAnchor + + 0 - - QGraphicsView::MinimalViewportUpdate + + 0 - - Qt::ContainsItemShape + + 0 - - QGraphicsView::DontClipPainter|QGraphicsView::DontSavePainterState + + 0 - - - + + + + true + + + QFrame::NoFrame + + + false + + + QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + QGraphicsView::NoAnchor + + + QGraphicsView::MinimalViewportUpdate + + + QGraphicsView::DontClipPainter|QGraphicsView::DontSavePainterState + + + + + + - + @@ -1106,6 +1258,11 @@ stop:1 rgba(255, 255, 255, 0)); QTextEdit
urh.ui.views.TextEditProtocolView.h
+ + SpectrogramGraphicView + QGraphicsView +
urh.ui.views.SpectrogramGraphicView.h
+
btnSaveSignal @@ -1120,9 +1277,6 @@ stop:1 rgba(255, 255, 255, 0)); cbProtoView chkBoxSyncSelection txtEdProto - gvLegend - gvSignal - sliderYScale btnShowHideStartEnd spinBoxSelectionStart spinBoxSelectionEnd diff --git a/ui/tab_interpretation.ui b/ui/tab_interpretation.ui index b147725b51..2e0aad3dca 100644 --- a/ui/tab_interpretation.ui +++ b/ui/tab_interpretation.ui @@ -13,7 +13,7 @@ Form - + 0 @@ -76,6 +76,55 @@ + + + + + QSplitter::handle:vertical { +margin: 4px 0px; + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, +stop:0 rgba(255, 255, 255, 0), +stop:0.5 rgba(100, 100, 100, 100), +stop:1 rgba(255, 255, 255, 0)); + image: url(:/icons/data/icons/splitter_handle_horizontal.svg); +} + + + Qt::Vertical + + + 6 + + + + + 32 + + + + + + + <html><head/><body><p>Open a file or record a new signal using the <b>File menu</b> to get started.</p></body></html> + + + Qt::AlignCenter + + + true + + + Qt::NoTextInteraction + + + + + + + + + +
@@ -89,6 +138,8 @@ 1 - + + +