This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassContainer: | |
def __init__(self): | |
# The guessed data structure of the OP's class, as code was not provided. (Needed for reproduction) | |
self.meta = {"A": []} | |
# This would be required in the class for proposed solution. | |
# It is however not needed if set_data is only used once in an instantiated classes lifetime. | |
self.type_counter = dict() # or {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test: | |
def __init__(self, arg=None): | |
self.test_arg = arg or "Default arg" | |
test1 = Test() | |
test2 = Test("Not Default arg") | |
print(test1.test_arg) | |
# Default arg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [r,v] = coe2rv(a, e, inc, raan, argp, theta, mu) | |
cos_raan = cos(raan); | |
sin_raan = sin(raan); | |
cos_argp = cos(argp); | |
sin_argp = sin(argp); | |
cos_inc = cos(inc); | |
sin_inc = sin(inc); | |
r = a * (1 - e ^ 2) / (1.0 + e * cos(theta)); | |
l1 = (+cos_raan * cos_argp - sin_raan * sin_argp * cos_inc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# IMPORT STATEMENTS ########################################################### | |
############################################################################### | |
import numpy as np | |
from tudatpy import constants | |
from tudatpy import elements | |
from tudatpy import io | |
from tudatpy import ephemerides | |
from tudatpy import interpolators | |
from tudatpy import numerical_integrators |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dbcachepy import DatabaseCache | |
if __name__ == "__main__": | |
test_db = DatabaseCache.from_json("test/test.json") | |
print(test_db["index_resource/spk/asteroids/codes_300ast_20100725.bsp"]) | |
print(test_db["index_resource/spk/planets/de430.bsp"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Downloading codes_300ast_20100725.bsp to ./index_resource/spk/asteroids | |
61864960 | |
[ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 100%] 60415/60415 | |
Finished | |
./index_resource/spk/asteroids/codes_300ast_20100725.bsp | |
Downloading de430.bsp to ./index_resource/spk/planets | |
119741440 | |
[ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 100%] 116935/116935 | |
Finished | |
./index_resource/spk/planets/de430.bsp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------------------------------------------- | |
// Both are the same functions, with two different designs. | |
// -------------------------------------------------------- | |
//! Compute gravitational acceleration. | |
/** | |
* | |
* @param GM gravitational parameter of body exerting acceleration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add predictions to samples | |
with fo.ProgressBar() as pb: | |
for sample in pb(dataset.view()): | |
# Load image | |
image = cv2.imread(sample.filepath) | |
h, w, c = image.shape | |
# Perform inference | |
results = model_best(image, size=3050, augment=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: replace event_type, token, repo and optional_json. | |
curl -H "Authorization: token {{ token }}" \ | |
-H 'Accept: application/vnd.github.everest-preview+json' \ | |
"https://api.github.com/repos/{{ owner }}/{{ repo }}/dispatches" \ | |
-d '{"event_type": "{{ event_type }}", "client_payload": {{ optional_json | {} }}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Function to scrape all tables from a URL to pandas DataFrame objects. The | |
default URL is the Wikipedia page for Orbital Launch Systems. | |
""" | |
import pandas as pd | |
import requests | |
from bs4 import BeautifulSoup as bs |