Coverage for planit/main.py: 47%

30 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-11 15:42 +0000

1""" 

2planit (PLANetary Impact Toolkit) 

3====== 

4 

5Classes and functions for setting-up, accessing, manipulating,  

6and analysing SPH impact simulation data. 

7 

8Supported planetary impact codes: gadget-2-planetary, swift, pkdgrav3 

9 

10 

11Philip J. Carter (p.carter@bristol.ac.uk) 

12 

13Sarah T. Stewart (sstewa56@asu.edu) 

14 

15v1.3 

16 

17""" 

18 

19from .globaldefs import * 

20from . import eos 

21from . import utils 

22from .snaptools import Snapshot, io 

23from .impacttools import Impact 

24 

25 

26IronEOS = eos.select('ANEOSIron') # for backwards compatibility 

27AlloyEOS = eos.select('ANEOSFeSiAlloy') 

28ForsteriteEOS = eos.select('ANEOSForsterite') 

29 

30 

31def loadsnap(file, headonly = False, thermo=False, compress=False, mats=[402,400]): 

32 s = Snapshot() 

33 s.load(file, headonly=headonly, thermo=thermo, compress=compress, mats=mats) 

34 return s 

35 

36def loadimpact(loc,thermo=False,inter=1,compress=True,code='swift'): 

37 i = Impact() 

38 i.load(loc, thermo=thermo, inter=inter, compress=compress, code=code) 

39 return i 

40 

41def load_seagen(partplanet, thermo=False, init_h=100e5): 

42 s = Snapshot() 

43 io.load_seagen(s, partplanet, thermo=thermo, init_h=init_h) 

44 return s 

45 

46def combine(body1, body2, bidoffset=PROJ_ID_OFFSET, thermo=False, box=0.0): 

47 s = Snapshot() 

48 s.combine(body1, body2, bidoffset=bidoffset, thermo=thermo, box=box) 

49 return s 

50 

51def bound_mass(snapshot, nrem = 1, minbnd = 200, maxiter = 2000, tol = 0.01, reorder=True, discardsmall=False, calc_pot_all=True, save=True): 

52 snapshot.bound_mass(nrem = nrem, minbnd = minbnd, maxiter = maxiter, tol = tol, reorder=reorder, discardsmall=discardsmall, calc_pot_all=calc_pot_all, save=save) 

53 return snapshot.rem 

54 

55def calc_phase(snapshot, release=False, plot=False): 

56 snapshot.calc_phase(release=release, plot=plot) 

57 return snapshot.phase