import unittest from disgrid import data from disgrid.loaders import PLUTO43 import astropy.units as u import astropy.constants as const import numpy as np import os from run import get_repo_abspath code_sample_path = os.path.join(get_repo_abspath(), "samples/PLUTO43/out") class TestPLUTO43Loader(unittest.TestCase): def setUp(self): self.d = data.Data(code_sample_path) def test_identify_code_via_data(self): self.assertEqual(self.d.loader.code_info, ("PLUTO", "4.3", "vanilla")) def test_identify_code_directly(self): self.assertTrue(PLUTO43.identify(code_sample_path)) def test_units(self): self.assertTrue( close(1. * self.d.loader.units['length'], 5.2 * 1.49597871e13 * u.cm)) self.assertTrue(close(1. * self.d.loader.units['mass'], 2e33 * u.g)) self.assertTrue( close( 1. * self.d.loader.units['time'], 2 * np.pi * np.sqrt((5.2 * 1.49597871e13)**3 * u.cm**3 /
import unittest from disgrid import data from disgrid.loaders import fargo3d import astropy.units as u import astropy.constants as const import numpy as np import os from run import get_repo_abspath code_sample_path = os.path.join(get_repo_abspath(), "samples/fargo3d") class TestFargo3DLoader(unittest.TestCase): def setUp(self): self.d = data.Data(code_sample_path) def test_identify_code_via_data(self): self.assertEqual(self.d.loader.code_info, ("fargo3d", "2.0", "public")) def test_identify_code_directly(self): self.assertTrue(fargo3d.identify(code_sample_path)) def test_units(self): self.assertEqual(self.d.loader.units['length'], 5.2 * 1.49597871e13 * u.cm) self.assertEqual(self.d.loader.units['mass'], 1.9891e+33 * u.g) self.assertEqual( self.d.loader.units['time'], np.sqrt((5.2 * 1.49597871e13)**3 * u.cm**3 / (const.G.cgs * 1.9891e+33 * u.g)).to(u.s))
import unittest from simdata import data from simdata.loaders import fargo3dmultifluid import astropy.units as u import astropy.constants as const import numpy as np import os from run import get_repo_abspath code_sample_path = os.path.join(get_repo_abspath(), "samples/fargo3dmultifluid") class TestFargo3DMultifluidLoader(unittest.TestCase): def setUp(self): self.d = data.Data(code_sample_path) def test_identify_code_via_data(self): self.assertEqual(self.d.loader.code_info, ("fargo3d", "2.0", "multifluid")) def test_identify_code_directly(self): self.assertTrue(fargo3dmultifluid.identify(code_sample_path)) def test_units(self): self.assertEqual(self.d.loader.units['length'], 5.2 * 1.49597871e13 * u.cm) self.assertEqual(self.d.loader.units['mass'], 1.9891e+33 * u.g) self.assertEqual( self.d.loader.units['time'], np.sqrt((5.2 * 1.49597871e13)**3 * u.cm**3 /