Stoops-ML / transforms84

Python library for geographic system transformations
0 stars 1 forks source link

Parallelised functions produce incorrect and inconsistent results #39

Closed Stoops-ML closed 7 hours ago

Stoops-ML commented 4 days ago

Version 0.3.1

Inputs:

import numpy as np
from transforms84.transforms import geodetic2ECEF
from transforms84.systems import WGS84
from transforms84.helpers import DDM2RRM

rrm_base = np.array([[0.5703736], [0.61523903], [100.0]])
rrm_LLA_points = DDM2RRM(
    np.array(
        [
            [[33.37820455], [35.29796643], [20.0]],
            [[33.37115216], [35.29866411], [337.27933498]],
            [[33.36409976], [35.29936178], [654.23919657]],
            [[33.35704737], [35.30005946], [970.56043304]],
            [[33.34999497], [35.30075713], [1285.92453574]],
            [[33.34294258], [35.30145481], [1600.01395973]],
            [[33.33589018], [35.30215248], [1912.5124436]],
            [[33.32883779], [35.30285016], [2223.10532787]],
            [[33.3217854], [35.30354783], [2531.47987181]],
            [[33.314733], [35.3042455], [2837.32556841]],
            [[33.30768061], [35.30494318], [3140.33445698]],
            [[33.30062821], [35.30564085], [3440.20143326]],
            [[33.29357582], [35.30633853], [3736.6245566]],
            [[33.28652342], [35.3070362], [4029.30535407]],
            [[33.27947103], [35.30773388], [4317.94912089]],
            [[33.27241863], [35.30843155], [4602.26521727]],
            [[33.26536624], [35.30912923], [4881.967361]],
            [[33.25831385], [35.3098269], [5156.77391573]],
            [[33.25126145], [35.31052457], [5426.40817456]],
            [[33.24420906], [35.31122225], [5690.59863863]],
            [[33.23715666], [35.31191992], [5949.07929055]],
            [[33.23010427], [35.3126176], [6201.58986221]],
            [[33.22305187], [35.31331527], [6447.87609687]],
            [[33.21599948], [35.31401295], [6687.69000516]],
            [[33.20894708], [35.31471062], [6920.79011482]],
            [[33.20189469], [35.31540829], [7146.94171379]],
            [[33.1948423], [35.31610597], [7365.91708658]],
            [[33.1877899], [35.31680364], [7577.49574354]],
            [[33.18073751], [35.31750132], [7781.46464292]],
            [[33.17368511], [35.31819899], [7977.61840531]],
            [[33.16663272], [35.31889667], [8165.7595205]],
            [[33.15958032], [35.31959434], [8345.69854635]],
            [[33.15252793], [35.32029202], [8517.2542995]],
            [[33.14547553], [35.32098969], [8680.25403784]],
            [[33.13842314], [35.32168736], [8834.53363448]],
            [[33.13137075], [35.32238504], [8979.93774291]],
            [[33.12431835], [35.32308271], [9116.31995355]],
            [[33.11726596], [35.32378039], [9243.54294105]],
            [[33.11021356], [35.32447806], [9361.47860265]],
            [[33.10316117], [35.32517574], [9470.00818715]],
            [[33.09610877], [35.32587341], [9569.02241444]],
            [[33.08905638], [35.32657109], [9658.4215856]],
            [[33.08200398], [35.32726876], [9738.11568324]],
            [[33.07495159], [35.32796643], [9808.02446215]],
            [[33.0678992], [35.32866411], [9868.07753012]],
            [[33.0608468], [35.32936178], [9918.21441881]],
            [[33.05379441], [35.33005946], [9958.38464461]],
            [[33.04674201], [35.33075713], [9988.54775952]],
            [[33.03968962], [35.33145481], [10008.67339183]],
            [[33.03263722], [35.33215248], [10018.74127674]],
            [[33.02558483], [35.33285016], [10018.74127674]],
            [[33.01853243], [35.33354783], [10008.67339183]],
            [[33.01148004], [35.3342455], [9988.54775952]],
            [[33.00442765], [35.33494318], [9958.38464461]],
            [[32.99737525], [35.33564085], [9918.21441881]],
            [[32.99032286], [35.33633853], [9868.07753012]],
            [[32.98327046], [35.3370362], [9808.02446215]],
            [[32.97621807], [35.33773388], [9738.11568324]],
            [[32.96916567], [35.33843155], [9658.4215856]],
            [[32.96211328], [35.33912923], [9569.02241444]],
            [[32.95506089], [35.3398269], [9470.00818715]],
            [[32.94800849], [35.34052457], [9361.47860265]],
            [[32.9409561], [35.34122225], [9243.54294105]],
            [[32.9339037], [35.34191992], [9116.31995355]],
            [[32.92685131], [35.3426176], [8979.93774291]],
            [[32.91979891], [35.34331527], [8834.53363448]],
            [[32.91274652], [35.34401295], [8680.25403784]],
            [[32.90569412], [35.34471062], [8517.2542995]],
            [[32.89864173], [35.3454083], [8345.69854635]],
            [[32.89158934], [35.34610597], [8165.7595205]],
            [[32.88453694], [35.34680364], [7977.61840531]],
            [[32.87748455], [35.34750132], [7781.46464292]],
            [[32.87043215], [35.34819899], [7577.49574354]],
            [[32.86337976], [35.34889667], [7365.91708658]],
            [[32.85632736], [35.34959434], [7146.94171379]],
            [[32.84927497], [35.35029202], [6920.79011482]],
            [[32.84222257], [35.35098969], [6687.69000516]],
            [[32.83517018], [35.35168736], [6447.87609687]],
            [[32.82811779], [35.35238504], [6201.58986221]],
            [[32.82106539], [35.35308271], [5949.07929055]],
            [[32.814013], [35.35378039], [5690.59863863]],
            [[32.8069606], [35.35447806], [5426.40817456]],
            [[32.79990821], [35.35517574], [5156.77391573]],
            [[32.79285581], [35.35587341], [4881.967361]],
            [[32.78580342], [35.35657109], [4602.26521727]],
            [[32.77875102], [35.35726876], [4317.94912089]],
            [[32.77169863], [35.35796643], [4029.30535407]],
            [[32.76464624], [35.35866411], [3736.6245566]],
            [[32.75759384], [35.35936178], [3440.20143326]],
            [[32.75054145], [35.36005946], [3140.33445698]],
            [[32.74348905], [35.36075713], [2837.32556841]],
            [[32.73643666], [35.36145481], [2531.47987181]],
            [[32.72938426], [35.36215248], [2223.10532787]],
            [[32.72233187], [35.36285016], [1912.5124436]],
            [[32.71527947], [35.36354783], [1600.01395973]],
            [[32.70822708], [35.3642455], [1285.92453574]],
            [[32.70117469], [35.36494318], [970.56043304]],
            [[32.69412229], [35.36564085], [654.23919657]],
            [[32.6870699], [35.36633853], [337.27933498]],
            [[32.6800175], [35.3670362], [20.0]],
        ]
    )
)

Running the following function multiple times produces different results:

geodetic2ECEF(
    rrm_LLA_points,
    WGS84.a,
    WGS84.b,
)

This occurs for other parallelised functions, and will update once I have done more research into this.

Stoops-ML commented 7 hours ago

Fixed by https://github.com/Stoops-ML/transforms84/pull/42