Пример #1
0
 def get_asteroid_list_gen(self) -> Iterable[List[AsteroidData]]:
     """
     Getter is neccessary for instantiating below generator. Generators
     cannot be reused.
     """
     start = None
     if self._is_continue:
         start = _get_last_computed_asteroid(self._catalog, self._integration.aei_path) + 1
     return asteroid_list_gen(STEP, self._catalog, start=start)
Пример #2
0
def calc(start: int, stop: int, from_day: float, to_day: float, aei_path: str,
         catalog: str):
    from resonances.commands import calc as _calc
    from resonances.catalog import asteroid_list_gen
    asteroids = asteroid_list_gen(STEP,
                                  catalog_path=catalog,
                                  start=start,
                                  stop=stop)
    _calc(asteroids, from_day, to_day, aei_path)
Пример #3
0
def load_resonances(start: int, stop: int, file: str, axis_swing: float,
                    planets: Tuple[str], gen: bool, catalog: str):
    assert axis_swing > 0.

    from resonances.shortcuts import FAIL, ENDC
    if gen and file and os.path.isdir(file):
        print("%s--gen and --file conflict, point only one of them%s" %
              (FAIL, ENDC))
        exit(-1)

    from resonances.catalog import PossibleResonanceBuilder
    from resonances.commands import load_resonances as _load_resonances
    from resonances.catalog import asteroid_list_gen
    _asteroid_list_gen = asteroid_list_gen(STEP,
                                           start=start,
                                           stop=stop,
                                           catalog_path=catalog)
    builder = PossibleResonanceBuilder(planets, axis_swing)
    if file == RESONANCE_FILEPATH:
        logging.info('%s will be used as source of integers' % file)
    for asteroid_buffer in _asteroid_list_gen:
        _load_resonances(file, asteroid_buffer, builder, gen)
Пример #4
0
def find(start: int, stop: int, from_day: float, to_day: float,
         reload_resonances: bool, recalc: bool, is_current: bool,
         phase_storage: str, aei_paths: Tuple[str, ...], recursive: bool,
         clear: bool, clear_s3: bool, planets: Tuple[str], verbose: bool):
    from resonances.commands import load_resonances as _load_resonances
    from resonances.datamining import PhaseStorage
    from resonances.commands import calc as _calc
    from resonances.commands import LibrationFinder
    from resonances.catalog import asteroid_list_gen

    finder = LibrationFinder(planets, recursive, clear, clear_s3, is_current,
                             PhaseStorage(PHASE_STORAGE.index(phase_storage)),
                             verbose)
    if start == stop == -1 and aei_paths:
        finder.find_by_file(aei_paths)

    if recalc:
        asteroids = asteroid_list_gen(STEP, start=start, stop=stop)
        _calc(asteroids, from_day, to_day)
    for i in range(start, stop, STEP):
        end = i + STEP if i + STEP < stop else stop
        if reload_resonances:
            _load_resonances(RESONANCE_FILEPATH, i, end, planets)
        finder.find(i, end, aei_paths)
Пример #5
0
 def get_asteroid_list_gen(self) -> Iterable[List[AsteroidData]]:
     """
     Getter is neccessary for instantiating below generator. Generators
     cannot be reused.
     """
     return asteroid_list_gen(STEP, self._catalog)