Skip to content

Commit

Permalink
Backward compatible fix for trapz
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkitBarik committed Jul 25, 2024
1 parent e0c8472 commit 5587f18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions python/magic/compSims.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
from magic import *
from scipy.integrate import trapz
from matplotlib.ticker import ScalarFormatter
import matplotlib.pyplot as plt
import numpy as np
import os

try:
from scipy.integrate import trapz
except:
from scipy.integrate import trapezoid as trapz

class CompSims:
"""
Expand Down
7 changes: 5 additions & 2 deletions python/magic/surf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import matplotlib.pyplot as plt
import os
import numpy as np
from scipy.integrate import trapz
try:
from scipy.integrate import trapz
except:
from scipy.integrate import trapezoid as trapz


class Surf:
Expand Down Expand Up @@ -869,7 +872,7 @@ def avg(self, field='vphi', levels=defaultLevels, cm=None,

vs = self.gr.vr * np.sin(th3D) + self.gr.vtheta * np.cos(th3D)
vz = self.gr.vr * np.cos(th3D) - self.gr.vtheta * np.sin(th3D)
vortz = 1./s3D*(-phideravg(vs, self.gr.minc) +
vortz = 1./s3D*(-phideravg(vs, self.gr.minc) +
sderavg(s3D*self.gr.vphi, self.gr.radius))

data = vortz * vz
Expand Down
4 changes: 2 additions & 2 deletions python/magic/thHeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import numpy as np
from magic import scanDir, MagicSetup, Movie, chebgrid, rderavg, AvgField
import os, pickle
from scipy.integrate import trapz
try:
from scipy.integrate import simps
from scipy.integrate import simps, trapz
except:
from scipy.integrate import simpson as simps
from scipy.integrate import trapezoid as trapz

json_model = {'phys_params': [],
'time_series': { 'heat': ['topnuss', 'botnuss']},
Expand Down

0 comments on commit 5587f18

Please sign in to comment.