Skip to content

Commit

Permalink
Getting rid of b.get_value('distance@system')!
Browse files Browse the repository at this point in the history
A single call is 31 ms, i.e., 3.1 s per 100 times. :-(
  • Loading branch information
miroslavbroz committed Oct 9, 2024
1 parent f92c8e9 commit 85adc29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions phoebe/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,6 @@ def _compute_intrinsic_system_at_t0(self, b, compute,
system.update_positions(t0, x0, y0, z0, vx0, vy0, vz0, etheta0, elongan0, eincl0, ignore_effects=True)
system.populate_observables(t0, ['lc' for dataset in datasets], datasets, ignore_effects=True)


if reset:
logger.debug("rank:{}/{} PhoebeBackend._create_system_and_compute_pblums: resetting system".format(mpi.myrank, mpi.nprocs))
system.reset(force_recompute_instantaneous=True)
Expand All @@ -1023,6 +1022,10 @@ def _worker_setup(self, b, compute, times, infolists, **kwargs):
# b.compute_ld_coeffs(set_value=True) # TODO: only need if irradiation is enabled and only for bolometric

system = kwargs.get('system', universe.System.from_bundle(b, compute, datasets=b.datasets, **kwargs))

# NOTE: for interferometry; 1 call 1.4 ms
system.distance = b.get_value(qualifier='distance', context='system', **_skip_filter_checks)

# pblums_scale computed within run_compute and then passed as kwarg to run (so should be in kwargs sent to each worker)
pblums_scale = kwargs.get('pblums_scale')
for dataset in list(pblums_scale.keys()):
Expand Down Expand Up @@ -1074,6 +1077,7 @@ def _worker_setup(self, b, compute, times, infolists, **kwargs):
vxs=vxs, vys=vys, vzs=vzs,
ethetas=ethetas, elongans=elongans, eincls=eincls)

# @profile
def _run_single_time(self, b, i, time, infolist, **kwargs):
logger.debug("rank:{}/{} PhoebeBackend._run_single_time(i={}, time={}, infolist={}, **kwargs.keys={})".format(mpi.myrank, mpi.nprocs, i, time, infolist, kwargs.keys()))

Expand Down Expand Up @@ -1164,7 +1168,6 @@ def _run_single_time(self, b, i, time, infolist, **kwargs):
system.xi = xi
system.yi = yi
system.zi = zi
system.distance = b.get_value('distance@system')

logger.debug("rank:{}/{} PhoebeBackend._run_single_time: filling packets at time={}".format(mpi.myrank, mpi.nprocs, time))
# now let's loop through and prepare a packet which will fill the synthetics
Expand Down

0 comments on commit 85adc29

Please sign in to comment.