hexsha
string | size
int64 | ext
string | lang
string | max_stars_repo_path
string | max_stars_repo_name
string | max_stars_repo_head_hexsha
string | max_stars_repo_licenses
list | max_stars_count
int64 | max_stars_repo_stars_event_min_datetime
string | max_stars_repo_stars_event_max_datetime
string | max_issues_repo_path
string | max_issues_repo_name
string | max_issues_repo_head_hexsha
string | max_issues_repo_licenses
list | max_issues_count
int64 | max_issues_repo_issues_event_min_datetime
string | max_issues_repo_issues_event_max_datetime
string | max_forks_repo_path
string | max_forks_repo_name
string | max_forks_repo_head_hexsha
string | max_forks_repo_licenses
list | max_forks_count
int64 | max_forks_repo_forks_event_min_datetime
string | max_forks_repo_forks_event_max_datetime
string | content
string | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | qsc_code_num_words_quality_signal
int64 | qsc_code_num_chars_quality_signal
float64 | qsc_code_mean_word_length_quality_signal
float64 | qsc_code_frac_words_unique_quality_signal
float64 | qsc_code_frac_chars_top_2grams_quality_signal
float64 | qsc_code_frac_chars_top_3grams_quality_signal
float64 | qsc_code_frac_chars_top_4grams_quality_signal
float64 | qsc_code_frac_chars_dupe_5grams_quality_signal
float64 | qsc_code_frac_chars_dupe_6grams_quality_signal
float64 | qsc_code_frac_chars_dupe_7grams_quality_signal
float64 | qsc_code_frac_chars_dupe_8grams_quality_signal
float64 | qsc_code_frac_chars_dupe_9grams_quality_signal
float64 | qsc_code_frac_chars_dupe_10grams_quality_signal
float64 | qsc_code_frac_chars_replacement_symbols_quality_signal
float64 | qsc_code_frac_chars_digital_quality_signal
float64 | qsc_code_frac_chars_whitespace_quality_signal
float64 | qsc_code_size_file_byte_quality_signal
float64 | qsc_code_num_lines_quality_signal
float64 | qsc_code_num_chars_line_max_quality_signal
float64 | qsc_code_num_chars_line_mean_quality_signal
float64 | qsc_code_frac_chars_alphabet_quality_signal
float64 | qsc_code_frac_chars_comments_quality_signal
float64 | qsc_code_cate_xml_start_quality_signal
float64 | qsc_code_frac_lines_dupe_lines_quality_signal
float64 | qsc_code_cate_autogen_quality_signal
float64 | qsc_code_frac_lines_long_string_quality_signal
float64 | qsc_code_frac_chars_string_length_quality_signal
float64 | qsc_code_frac_chars_long_word_length_quality_signal
float64 | qsc_code_frac_lines_string_concat_quality_signal
float64 | qsc_code_cate_encoded_data_quality_signal
float64 | qsc_code_frac_chars_hex_words_quality_signal
float64 | qsc_code_frac_lines_prompt_comments_quality_signal
float64 | qsc_code_frac_lines_assert_quality_signal
float64 | qsc_codepython_cate_ast_quality_signal
float64 | qsc_codepython_frac_lines_func_ratio_quality_signal
float64 | qsc_codepython_cate_var_zero_quality_signal
bool | qsc_codepython_frac_lines_pass_quality_signal
float64 | qsc_codepython_frac_lines_import_quality_signal
float64 | qsc_codepython_frac_lines_simplefunc_quality_signal
float64 | qsc_codepython_score_lines_no_logic_quality_signal
float64 | qsc_codepython_frac_lines_print_quality_signal
float64 | qsc_code_num_words
int64 | qsc_code_num_chars
int64 | qsc_code_mean_word_length
int64 | qsc_code_frac_words_unique
null | qsc_code_frac_chars_top_2grams
int64 | qsc_code_frac_chars_top_3grams
int64 | qsc_code_frac_chars_top_4grams
int64 | qsc_code_frac_chars_dupe_5grams
int64 | qsc_code_frac_chars_dupe_6grams
int64 | qsc_code_frac_chars_dupe_7grams
int64 | qsc_code_frac_chars_dupe_8grams
int64 | qsc_code_frac_chars_dupe_9grams
int64 | qsc_code_frac_chars_dupe_10grams
int64 | qsc_code_frac_chars_replacement_symbols
int64 | qsc_code_frac_chars_digital
int64 | qsc_code_frac_chars_whitespace
int64 | qsc_code_size_file_byte
int64 | qsc_code_num_lines
int64 | qsc_code_num_chars_line_max
int64 | qsc_code_num_chars_line_mean
int64 | qsc_code_frac_chars_alphabet
int64 | qsc_code_frac_chars_comments
int64 | qsc_code_cate_xml_start
int64 | qsc_code_frac_lines_dupe_lines
int64 | qsc_code_cate_autogen
int64 | qsc_code_frac_lines_long_string
int64 | qsc_code_frac_chars_string_length
int64 | qsc_code_frac_chars_long_word_length
int64 | qsc_code_frac_lines_string_concat
null | qsc_code_cate_encoded_data
int64 | qsc_code_frac_chars_hex_words
int64 | qsc_code_frac_lines_prompt_comments
int64 | qsc_code_frac_lines_assert
int64 | qsc_codepython_cate_ast
int64 | qsc_codepython_frac_lines_func_ratio
int64 | qsc_codepython_cate_var_zero
int64 | qsc_codepython_frac_lines_pass
int64 | qsc_codepython_frac_lines_import
int64 | qsc_codepython_frac_lines_simplefunc
int64 | qsc_codepython_score_lines_no_logic
int64 | qsc_codepython_frac_lines_print
int64 | effective
string | hits
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cb86014120f9b3abdecf38c0897bbbd5da882129
| 383
|
py
|
Python
|
juno/resources/routes/plan_routes.py
|
leogregianin/juno-python
|
0be2b70516b0dde713ff36cdb40888f06cc538f5
|
[
"MIT"
] | 2
|
2022-03-25T21:08:46.000Z
|
2022-03-31T21:10:17.000Z
|
juno/resources/routes/plan_routes.py
|
leogregianin/juno-python
|
0be2b70516b0dde713ff36cdb40888f06cc538f5
|
[
"MIT"
] | null | null | null |
juno/resources/routes/plan_routes.py
|
leogregianin/juno-python
|
0be2b70516b0dde713ff36cdb40888f06cc538f5
|
[
"MIT"
] | null | null | null |
from ..handler_request import get_resource_url
def get_base_url():
return f"{get_resource_url()}/plans"
def get_specific_plan_by_id_url(plan_id):
return f"{get_base_url()}/{plan_id}"
def get_deactivation_plan_url(plan_id):
return f"{get_base_url()}/{plan_id}/deactivation"
def get_activation_plan_url(plan_id):
return f"{get_base_url()}/{plan_id}/activation"
| 21.277778
| 53
| 0.754569
| 63
| 383
| 4.111111
| 0.285714
| 0.162162
| 0.208494
| 0.173745
| 0.401544
| 0.401544
| 0.401544
| 0.401544
| 0.401544
| 0.401544
| 0
| 0
| 0.114883
| 383
| 17
| 54
| 22.529412
| 0.764012
| 0
| 0
| 0
| 0
| 0
| 0.334204
| 0.334204
| 0
| 0
| 0
| 0
| 0
| 1
| 0.444444
| false
| 0
| 0.111111
| 0.444444
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
cb90629755d4c988bda979b48be2eb1b91fe0a05
| 1,148
|
py
|
Python
|
kron/blueprints.py
|
seangilleran/kron
|
62a5dc3ad77c1505108885b99f882a81ae4b6d87
|
[
"MIT"
] | null | null | null |
kron/blueprints.py
|
seangilleran/kron
|
62a5dc3ad77c1505108885b99f882a81ae4b6d87
|
[
"MIT"
] | null | null | null |
kron/blueprints.py
|
seangilleran/kron
|
62a5dc3ad77c1505108885b99f882a81ae4b6d87
|
[
"MIT"
] | null | null | null |
from flask import Blueprint, render_template
from kron.models import Archive, Box, Document, Person, Topic
kron = Blueprint("kron", __name__)
@kron.route("/archives/")
def get_archives():
archives = Archive.query.all()
return render_template(
"archives.htm", archives=archives,
list=True
)
@kron.route("/archives/<int:id>/")
@kron.route("/archives/<int:id>/<param>")
def get_archive(id, param=None):
archive = Archive.query.get_or_404(id)
return render_template(
"archives.htm", archives=[archive],
edit=archive.id if param == "edit" else None
)
@kron.route("/boxes/")
def get_boxes():
return "todo"
@kron.route("/boxes/<int:id>")
def get_box(id):
return "todo"
@kron.route("/documents/")
def get_documents():
return "todo"
@kron.route("/document/<int:id>")
def get_document(id):
return "todo"
@kron.route("/people/")
def get_people():
return "todo"
@kron.route("/people/<int:id>")
def get_person(id):
return "todo"
@kron.route("/topics/")
def get_topics():
return "todo"
@kron.route("/topics/<int:id>")
def get_topic(id):
return "todo"
| 17.393939
| 61
| 0.647213
| 153
| 1,148
| 4.732026
| 0.248366
| 0.13674
| 0.135359
| 0.183702
| 0.34116
| 0.107735
| 0
| 0
| 0
| 0
| 0
| 0.003165
| 0.174216
| 1,148
| 65
| 62
| 17.661538
| 0.760549
| 0
| 0
| 0.238095
| 0
| 0
| 0.189895
| 0.022648
| 0
| 0
| 0
| 0
| 0
| 1
| 0.238095
| false
| 0
| 0.047619
| 0.190476
| 0.52381
| 0.047619
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
cba3c9104251ca804b048fd17e0f927faaf5f5ce
| 35
|
py
|
Python
|
config.py
|
HTTP101/sturdy-octo-barnacle
|
843df5bf3f65ab0617a2794b28ecaffef271d2ec
|
[
"MIT"
] | null | null | null |
config.py
|
HTTP101/sturdy-octo-barnacle
|
843df5bf3f65ab0617a2794b28ecaffef271d2ec
|
[
"MIT"
] | null | null | null |
config.py
|
HTTP101/sturdy-octo-barnacle
|
843df5bf3f65ab0617a2794b28ecaffef271d2ec
|
[
"MIT"
] | null | null | null |
import os
conf = os.getenv("conf")
| 11.666667
| 24
| 0.685714
| 6
| 35
| 4
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 35
| 2
| 25
| 17.5
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.114286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
cbb845236c4139ac0f61ebb1821ad1379647cb63
| 588
|
py
|
Python
|
regdata/__init__.py
|
patel-zeel/regdata
|
4b823368750a1afd24b1b8d63e3b2ba58d983c79
|
[
"MIT"
] | null | null | null |
regdata/__init__.py
|
patel-zeel/regdata
|
4b823368750a1afd24b1b8d63e3b2ba58d983c79
|
[
"MIT"
] | 3
|
2021-09-22T08:31:49.000Z
|
2021-10-13T14:23:14.000Z
|
regdata/__init__.py
|
patel-zeel/regdata
|
4b823368750a1afd24b1b8d63e3b2ba58d983c79
|
[
"MIT"
] | null | null | null |
# Dataloaders
from .dataloaders.della_gatta_gene import DellaGattaGene
from .dataloaders.heinonen_4 import Heinonen4
from .dataloaders.jump1d import Jump1D
from .dataloaders.mcycle import MotorcycleHelmet
from .dataloaders.nonstat2d import NonStat2D
from .dataloaders.olympic import Olympic
from .dataloaders.sinejump import SineJump1D
from .dataloaders.noisy_sine import SineNoisy
from .dataloaders.smooth1d import Smooth1D
from .dataloaders.step import Step
from .config import set_backend
import os
os.environ['BACKEND'] = 'numpy'
os.environ['DATAPATH'] = '/tmp/somerandomtexthere_'
| 32.666667
| 56
| 0.836735
| 71
| 588
| 6.84507
| 0.43662
| 0.308642
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016917
| 0.095238
| 588
| 17
| 57
| 34.588235
| 0.896617
| 0.018707
| 0
| 0
| 0
| 0
| 0.076655
| 0.041812
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.857143
| 0
| 0.857143
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
cbd3cc741538dc87b3d683068bf345f9ccb1ccff
| 44
|
py
|
Python
|
TemplateInstall/PortalDeploy/arcrest/security/__init__.py
|
conklinbd/MovementAnalysis
|
6bd3efa6f82dd794775b742bddccfc10af847d43
|
[
"Apache-2.0"
] | null | null | null |
TemplateInstall/PortalDeploy/arcrest/security/__init__.py
|
conklinbd/MovementAnalysis
|
6bd3efa6f82dd794775b742bddccfc10af847d43
|
[
"Apache-2.0"
] | null | null | null |
TemplateInstall/PortalDeploy/arcrest/security/__init__.py
|
conklinbd/MovementAnalysis
|
6bd3efa6f82dd794775b742bddccfc10af847d43
|
[
"Apache-2.0"
] | null | null | null |
from security import *
__version__ = "3.0.0"
| 22
| 22
| 0.727273
| 7
| 44
| 4
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078947
| 0.136364
| 44
| 2
| 23
| 22
| 0.657895
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1daeb00d58b9adca8eb0d63d19f41d8fd1e22016
| 101
|
py
|
Python
|
pyday_night_funkin/core/stb_vorbis/__init__.py
|
Square789/PydayNightFunkin
|
8d43daec947202566419a2d5ce63cc191b7b8e3c
|
[
"Apache-2.0"
] | null | null | null |
pyday_night_funkin/core/stb_vorbis/__init__.py
|
Square789/PydayNightFunkin
|
8d43daec947202566419a2d5ce63cc191b7b8e3c
|
[
"Apache-2.0"
] | 34
|
2021-09-10T01:08:14.000Z
|
2022-03-25T18:10:08.000Z
|
pyday_night_funkin/core/stb_vorbis/__init__.py
|
Square789/PydayNightFunkin
|
8d43daec947202566419a2d5ce63cc191b7b8e3c
|
[
"Apache-2.0"
] | null | null | null |
from .stb_vorbis import STBVorbisException, STBVorbis
__all__ = ("STBVorbisException", "STBVorbis")
| 25.25
| 53
| 0.80198
| 9
| 101
| 8.444444
| 0.777778
| 0.710526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09901
| 101
| 3
| 54
| 33.666667
| 0.835165
| 0
| 0
| 0
| 0
| 0
| 0.267327
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1dc2bc9a05e53481f2287115c8ec7d81891b1071
| 394
|
py
|
Python
|
mlfinlab/sampling/__init__.py
|
SaintForest/mlfinlab
|
76107491d77c50539e216da1cf2ad8f02b90ed58
|
[
"MIT"
] | 5
|
2020-05-04T15:26:08.000Z
|
2021-07-18T00:07:05.000Z
|
mlfinlab/sampling/__init__.py
|
FranklinMa810/mlfinlab
|
f560ffd42529bb0bb62c3b820f997edf0a2016ca
|
[
"BSD-3-Clause"
] | 1
|
2022-03-23T01:20:59.000Z
|
2022-03-23T01:20:59.000Z
|
mlfinlab/sampling/__init__.py
|
FranklinMa810/mlfinlab
|
f560ffd42529bb0bb62c3b820f997edf0a2016ca
|
[
"BSD-3-Clause"
] | 2
|
2020-01-20T04:22:05.000Z
|
2020-04-05T14:42:32.000Z
|
"""
Contains the logic regarding the sequential bootstrapping from chapter 4, as well as the concurrent labels.
"""
from mlfinlab.sampling.bootstrapping import get_ind_matrix, get_ind_mat_average_uniqueness, seq_bootstrap
from mlfinlab.sampling.concurrent import (num_concurrent_events, _get_average_uniqueness,
get_av_uniqueness_from_triple_barrier)
| 49.25
| 107
| 0.769036
| 48
| 394
| 5.958333
| 0.604167
| 0.083916
| 0.13986
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003115
| 0.185279
| 394
| 7
| 108
| 56.285714
| 0.88785
| 0.271574
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1dd593792810c47fffc5bb4c610d79cf613eaa80
| 65
|
py
|
Python
|
pj24.py
|
Ziggareto/project_euler_solns
|
e52066b9ffec97005bad0f26a3f0e08760d5c5cb
|
[
"MIT"
] | null | null | null |
pj24.py
|
Ziggareto/project_euler_solns
|
e52066b9ffec97005bad0f26a3f0e08760d5c5cb
|
[
"MIT"
] | null | null | null |
pj24.py
|
Ziggareto/project_euler_solns
|
e52066b9ffec97005bad0f26a3f0e08760d5c5cb
|
[
"MIT"
] | null | null | null |
#pj24
foo = '0123456789'
def thingamy(foo):
foo.sort()
| 10.833333
| 19
| 0.584615
| 8
| 65
| 4.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 0.261538
| 65
| 5
| 20
| 13
| 0.541667
| 0.061538
| 0
| 0
| 0
| 0
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1dfba8194b0cc8a0578bfc3ae9dc5098f7ada48c
| 281
|
py
|
Python
|
tests/items/conftest.py
|
r2rstep/django-templated
|
afedb3f6ecda13780d282584c80fb0d1608dbcb3
|
[
"MIT"
] | null | null | null |
tests/items/conftest.py
|
r2rstep/django-templated
|
afedb3f6ecda13780d282584c80fb0d1608dbcb3
|
[
"MIT"
] | null | null | null |
tests/items/conftest.py
|
r2rstep/django-templated
|
afedb3f6ecda13780d282584c80fb0d1608dbcb3
|
[
"MIT"
] | null | null | null |
import pytest
from django_templated.items.models import Item
from tests.items.factories import ItemFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def item() -> Item:
return ItemFactory()
| 18.733333
| 46
| 0.779359
| 36
| 281
| 6
| 0.611111
| 0.12037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131673
| 281
| 14
| 47
| 20.071429
| 0.885246
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.333333
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
38032571d802fc754df3ef4ae1a49afe382e9b44
| 452
|
py
|
Python
|
memsql_loader/api/exceptions.py
|
yonglehou/memsql-loader
|
5e7bb5787991aa990889c4e709f63a3529544268
|
[
"MIT"
] | 1
|
2021-05-10T03:37:26.000Z
|
2021-05-10T03:37:26.000Z
|
memsql_loader/api/exceptions.py
|
yonglehou/memsql-loader
|
5e7bb5787991aa990889c4e709f63a3529544268
|
[
"MIT"
] | null | null | null |
memsql_loader/api/exceptions.py
|
yonglehou/memsql-loader
|
5e7bb5787991aa990889c4e709f63a3529544268
|
[
"MIT"
] | null | null | null |
class ApiException(Exception):
pass
class DBConnectionIssue(ApiException):
def __str__(self):
return "Database Error: %s" % self.message
class DBError(ApiException):
def __init__(self, *args):
# args can have 1 or 2 parameters
try:
self.errno = args[0]
self.message = args[1]
except IndexError:
self.message = args[0]
def __str__(self):
return self.message
| 23.789474
| 50
| 0.603982
| 51
| 452
| 5.117647
| 0.529412
| 0.168582
| 0.076628
| 0.122605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.303097
| 452
| 18
| 51
| 25.111111
| 0.812698
| 0.068584
| 0
| 0.142857
| 0
| 0
| 0.042959
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.214286
| false
| 0.071429
| 0
| 0.142857
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
380ead21394229d6ce61c3b227196d3b652a5e5c
| 299,534
|
py
|
Python
|
gmtl-0.6.1/python/test/testsuite.py
|
Glitch0011/QuadTree-Example
|
3558c999f68475bc98b8fa33b0f6d14076c9ec48
|
[
"MIT"
] | null | null | null |
gmtl-0.6.1/python/test/testsuite.py
|
Glitch0011/QuadTree-Example
|
3558c999f68475bc98b8fa33b0f6d14076c9ec48
|
[
"MIT"
] | null | null | null |
gmtl-0.6.1/python/test/testsuite.py
|
Glitch0011/QuadTree-Example
|
3558c999f68475bc98b8fa33b0f6d14076c9ec48
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# GMTL is (C) Copyright 2001-2010 by Allen Bierbaum
# Distributed under the GNU Lesser General Public License 2.1 with an
# addendum covering inlined code. (See accompanying files LICENSE and
# LICENSE.addendum or http://www.gnu.org/copyleft/lesser.txt)
import gmtl
import math
import random
import sys
import types
import unittest
class AABoxContainTest(unittest.TestCase):
def testIsInVolumePt(self):
# Test empty box.
box = gmtl.AABoxf()
origin = gmtl.Point3f()
assert not gmtl.isInVolume(box, origin)
# Test valid box with point outside.
box2 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
pt1 = gmtl.Point3f(2.0, 2.0, 2.0)
assert not gmtl.isInVolume(box2, pt1)
assert not gmtl.isInVolumeExclusive(box2, pt1)
# Test valid box with point inside.
assert gmtl.isInVolume(box2, origin)
assert gmtl.isInVolumeExclusive(box2, origin)
# Test valid box with point on surface.
pt_on_surf = gmtl.Point3f(1.0, 0.0, 0.0)
assert gmtl.isInVolume(box2, pt_on_surf)
def testIsInVolumeAABox(self):
# Test valid box against empty box.
empty = gmtl.AABoxf()
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
assert not gmtl.isInVolume(empty, box)
assert not gmtl.isInVolume(box, empty)
# Test non-overlapping valid boxes.
box2 = gmtl.AABoxf(gmtl.Point3f(30.0, 30.0, 30.0),
gmtl.Point3f(40.0, 40.0, 40.0))
assert not gmtl.isInVolume(box, box2)
assert not gmtl.isInVolume(box2, box)
# Test overlapping valid boxes.
box3 = gmtl.AABoxf(gmtl.Point3f(35.0, 35.0, 35.0),
gmtl.Point3f(37.0, 37.0, 37.0))
assert gmtl.isInVolume(box2, box3)
assert gmtl.isInVolume(box3, box2)
# Test valid box against itself
assert gmtl.isInVolume(box, box)
def testExtendVolumePt(self):
# Test empty box and point.
empty = gmtl.AABoxf()
origin = gmtl.Point3f()
result = gmtl.AABoxf(empty)
gmtl.extendVolume(result, origin)
assert not result.isEmpty()
assert result.getMin() == origin
assert result.getMax() == origin
# Valid box against point inside.
box2 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
result = gmtl.AABoxf(box2)
gmtl.extendVolume(result, origin)
assert not result.isEmpty()
assert result.getMin() == box2.getMin()
assert result.getMax() == box2.getMax()
# Valid box with point outside.
pt = gmtl.Point3f(30.0, 30.0, -30.0)
expMin = gmtl.Point3f(-1.0, -1.0, -30.0)
expMax = gmtl.Point3f(30.0, 30.0, 1.0)
result = gmtl.AABoxf(box2)
gmtl.extendVolume(result, pt)
assert not result.isEmpty()
assert result.getMin() == expMin
assert result.getMax() == expMax
def testExtendVolumeAABox(self):
empty = gmtl.AABoxf()
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
# Both boxes empty.
result = gmtl.AABoxf(empty)
gmtl.extendVolume(result, empty)
assert result.isEmpty()
# Empty box with valid box.
result = gmtl.AABoxf(empty)
gmtl.extendVolume(result, box)
assert not result.isEmpty()
assert result.getMin() == box.getMin()
assert result.getMax() == box.getMax()
# Overlapping valid boxes.
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 2.0, 2.0))
expMin = gmtl.Point3f(-1.0, -1.0, -1.0)
expMax = gmtl.Point3f(2.0, 2.0, 2.0)
result = gmtl.AABoxf(box)
gmtl.extendVolume(result, box2)
assert not result.isEmpty()
assert result.getMin() == expMin
assert result.getMax() == expMax
# Non-overlapping valid boxes.
box2 = gmtl.AABoxf(gmtl.Point3f(2.0, 2.0, 2.0),
gmtl.Point3f(4.0, 4.0, 4.0))
expMin = gmtl.Point3f(-1.0, -1.0, -1.0)
expMax = gmtl.Point3f(4.0, 4.0, 4.0)
result = gmtl.AABoxf(box)
gmtl.extendVolume(result, box2)
assert not result.isEmpty()
assert result.getMin() == expMin
assert result.getMax() == expMax
def testMakeVolumeSphere(self):
sph = gmtl.Spheref(gmtl.Point3f(1.0, 1.0, 1.0), 2.0)
box = gmtl.AABoxf()
expected_min = gmtl.Point3f(-1.0, -1.0, -1.0)
expected_max = gmtl.Point3f(3.0, 3.0, 3.0)
gmtl.makeVolume(box, sph)
assert box.getMin() == expected_min
assert box.getMax() == expected_max
assert not box.isEmpty()
class AABoxContainMetricTest(unittest.TestCase):
def testTimingIsInVolumePt(self):
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
origin = gmtl.Point3f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
gmtl.isInVolume(box, origin)
use_value = use_value + box.min[0] + 2.0
assert use_value > 0.0
def testTimingIsInVolumeAABox(self):
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(-0.5, -0.5, -0.5))
iters = 400000
use_value = 0.0
for iter in xrange(iters):
gmtl.isInVolume(box, box2)
use_value = use_value + box.min[0] + 2.0
assert use_value > 0.0
def testTimingExtendVolumePt(self):
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
origin = gmtl.Point3f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
gmtl.extendVolume(box, origin)
use_value = use_value + box.min[0] + 2.0
assert use_value > 0.0
def testTimingExtendVolumeAABox(self):
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 2.0, 2.0))
iters = 400000
use_value = 0.0
for iter in xrange(iters):
gmtl.extendVolume(box, box2)
use_value = use_value + box.min[0] + 2.0
assert use_value > 0.0
class AABoxOpsTest(unittest.TestCase):
def testEqualityCompare(self):
# Empty box against self.
empty = gmtl.AABoxf()
assert empty == empty
assert not empty != empty
# Empty boxes with different min.
box1 = gmtl.AABoxf()
box2 = gmtl.AABoxf()
box1.setMin(gmtl.Point3f(-1.0, 0.0, 0.0))
assert box1 != box2
assert not box1 == box2
# Empty boxes with different max
box1 = gmtl.AABoxf(box2)
box1.setMax(gmtl.Point3f(1.0, 0.0, 0.0))
assert box1 != box2
assert not box1 == box2
# Non-empty box against self.
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
assert box == box
assert not box != box
# Non-empty boxes with different min.
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 1.0, 1.0))
assert box1 != box2
assert not box1 == box2
# Non-empty boxes with different max.
box1 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 2.0, 2.0))
assert box1 != box2
assert not box1 == box2
def testIsEqual(self):
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -2.0, -3.0),
gmtl.Point3f(4.0, 5.0, 6.0))
bok = gmtl.AABoxf(gmtl.Point3f(-1.0, -2.0, -3.0),
gmtl.Point3f(4.0, 5.0, 6.0))
mok = gmtl.AABoxf(gmtl.Point3f(-1.0, -2.0, -3.0),
gmtl.Point3f(4.0, 5.0, 7.0))
assert gmtl.isEqual(bok, box, 0.0001)
assert bok == box
assert bok != mok
assert not gmtl.isEqual(bok, mok, 0.0001)
assert gmtl.isEqual(bok, mok, 1.0001)
class AABoxOpsMetricTest(unittest.TestCase):
def testTimingEqualityCompare(self):
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(2.0, 2.0, 2.0))
iters = 400000
true_count = 0
for iter in xrange(iters):
if box1 == box2:
true_count += 1
assert true_count == 0
true_count = 0
for iter in xrange(iters):
if box1 != box2:
true_count += 1
assert true_count > 0
def testTimingIsEqual(self):
pass
class AABoxTest(unittest.TestCase):
def testCreation(self):
box = gmtl.AABoxf()
zeroPoint = gmtl.Point3f()
assert box.min == zeroPoint
assert box.max == zeroPoint
assert box.empty
def testCopyConstructor(self):
box = gmtl.AABoxf()
box.min.set(-2.0, -4.0, -8.0)
box.max.set(2.0, 4.0, 8.0)
box.empty = False
box_copy = gmtl.AABoxf(box)
assert box_copy.min == gmtl.Point3f(-2.0, -4.0, -8.0)
assert box_copy.max == gmtl.Point3f( 2.0, 4.0, 8.0)
assert box_copy.empty == False
def testConstructors(self):
box = gmtl.AABoxf(gmtl.Point3f(1.0, 2.0, 3.0),
gmtl.Point3f(4.0, 5.0, 6.0))
assert box.min == gmtl.Point3f(1.0, 2.0, 3.0)
assert box.max == gmtl.Point3f(4.0, 5.0, 6.0)
assert box.empty == False
def testGetMin(self):
amin = gmtl.Point3f(-1.0, -2.0, -3.0)
box = gmtl.AABoxf(amin, gmtl.Point3f())
assert box.getMin() == amin
def testGetMax(self):
amax = gmtl.Point3f(1.0, 2.0, 3.0)
box = gmtl.AABoxf(gmtl.Point3f(), amax)
assert box.getMax() == amax
def testIsEmpty(self):
box = gmtl.AABoxf()
box2 = gmtl.AABoxf(gmtl.Point3f(-1.0, -2.0, -3.0),
gmtl.Point3f(1.0, 2.0, 3.0))
assert box.isEmpty() == True
assert box2.isEmpty() == False
def testSetMin(self):
box = gmtl.AABoxf()
amin = gmtl.Point3f(-2.0, -4.0, -1.0)
box.setMin(amin)
assert box.getMin() == amin
def testSetMax(self):
box = gmtl.AABoxf()
amax = gmtl.Point3f(2.0, 4.0, 1.0)
box.setMax(amax)
assert box.getMax() == amax
def testSetEmpty(self):
box = gmtl.AABoxf()
box.setEmpty(False)
assert box.isEmpty() == False
class AABoxMetricTest(unittest.TestCase):
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
box = gmtl.AABoxf()
use_value = use_value + box.min[0] + 1.0
assert use_value > 0.0
def testTimingCopyConstruct(self):
iters = 400000
box2 = gmtl.AABoxf()
box2.min[0] = 2.0
use_value = 0.0
for iter in xrange(iters):
box2_copy = gmtl.AABoxf(box2)
use_value += box2_copy.min[0]
assert use_value > 0.0
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
box2 = gmtl.AABoxf(gmtl.Point3f(1.0, 2.0, 3.0),
gmtl.Point3f(4.0, 5.0, 6.0))
use_value += box2.min[0]
assert use_value > 0.0
def testTimingGetMin(self):
amin = gmtl.Point3f(-1.0, -2.0, -3.0)
box = gmtl.AABoxf(amin, gmtl.Point3f())
iters = 400000
use_value = 0.0
for iter in xrange(iters):
amin = box.getMin()
use_value = use_value - amin[0]
assert use_value > 0.0
def testTimingGetMax(self):
amax = gmtl.Point3f(1.0, 2.0, 3.0)
box = gmtl.AABoxf(gmtl.Point3f(), amax)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
amax = box.getMax()
use_value = use_value + amax[0]
assert use_value > 0.0
def testTimingIsEmpty(self):
box = gmtl.AABoxf()
iters = 400000
use_value = 0
for iter in xrange(iters):
if box.isEmpty():
use_value += 1
use_value > 0
def testTimingSetMin(self):
box = gmtl.AABoxf()
amin = gmtl.Point3f()
iters = 400000
for iter in xrange(iters):
amin.set(float(iter), float(iter), float(iter))
box.setMin(amin)
def testTimingSetMax(self):
box = gmtl.AABoxf()
amax = gmtl.Point3f()
iters = 400000
for iter in xrange(iters):
amax.set(float(iter), float(iter), float(iter))
box.setMax(amax)
def setTimingSetEmpty(self):
box = gmtl.AABoxf()
iters = 400000
use_value = 0
for iter in xrange(iters):
box.setEmpty(True)
if box.empty:
use_value += 1
assert use_value > 0
class AxisAngleClassTest(unittest.TestCase):
def testAxisAngleClassTestCreation(self):
# Test that it initializes to the identity.
q = gmtl.AxisAnglef()
assert q[0] == 0.0
assert q[1] == 1.0
assert q[2] == 0.0
assert q[3] == 0.0
# Try out set...
q.set(1.0, 2.0, 3.0, 902)
assert q[0] == 1.0
assert q[1] == 2.0
assert q[2] == 3.0
assert q[3] == 902
# Try out setting with brackets
q[0] = 5.0
q[1] = 6.0
q[2] = 7.0
q[3] = 901
assert q[0] == 5.0
assert q[1] == 6.0
assert q[2] == 7.0
assert q[3] == 901
# Try out element constructor.
q2 = gmtl.AxisAnglef(10.0, 11.0, 12.0, 902)
assert q2[0] == 10.0
assert q2[1] == 11.0
assert q2[2] == 12.0
assert q2[3] == 902
# Try out copy constructor.
q3 = gmtl.AxisAnglef(q)
assert q3[0] == 5.0
assert q3[1] == 6.0
assert q3[2] == 7.0
assert q3[3] == 901
class AxisAngleClassMetricTest(unittest.TestCase):
def testAxisAngleTimingDefaultConstructor(self):
iters = 400000
use_value = 1.0
for iter in xrange(iters):
q = gmtl.AxisAnglef()
use_value += q.data[0]
assert use_value != 0.0
def testAxisAngleTimingElementConstructor(self):
iters = 400000
use_value = 1.0
for iter in xrange(iters):
q2 = gmtl.AxisAnglef(10.0, 11.0, 12.0, 901)
use_value += q2.data[0]
assert use_value != 0.0
def testAxisAngleTimingCopyConstructor(self):
iters = 400000
use_value = 1.0
q = gmtl.AxisAnglef(67.0, 68.0, 69.0, 901)
for iter in xrange(iters):
q3 = gmtl.AxisAnglef(q)
use_value += q3.data[0]
assert use_value != 0.0
def testAxisAngleTimingSet(self):
iters = 400000
use_value = 0.0
q = gmtl.AxisAnglef()
for iter in xrange(iters):
q.set(1.0, 2.0, 3.0, 901)
use_value += q[0]
assert use_value >= 0.0
def testAxisAngleTimingOpBracket(self):
iters = 400000
use_value = 0.0
q = gmtl.AxisAnglef()
x = 102.0
y = 103.0
z = 101.0
w = 901
for iter in xrange(iters):
q[0] = x
q[1] = y
q[2] = z
q[3] = w
use_value = use_value + x + y + z + w
assert use_value > 0.0
def testAxisAngleTimingGetData(self):
iters = 400000
use_value = 0.0
q = gmtl.AxisAnglef(1.0, 2.0, 3.0, 901)
for iter in xrange(iters):
d = q.getData()
use_value += d[1]
assert use_value > 0.0
class AxisAngleCompareTest(unittest.TestCase):
def __testAxisAngleEqualityTest(self, type):
quat1 = type()
quat1.set(1.0, 2.0, 34.0, 980.0)
quat2 = type(quat1)
assert quat1 == quat2
assert quat2 == quat1
for j in range(4):
quat2[j] = 1221.0
assert quat1 != quat2
assert not quat1 == quat2
quat2[j] = quat1[j] # put it back
# Test for epsilon equals working.
assert gmtl.isEqual(quat1, quat2)
assert gmtl.isEqual(quat1, quat2, 0.0)
assert gmtl.isEqual(quat2, quat1, 0.0)
assert gmtl.isEqual(quat2, quat1, 100000.0)
eps = 10.0
for j in range(4):
quat2[j] = quat1[j] - (eps / 2.0)
assert gmtl.isEqual(quat1, quat2, eps)
assert not gmtl.isEqual(quat1, quat2, eps / 3.0)
quat2[j] = quat1[j] # put it back
def testAxisAngleEqualityFloatTest(self):
for i in range(15):
self.__testAxisAngleEqualityTest(gmtl.AxisAnglef)
def testAxisAngleEqualityDoubleTest(self):
for i in range(15):
self.__testAxisAngleEqualityTest(gmtl.AxisAngled)
class AxisAngleCompareMetricTest(unittest.TestCase):
def testAxisAngleTimingOpEqualityTest(self):
# Test overhead of creation
iters = 400000
src_quat11 = gmtl.AxisAnglef()
src_quat22 = gmtl.AxisAnglef()
src_quat33 = gmtl.AxisAnglef()
src_quat34 = gmtl.AxisAnglef()
src_quat44 = gmtl.AxisAnglef()
src_quat101 = gmtl.AxisAngled()
# half of them will be equal.
src_quat11[3] = 1.0
src_quat22[2] = 1.0
src_quat11[1] = 2.0
test_quat11 = gmtl.AxisAnglef(src_quat11)
test_quat22 = gmtl.AxisAnglef(src_quat22)
test_quat33 = gmtl.AxisAnglef(src_quat33)
test_quat34 = gmtl.AxisAnglef(src_quat34)
test_quat44 = gmtl.AxisAnglef(src_quat44)
test_quat101 = gmtl.AxisAngled(src_quat101)
# have of them will be not equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 1.0
true_count = 0
for iter in xrange(iters):
if src_quat11 == test_quat11:
true_count += 1
if src_quat22 == test_quat22:
true_count += 1
if src_quat33 == test_quat33:
true_count += 1
if src_quat34 == test_quat34:
true_count += 1
if src_quat44 == test_quat44:
true_count += 1
if src_quat101 == test_quat101:
true_count += 1
assert true_count > 0
def testAxisAngleTimingOpNotEqualityTest(self):
# Test overhead of creation
iters = 400000
src_quat11 = gmtl.AxisAnglef()
src_quat22 = gmtl.AxisAnglef()
src_quat33 = gmtl.AxisAnglef()
src_quat34 = gmtl.AxisAnglef()
src_quat44 = gmtl.AxisAnglef()
src_quat101 = gmtl.AxisAngled()
# half of them will be equal.
src_quat11[3] = 1.0
src_quat22[2] = 1.0
src_quat11[1] = 2.0
test_quat11 = gmtl.AxisAnglef(src_quat11)
test_quat22 = gmtl.AxisAnglef(src_quat22)
test_quat33 = gmtl.AxisAnglef(src_quat33)
test_quat34 = gmtl.AxisAnglef(src_quat34)
test_quat44 = gmtl.AxisAnglef(src_quat44)
test_quat101 = gmtl.AxisAngled(src_quat101)
# have of them will be not equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 1.0
true_count = 0
for iter in xrange(iters):
if src_quat11 != test_quat11:
true_count += 1
if src_quat22 != test_quat22:
true_count += 1
if src_quat33 != test_quat33:
true_count += 1
if src_quat34 != test_quat34:
true_count += 1
if src_quat44 != test_quat44:
true_count += 1
if src_quat101 != test_quat101:
true_count += 1
assert true_count > 0
def testAxisAngleTimingIsEqualTest(self):
# Test overhead of creation
iters = 400000
src_quat11 = gmtl.AxisAnglef()
src_quat22 = gmtl.AxisAnglef()
src_quat33 = gmtl.AxisAnglef()
src_quat34 = gmtl.AxisAnglef()
src_quat44 = gmtl.AxisAnglef()
src_quat101 = gmtl.AxisAngled()
# half of them will be equal.
src_quat11[3] = 1.0
src_quat22[2] = 1.0
src_quat11[1] = 2.0
test_quat11 = gmtl.AxisAnglef(src_quat11)
test_quat22 = gmtl.AxisAnglef(src_quat22)
test_quat33 = gmtl.AxisAnglef(src_quat33)
test_quat34 = gmtl.AxisAnglef(src_quat34)
test_quat44 = gmtl.AxisAnglef(src_quat44)
test_quat101 = gmtl.AxisAngled(src_quat101)
# have of them will be not equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 1.0
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(src_quat11, test_quat11, 0.0):
true_count += 1
if gmtl.isEqual(src_quat22, test_quat22, 0.2):
true_count += 1
if gmtl.isEqual(src_quat33, test_quat33, 0.3):
true_count += 1
if gmtl.isEqual(src_quat34, test_quat34, 0.6):
true_count += 1
if gmtl.isEqual(src_quat44, test_quat44, 0.8):
true_count += 1
if gmtl.isEqual(src_quat101, test_quat101, 111.1):
true_count += 1
assert true_count > 0
class ConvertTest(unittest.TestCase):
def testConvertVecToPureQuat(self):
eps = 0.0001
vec = gmtl.Vec3f(1.0, 2.0, 3.0)
quat = gmtl.Quatf(4.0, 5.0, 6.0, 1.0)
expected = gmtl.Quatf(1.0, 2.0, 3.0, 0.0)
bok = gmtl.setPure(quat, vec)
assert gmtl.isEqual(expected, quat, eps)
assert gmtl.isEqual(expected, bok, eps)
def testConvertQuatMat_MatQuat(self):
eps = 0.0001
mat1 = gmtl.Matrix44f()
# Identity, quat0 -> mat1 -> quat1 -> mat2
quat0 = gmtl.Quatf()
gmtl.set(mat1, quat0)
quat1 = gmtl.Quatf()
gmtl.set(quat1, mat1)
assert gmtl.isEqual(quat0, quat1, eps)
# Make sure we gt the same matrix as we started.
mat2 = gmtl.Matrix44f()
gmtl.set(mat2, quat1) # mat2 = quat1
assert gmtl.isEqual(mat2, mat1, eps)
# Identity, mat1 -> quat0 -> mat2 -> quat1
mat1 = gmtl.Matrix44f()
gmtl.set(quat0, mat1) # quat0 = mat1
gmtl.set(mat2, quat0) # mat2 = quat0
assert gmtl.isEqual(mat1, mat2, eps)
# Make sure that we get the same quat as we started.
gmtl.set(quat1, mat2) # quat1 = mat2
assert gmtl.isEqual(quat0, quat1, eps)
# Simple rotation around x-axis.
mat1 = gmtl.Matrix44f()
gmtl.set(mat1, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
1.0, 0.0, 0.0)))
gmtl.set(quat0, mat1) # quat0 = mat1
gmtl.set(mat2, quat0) # mat2 = quat0
assert gmtl.isEqual(mat1, mat2, eps)
# Make sure we get the same quaternion as we started.
gmtl.set(quat1, mat2) # quat1 = mat2
assert gmtl.isEqual(quat0, quat1, eps)
# More complex rotation mat1 -> quat0 -> mat2 -> quat1
mat1 = gmtl.Matrix44f()
gmtl.set(mat1, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(123.4),
1.0, 1.0, -1.0)))
gmtl.set(quat0, mat1) # quat0 = mat1
gmtl.set(mat2, quat0) # mat2 = quat0
assert gmtl.isEqual(mat1, mat2, eps)
# Make sure we get the same quaternion as we started.
gmtl.set(quat1, mat2) # quat1 = mat2
assert gmtl.isEqual(quat0, quat1, eps)
# More complex rotation quat0 -> mat1 -> quat1 -> mat2
mat1 = gmtl.Matrix44f()
gmtl.set(mat1, gmtl.EulerAngleXYZf(45.0, -89.0, 32.45))
gmtl.set(quat0, mat1) # quat0 = mat1
gmtl.set(mat2, quat0) # mat2 = quat0
assert gmtl.isEqual(mat1, mat2, eps)
# Make sure we get the same quaternion as we started.
gmtl.set(quat1, mat2) # quat1 = mat2
assert gmtl.isEqual(quat0, quat1, eps)
# Really test it out. mat1 -> quat0 -> mat2 -> quat1
x = -math.pi
while x < math.pi:
y = -math.pi
while y < math.pi:
z = -math.pi
while z < math.pi:
# More complex rotation.
mat1 = gmtl.Matrix44f()
gmtl.set(mat1, gmtl.EulerAngleXYZf(x, y, z))
gmtl.set(quat0, mat1) # quat0 = mat1
gmtl.set(mat2, quat0) # mat2 = quat0
assert gmtl.isEqual(mat1, mat2, eps)
# Make sure we get the same quaternion that we started.
gmtl.set(quat1, mat2) # quat1 = mat2
assert gmtl.isEquiv(quat0, quat1, eps)
z += 0.2
y+= 0.2
x += 0.2
# Really test it out. quat0 -> mat1 -> quat1 -> mat2
x = -math.pi
while x < math.pi:
y = -math.pi
while y < math.pi:
z = -math.pi
while z < math.pi:
# More complex rotation.
quat0 = gmtl.Quatf()
gmtl.set(quat0, gmtl.EulerAngleXYZf(x, y, z))
gmtl.set(mat1, quat0) # mat1 = quat0
gmtl.set(quat1, mat1) # quat1 = mat1
assert gmtl.isEquiv(quat0, quat1, eps)
# Make sure we get the same matrix that we started.
gmtl.set(mat2, quat1) # mat2 = quat1
assert gmtl.isEqual(mat1, mat2, eps)
z += 0.2
y+= 0.2
x += 0.2
# Make a 4x4 matrix by hand with a postive 3x3 diagonal
mat44a = gmtl.Matrix44f()
mat44a.set( 0.0, 1.0, 0.0, 0.0,
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0)
mat44b = gmtl.Matrix44f()
gmtl.set(quat0, mat44a) # quat0 = mat44a
gmtl.set(mat44b, quat0) # mat44b = quat0
assert gmtl.isEqual(mat44a, mat44b, eps)
# Make sure we get the same quaternion that we started.
gmtl.set(quat1, mat44b) # quat1 = mat44b
assert gmtl.isEqual(quat0, quat1, eps)
# Make a 4x4 matrix by hand with a negative 3x3 diagonal
mat44a.set( 0.0, -1.0, 0.0, 0.0,
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, -1.0, 0.0,
0.0, 0.0, 0.0, 1.0)
gmtl.set(quat0, mat44a) # quat0 = mat44a
gmtl.set(mat44b, quat0) # mat44b = quat0
assert gmtl.isEqual(mat44a, mat44b, eps)
# Make sure we get the same quaternion that we started.
gmtl.set(quat1, mat44b) # quat1 = mat44b
assert gmtl.isEqual(quat0, quat1, eps)
# Make a 3x3 matrix by hand with a positive diagonal
mat33a = gmtl.Matrix33f()
mat33a.set( 0.0, 1.0, 0.0,
-1.0, 0.0, 0.0,
0.0, 0.0, 1.0)
mat33b = gmtl.Matrix33f()
gmtl.set(quat0, mat33a) # quat0 = mat33a
gmtl.set(mat33b, quat0) # mat33b = quat0
assert gmtl.isEqual(mat33a, mat33b, eps)
# Make sure we get the same quaternion that we started.
gmtl.set(quat1, mat33b) # quat1 = mat33b
assert gmtl.isEqual(quat0, quat1, eps)
class CoordClassTest(unittest.TestCase):
def testCoordClassTestCreation(self):
# Test that it initializes to the multiplication identity.
q = gmtl.Coord3fXYZ()
assert q.pos[0] == 0.0
assert q.pos[1] == 0.0
assert q.pos[2] == 0.0
assert q.rot[0] == 0.0
assert q.rot[1] == 0.0
assert q.rot[2] == 0.0
# Try out element constructor.
p = gmtl.Vec3f(1.0, 2.0, 3.0)
r = gmtl.EulerAngleXYZf(4.0, 5.0, 6.0)
q2 = gmtl.Coord3fXYZ(p, r)
assert q2.pos[0] == 1.0
assert q2.pos[1] == 2.0
assert q2.pos[2] == 3.0
assert q2.rot[0] == 4.0
assert q2.rot[1] == 5.0
assert q2.rot[2] == 6.0
# Try out copy constructor.
q3 = gmtl.Coord3fXYZ(q2)
assert q3.pos[0] == 1.0
assert q3.pos[1] == 2.0
assert q3.pos[2] == 3.0
assert q3.rot[0] == 4.0
assert q3.rot[1] == 5.0
assert q3.rot[2] == 6.0
# Instantiate one copy of all types that we are supposed to support.
CoordVec3dXYZ_test = gmtl.Coord3dXYZ()
CoordVec3fXYZ_test = gmtl.Coord3fXYZ()
CoordVec4dXYZ_test = gmtl.Coord4dXYZ()
CoordVec4fXYZ_test = gmtl.Coord4fXYZ()
CoordVec3dZYX_test = gmtl.Coord3dZYX()
CoordVec3fZYX_test = gmtl.Coord3fZYX()
CoordVec4dZYX_test = gmtl.Coord4dZYX()
CoordVec4fZYX_test = gmtl.Coord4fZYX()
CoordVec3dZXY_test = gmtl.Coord3dZXY()
CoordVec3fZXY_test = gmtl.Coord3fZXY()
CoordVec4dZXY_test = gmtl.Coord4dZXY()
CoordVec4fZXY_test = gmtl.Coord4fZXY()
CoordVec3AxisAngled_test = gmtl.Coord3dAxisAngle()
CoordVec3AxisAnglef_test = gmtl.Coord3fAxisAngle()
CoordVec4AxisAngled_test = gmtl.Coord4dAxisAngle()
CoordVec4AxisAnglef_test = gmtl.Coord4fAxisAngle()
Coord3fQuat_test = gmtl.Coord3fQuat()
Coord3dQuat_test = gmtl.Coord3dQuat()
Coord4fQuat_test = gmtl.Coord4fQuat()
Coord4dQuat_test = gmtl.Coord4dQuat()
# def testMultiArgConstructors(self):
# coord = gmtl.Coord3fXYZ(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
# assert coord.pos[0] == 1.0
# assert coord.pos[1] == 2.0
# assert coord.pos[2] == 3.0
# assert coord.rot[0] == 4.0
# assert coord.rot[1] == 5.0
# assert coord.rot[2] == 6.0
#
# coord = gmtl.Coord4fXYZ(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0)
# assert coord.pos[0] == 1.0
# assert coord.pos[1] == 2.0
# assert coord.pos[2] == 3.0
# assert coord.pos[3] == 4.0
# assert coord.rot[0] == 5.0
# assert coord.rot[1] == 6.0
# assert coord.rot[2] == 7.0
#
# coord = gmtl.Coord4fAxisAngle(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0)
# assert coord.pos[0] == 1.0
# assert coord.pos[1] == 2.0
# assert coord.pos[2] == 3.0
# assert coord.pos[3] == 4.0
# assert coord.rot[0] == 5.0
# assert coord.rot[1] == 6.0
# assert coord.rot[2] == 7.0
# assert coord.rot[3] == 8.0
class CoordClassMetricTest(unittest.TestCase):
def testCoordTimingDefaultConstructor(self):
iters = 400000
use_value = 1.0
for iter in xrange(iters):
q = gmtl.Coord3fXYZ()
use_value += q.pos[0]
assert use_value != 0.0
def testCoordTimingElementConstructor(self):
iters = 400000
use_value = 1.0
p = gmtl.Vec3f(1.0, 2.0, 3.0)
r = gmtl.EulerAngleXYZf(4.0, 5.0, 6.0)
for iter in xrange(iters):
q = gmtl.Coord3fXYZ(p, r)
use_value += q.pos[0]
assert use_value != 0.0
def testCoordTimingCopyConstructor(self):
iters = 400000
use_value = 1.0
q = gmtl.Coord3fXYZ()
for iter in xrange(iters):
q3 = gmtl.Coord3fXYZ(q)
use_value += q3.pos[0]
assert use_value != 0.0
def testCoordTimingGet(self):
iters = 400000
use_value = 0.0
q = gmtl.Coord3fXYZ()
for iter in xrange(iters):
use_value += use_value + q.pos[0]
use_value += use_value + q.rot[0]
q.rot[0] -= use_value
q.pos[0] -= use_value
assert use_value != 8324908723.0
class CoordCompareTest(unittest.TestCase):
def __testCoordEquality(self, coordType, vecType, eulerAngleType, dataType):
p = vecType(1.0, 2.0, 3.0)
r = eulerAngleType(4.0, 5.0, 6.0)
coord1 = coordType()
coord2 = coordType(coord1)
assert coord1 == coord2
assert coord2 == coord1
for j in range(3):
coord2.pos[j] = dataType(1221.0)
assert coord1 != coord2
assert not coord1 == coord2
coord2.pos[j] = coord1.pos[j] # put it back
coord2.rot[j] = dataType(1221.0)
assert coord1 != coord2
assert not coord1 == coord2
coord2.rot[j] = coord1.rot[j] # put it back
assert gmtl.isEqual(coord1, coord2)
assert gmtl.isEqual(coord1, coord2, dataType(0.0))
assert gmtl.isEqual(coord2, coord1, dataType(0.0))
assert gmtl.isEqual(coord2, coord1, dataType(100000.0))
eps = dataType(10.0)
for j in range(3):
coord2.pos[j] = coord1.pos[j] - (eps / dataType(2.0))
assert gmtl.isEqual(coord1, coord2, eps)
assert not gmtl.isEqual(coord1, coord2, dataType(eps / 3.0))
coord2.pos[j] = coord1.pos[j] # put it back
coord2.rot[j] = coord1.rot[j] - (eps / dataType(2.0))
assert gmtl.isEqual(coord1, coord2, eps)
assert not gmtl.isEqual(coord1, coord2, dataType(eps / 3.0))
coord2.rot[j] = coord1.rot[j] # put it back
def testCoordEqualityFloatTest(self):
for i in range(10):
self.__testCoordEquality(gmtl.Coord3fXYZ, gmtl.Vec3f,
gmtl.EulerAngleXYZf, float)
# def testCoordEqualityDoubleTest(self):
# for i in range(10):
# self.__testCoordEquality(gmtl.Coord3dXYZ, gmtl.Vec3d,
# gmtl.EulerAngleXYZd)
class CoordCompareMetricTest(unittest.TestCase):
def testCoordTimingOpEqualityTest(self):
iters = 400000
src_coord11 = gmtl.Coord3fXYZ()
src_coord22 = gmtl.Coord3fXYZ()
src_coord33 = gmtl.Coord3fXYZ()
src_coord34 = gmtl.Coord3fXYZ()
src_coord44 = gmtl.Coord3fXYZ()
src_coord101 = gmtl.Coord3dXYZ()
# Half of them will be equal.
src_coord11.pos[0] = 1.0
src_coord22.pos[1] = 1.0
src_coord33.pos[2] = 2.0
test_coord11 = gmtl.Coord3fXYZ(src_coord11)
test_coord22 = gmtl.Coord3fXYZ(src_coord22)
test_coord33 = gmtl.Coord3fXYZ(src_coord33)
test_coord34 = gmtl.Coord3fXYZ(src_coord34)
test_coord44 = gmtl.Coord3fXYZ(src_coord44)
test_coord101 = gmtl.Coord3dXYZ(src_coord101)
# Half will be unequal.
src_coord34.pos[0] = 2.0
src_coord44.pos[1] = 3.0
src_coord101.pos[2] = 1.0
true_count = 0
for iter in xrange(iters):
if src_coord11 == test_coord11:
true_count += 1
if src_coord22 == test_coord22:
true_count += 1
if src_coord33 == test_coord33:
true_count += 1
if src_coord34 == test_coord34:
true_count += 1
if src_coord44 == test_coord44:
true_count += 1
if src_coord101 == test_coord101:
true_count += 1
assert true_count > 0
def testCoordTimingOpNotEqualityTest(self):
iters = 400000
src_coord11 = gmtl.Coord3fXYZ()
src_coord22 = gmtl.Coord3fXYZ()
src_coord33 = gmtl.Coord3fXYZ()
src_coord34 = gmtl.Coord3fXYZ()
src_coord44 = gmtl.Coord3fXYZ()
src_coord101 = gmtl.Coord3dXYZ()
# Half of them will be equal.
src_coord11.pos[0] = 1.0
src_coord22.pos[1] = 1.0
src_coord33.pos[2] = 2.0
test_coord11 = gmtl.Coord3fXYZ(src_coord11)
test_coord22 = gmtl.Coord3fXYZ(src_coord22)
test_coord33 = gmtl.Coord3fXYZ(src_coord33)
test_coord34 = gmtl.Coord3fXYZ(src_coord34)
test_coord44 = gmtl.Coord3fXYZ(src_coord44)
test_coord101 = gmtl.Coord3dXYZ(src_coord101)
# Half will be unequal.
src_coord34.pos[0] = 2.0
src_coord44.pos[1] = 3.0
src_coord101.pos[2] = 1.0
true_count = 0
for iter in xrange(iters):
if src_coord11 != test_coord11:
true_count += 1
if src_coord22 != test_coord22:
true_count += 1
if src_coord33 != test_coord33:
true_count += 1
if src_coord34 != test_coord34:
true_count += 1
if src_coord44 != test_coord44:
true_count += 1
if src_coord101 != test_coord101:
true_count += 1
assert true_count > 0
def testCoordTimingIsEqualTest(self):
iters = 400000
src_coord11 = gmtl.Coord3fXYZ()
src_coord22 = gmtl.Coord3fXYZ()
src_coord33 = gmtl.Coord3fXYZ()
src_coord34 = gmtl.Coord3fXYZ()
src_coord44 = gmtl.Coord3fXYZ()
src_coord101 = gmtl.Coord3dXYZ()
# Half of them will be equal.
src_coord11.pos[0] = 1.0
src_coord22.pos[1] = 1.0
src_coord33.pos[2] = 2.0
test_coord11 = gmtl.Coord3fXYZ(src_coord11)
test_coord22 = gmtl.Coord3fXYZ(src_coord22)
test_coord33 = gmtl.Coord3fXYZ(src_coord33)
test_coord34 = gmtl.Coord3fXYZ(src_coord34)
test_coord44 = gmtl.Coord3fXYZ(src_coord44)
test_coord101 = gmtl.Coord3dXYZ(src_coord101)
# Half will be unequal.
src_coord34.pos[0] = 2.0
src_coord44.pos[1] = 3.0
src_coord101.pos[2] = 1.0
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(src_coord11, test_coord11):
true_count += 1
if gmtl.isEqual(src_coord22, test_coord22):
true_count += 1
if gmtl.isEqual(src_coord33, test_coord33):
true_count += 1
if gmtl.isEqual(src_coord34, test_coord34):
true_count += 1
if gmtl.isEqual(src_coord44, test_coord44):
true_count += 1
if gmtl.isEqual(src_coord101, test_coord101):
true_count += 1
assert true_count > 0
class CoordGenTest(unittest.TestCase):
def testCoordSetMatrix(self):
q1 = gmtl.Coord3fXYZ()
q1.pos.set(2.0, 3.0, 4.0)
q1.rot.set(0.2, 0.5, 0.6)
mat1 = gmtl.Matrix44f()
q2 = gmtl.Coord3fXYZ()
gmtl.set(mat1, q1) # set the matrix
gmtl.set(q2, mat1) # extract it
assert gmtl.isEqual(q1, q2, 0.01)
def testCoordMakeCoord(self):
q1 = gmtl.Coord3fXYZ()
# Test translation with gmtl.set()
mat = gmtl.makeTransMatrix44(gmtl.Vec3f(1.0, 2.0, 3.0))
gmtl.set(q1, mat)
assert q1.getPos()[0] == 1.0
assert q1.getPos()[1] == 2.0
assert q1.getPos()[2] == 3.0
def testCoordGetMatrix(self):
trans = gmtl.Vec3f(1.0, 2.0, 3.0)
rot = gmtl.EulerAngleXYZf(4.0, 5.0, 6.0)
q1 = gmtl.Coord3fXYZ(trans, rot)
# Test translation with gmtl.set()
mat = gmtl.Matrix44f()
gmtl.set(mat, q1)
v2 = gmtl.makeTransVec3(mat)
assert v2 == trans
eps = 0.001
q1 = gmtl.Coord3fXYZ(trans, rot)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.683013, -0.183013, 0.707107,
0.683013, -0.183013, -0.707107,
0.258819, 0.965926, 0.0 )
q1.rot[0] = gmtl.Math.deg2Rad(90.0)
q1.rot[1] = gmtl.Math.deg2Rad(45.0)
q1.rot[2] = gmtl.Math.deg2Rad(15.0)
mat = gmtl.Matrix33f()
gmtl.set(mat, q1)
assert gmtl.isEqual(expected_result33, mat, eps)
q1 = gmtl.Coord3fZXY(trans, gmtl.EulerAngleZXYf(4.0, 5.0, 6.0))
expected_result44 = gmtl.Matrix44f()
expected_result44.set(-0.918494, 0.283617, -0.275553, gmtl.Math.deg2Rad(1.0),
-0.395247, -0.637014, 0.66181, gmtl.Math.deg2Rad(2.0),
0.0121696, 0.71678, 0.697193, gmtl.Math.deg2Rad(3.0),
0.0, 0.0, 0.0, 1.0)
q1.pos[0] = gmtl.Math.deg2Rad(1.0)
q1.pos[1] = gmtl.Math.deg2Rad(2.0)
q1.pos[2] = gmtl.Math.deg2Rad(3.0)
q1.rot[0] = gmtl.Math.deg2Rad(-156.0)
q1.rot[1] = gmtl.Math.deg2Rad(45.7892892)
q1.rot[2] = gmtl.Math.deg2Rad(-361.0)
mat = gmtl.Matrix44f()
gmtl.set(mat, q1)
assert gmtl.isEqual(expected_result44, mat, eps)
class CoordGenMetricTest(unittest.TestCase):
def testGenTimingMakeCoord(self):
mat = gmtl.Matrix44f()
iters = 25000
for iter in xrange(iters):
q1 = gmtl.Coord3fXYZ()
gmtl.set(q1, mat)
mat[3][1] != q1.getPos()[2]
assert q1.pos[1] != 10000.0
def testGenTimingMakeMatrix(self):
iters = 25000
q1 = gmtl.Coord3fXYZ()
for iter in xrange(iters):
mat = gmtl.Matrix44f()
q1.pos[2] += mat[3][3]
assert q1.pos[1] != 10000.0
def testGenTimingSetCoord(self):
mat = gmtl.Matrix44f()
q1 = gmtl.Coord3fXYZ()
iters = 25000
for iter in xrange(iters):
gmtl.set(q1, mat)
mat[3][3] += q1.getPos()[2]
assert q1.pos[1] != 10000.0
class EulerAngleClassTest(unittest.TestCase):
def testEulerAngleClassTestCreation(self):
# Test that it initializes to the identity.
q = gmtl.EulerAngleXYZf()
assert q[0] == 0.0
assert q[1] == 0.0
assert q[2] == 0.0
# Try out set.
q.set(1.0, 2.0, 3.0)
assert q[0] == 1.0
assert q[1] == 2.0
assert q[2] == 3.0
# Try out setting with brackets.
q[0] = 5.0
q[1] = 6.0
q[2] = 7.0
assert q[0] == 5.0
assert q[1] == 6.0
assert q[2] == 7.0
# Try out element constructor.
q2 = gmtl.EulerAngleZYXf(10.0, 11.0, 12.0)
assert q2[0] == 10.0
assert q2[1] == 11.0
assert q2[2] == 12.0
# Try out copy constructor.
q3 = gmtl.EulerAngleXYZf(q)
assert q3[0] == 5.0
assert q3[1] == 6.0
assert q3[2] == 7.0
class EulerAngleClassMetricTest(unittest.TestCase):
def testEulerAngleTimingDefaultConstructor(self):
iters = 400000
use_value = 1.0
for iter in xrange(iters):
q = gmtl.EulerAngleXYZf()
use_value += q[0]
assert use_value != 0.0
def testEulerAngleTimingElementConstructor(self):
iters = 400000
use_value = 1.0
for iter in xrange(iters):
q2 = gmtl.EulerAngleXYZf(10.0, 11.0, 12.0)
use_value += q2[0]
assert use_value != 0.0
def testEulerAngleTimingCopyConstructor(self):
iters = 400000
use_value = 1.0
q = gmtl.EulerAngleXYZf(67.0, 68.0, 69.0)
for iter in xrange(iters):
q3 = gmtl.EulerAngleXYZf(q)
use_value += q3[0]
use_value != 0.0
def testEulerAngleTimingSet(self):
iters = 400000
use_value = 0.0
q = gmtl.EulerAngleXYZf()
for iter in xrange(iters):
q.set(1.0, 2.0, 3.0)
use_value += q[0]
assert use_value >= 0.0
def testEulerAngleTimingOpBracked(self):
iters = 400000
use_value = 0.0
q = gmtl.EulerAngleXYZf()
x = 102.0
y = 103.0
z = 101.0
for iter in xrange(iters):
q[0] = x
q[1] = y
q[2] = z
use_value = use_value + x + y + z
assert use_value > 0.0
def testEulerAngleTimingGetData(self):
iters = 400000
use_value = 0.0
q = gmtl.EulerAngleXYZf(1.0, 2.0, 3.0)
for iter in xrange(iters):
d = q.getData()
use_value += d[1]
assert use_value > 0.0
class EulerAngleCompareTest(unittest.TestCase):
def __testEulerAngleEquality(self, eulerAngleType, dataType):
euler1 = eulerAngleType()
euler1.set(dataType(1.0), dataType(2.0), dataType(34.0))
euler2 = eulerAngleType(euler1)
assert euler1 == euler2
assert euler2 == euler1
for j in range(3):
euler2[j] = dataType(1221.0)
assert euler1 != euler2
assert not euler1 == euler2
euler2[j] = euler1[j] # put it back
# Just for fun.
assert euler1 == euler2
assert not euler1 != euler2
# Test for epsilon equals working.
assert gmtl.isEqual(euler1, euler2)
assert gmtl.isEqual(euler1, euler2, dataType(0.0))
assert gmtl.isEqual(euler2, euler1, dataType(0.0))
assert gmtl.isEqual(euler2, euler1, dataType(100000.0))
eps = dataType(10.0)
for j in range(3):
euler2[j] = euler1[j] - (eps / dataType(2.))
assert gmtl.isEqual(euler1, euler2, eps)
assert not gmtl.isEqual(euler1, euler2, dataType(eps / 3.0))
euler2[j] = euler1[j] # put it back
def testEulerAngleEqualityFloatTest(self):
for i in range(10):
self.__testEulerAngleEquality(gmtl.EulerAngleXYZf, float)
for i in range(10):
self.__testEulerAngleEquality(gmtl.EulerAngleZXYf, float)
for i in range(10):
self.__testEulerAngleEquality(gmtl.EulerAngleZYXf, float)
# def testEulerAngleEqualityDoubleTest(self):
# for i in range(10):
# self.__testEulerAngleEquality(gmtl.EulerAngleXYZd, double)
#
# for i in range(10):
# self.__testEulerAngleEquality(gmtl.EulerAngleZXYd, double)
#
# for i in range(10):
# self.__testEulerAngleEquality(gmtl.EulerAngleZYXd, double)
class EulerAngleCompareMetricTest(unittest.TestCase):
def testEulerAngleTimingOpEqualityTest(self):
iters = 400000
src_ang11 = gmtl.EulerAngleXYZf()
src_ang22 = gmtl.EulerAngleXYZf()
src_ang33 = gmtl.EulerAngleXYZf()
src_ang34 = gmtl.EulerAngleXYZf()
src_ang44 = gmtl.EulerAngleXYZf()
# src_ang101 = gmtl.EulerAngleXYZd()
# Half of them will be equal.
src_ang11[0] = 1.0
src_ang22[2] = 1.0
src_ang33[1] = 2.0
test_ang11 = gmtl.EulerAngleXYZf(src_ang11)
test_ang22 = gmtl.EulerAngleXYZf(src_ang22)
test_ang33 = gmtl.EulerAngleXYZf(src_ang33)
test_ang34 = gmtl.EulerAngleXYZf(src_ang34)
test_ang44 = gmtl.EulerAngleXYZf(src_ang44)
# test_ang101 = gmtl.EulerAngleXYZd(src_ang101)
# Half will be unequal.
src_ang34[0] = 2.0
src_ang44[0] = 3.0
# src_ang101[0] = 1.0
true_count = 0
for iter in xrange(iters):
if src_ang11 == test_ang11:
true_count += 1
if src_ang22 == test_ang22:
true_count += 1
if src_ang33 == test_ang33:
true_count += 1
if src_ang34 == test_ang34:
true_count += 1
if src_ang44 == test_ang44:
true_count += 1
# if src_ang101 == test_ang101:
# true_count += 1
assert true_count > 0
def testEulerAngleTimingOpNotEqualityTest(self):
iters = 400000
src_ang11 = gmtl.EulerAngleXYZf()
src_ang22 = gmtl.EulerAngleXYZf()
src_ang33 = gmtl.EulerAngleXYZf()
src_ang34 = gmtl.EulerAngleXYZf()
src_ang44 = gmtl.EulerAngleXYZf()
# src_ang101 = gmtl.EulerAngleXYZd()
# Half of them will be equal.
src_ang11[0] = 1.0
src_ang22[2] = 1.0
src_ang33[1] = 2.0
test_ang11 = gmtl.EulerAngleXYZf(src_ang11)
test_ang22 = gmtl.EulerAngleXYZf(src_ang22)
test_ang33 = gmtl.EulerAngleXYZf(src_ang33)
test_ang34 = gmtl.EulerAngleXYZf(src_ang34)
test_ang44 = gmtl.EulerAngleXYZf(src_ang44)
# test_ang101 = gmtl.EulerAngleXYZd(src_ang101)
# Half will be unequal.
src_ang34[0] = 2.0
src_ang44[0] = 3.0
# src_ang101[0] = 1.0
true_count = 0
for iter in xrange(iters):
if src_ang11 != test_ang11:
true_count += 1
if src_ang22 != test_ang22:
true_count += 1
if src_ang33 != test_ang33:
true_count += 1
if src_ang34 != test_ang34:
true_count += 1
if src_ang44 != test_ang44:
true_count += 1
# if src_ang101 != test_ang101:
# true_count += 1
assert true_count > 0
def testEulerAngleTimingOpIsEqualTest(self):
iters = 400000
src_ang11 = gmtl.EulerAngleXYZf()
src_ang22 = gmtl.EulerAngleXYZf()
src_ang33 = gmtl.EulerAngleXYZf()
src_ang34 = gmtl.EulerAngleXYZf()
src_ang44 = gmtl.EulerAngleXYZf()
# src_ang101 = gmtl.EulerAngleXYZd()
# Half of them will be equal.
src_ang11[0] = 1.0
src_ang22[2] = 1.0
src_ang33[1] = 2.0
test_ang11 = gmtl.EulerAngleXYZf(src_ang11)
test_ang22 = gmtl.EulerAngleXYZf(src_ang22)
test_ang33 = gmtl.EulerAngleXYZf(src_ang33)
test_ang34 = gmtl.EulerAngleXYZf(src_ang34)
test_ang44 = gmtl.EulerAngleXYZf(src_ang44)
# test_ang101 = gmtl.EulerAngleXYZd(src_ang101)
# Half will be unequal.
src_ang34[0] = 23.0
src_ang44[0] = 234.0
# src_ang101[0] = 1234.0
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(src_ang11, test_ang11):
true_count += 1
if gmtl.isEqual(src_ang22, test_ang22):
true_count += 1
if gmtl.isEqual(src_ang33, test_ang33):
true_count += 1
if gmtl.isEqual(src_ang34, test_ang34):
true_count += 1
if gmtl.isEqual(src_ang44, test_ang44):
true_count += 1
# if gmtl.isEqual(src_ang101, test_ang101, 111.1):
# true_count += 1
assert true_count > 0
class IntersectionTest(unittest.TestCase):
def testIntersectAABoxAABox(self):
# Test overlapping boxes.
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 2.0, 2.0))
assert gmtl.intersect(box1, box2)[0]
# Test boxes with shared edge.
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(-1.0, -1.0, -1.0))
assert gmtl.intersect(box1, box2)[0]
# Test non-overlapping boxes.
box1 = gmtl.AABoxf(gmtl.Point3f(-2.0, -2.0, -2.0),
gmtl.Point3f(-1.0, -1.0, -1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(1.0, 1.0, 1.0),
gmtl.Point3f(2.0, 2.0, 2.0))
assert not gmtl.intersect(box1, box2)[0]
def testIntersectAABoxPoint(self):
# Test point in box.
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
point = gmtl.Point3f(0.0, 0.0, 0.0)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (bottom face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -1.0, -0.5)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (top face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, 0.0, -0.5)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (left face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-1.0, -0.5, -0.5)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (right face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(0.0, -0.5, -0.5)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (near face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -0.5, 0.0)
assert gmtl.intersect(box1, point)[0]
# Test point on edge (far face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -0.5, -1.0)
assert gmtl.intersect(box1, point)[0]
# Test point outside (bottom face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -1.01, -0.5)
assert not gmtl.intersect(box1, point)[0]
# Test point outside (top face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, 0.01, -0.5)
assert not gmtl.intersect(box1, point)[0]
# Test point outside (left face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-1.01, -0.5, -0.5)
assert not gmtl.intersect(box1, point)[0]
# Test point outside (right face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(0.01, -0.5, -0.5)
assert not gmtl.intersect(box1, point)[0]
# Test point outside (right face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -0.5, 0.01)
assert not gmtl.intersect(box1, point)[0]
# Test point on edge (far face).
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
point = gmtl.Point3f(-0.5, -0.5, -1.01)
assert not gmtl.intersect(box1, point)[0]
def testIntersectLineSegPlane(self):
plane = gmtl.Planef(gmtl.Vec3f(0.0, 1.0, 0.0), 0.0)
eps = 0.0001
# Behind.
seg = gmtl.LineSegf(gmtl.Point3f(0.0, -1.0, 0.0),
gmtl.Vec3f(0.0, -1.0, 0.0))
(res, d) = gmtl.intersect(plane, seg)
assert res == False
# Not long enough.
seg = gmtl.LineSegf(gmtl.Point3f(0.0, 5.0, 0.0),
gmtl.Vec3f(0.0, -2.5, 0.0))
(res, d) = gmtl.intersect(plane, seg)
assert res == False
assert d == 2.0
# Through.
seg = gmtl.LineSegf(gmtl.Point3f(0.0, 5.0, 0.0),
gmtl.Vec3f(0.0, -10.0, 0.0))
(res, d) = gmtl.intersect(plane, seg)
assert res == True
assert d == 0.5
# Parallel - Shoot seg parallel to plane.
ray = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.0), gmtl.Vec3f(1.0, 0.0, 0.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == False
assert isEqual(d, 0.0, eps)
# Parallel - On plane - Shoot ray parallel to the plane on the plane.
seg = gmtl.LineSegf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Vec3f(1.0, 0.0, 0.0))
(res, d) = gmtl.intersect(plane, seg)
assert res == True
assert isEqual(d, 0.0, eps)
def testIntersectRayPlane(self):
eps = 0.0001
# Plane at origin
# Derfine plane on origin pointing up.
plane = gmtl.Planef(gmtl.Vec3f(0.0, 1.0, 0.0), 0.0)
# Through - Shoot ray from +5y straight down at plane.
# Should hit with t = 5
ray = gmtl.Rayf(gmtl.Point3f(0.0, 5.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == True
assert d == 5.0
# Behind - Shoot ray from -1y straight down. Should miss.
ray = gmtl.Rayf(gmtl.Point3f(0.0, -1.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == False
# Parallel - Shoot ray parallel to plane.
ray = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.0), gmtl.Vec3f(1.0, 0.0, 0.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == False
assert isEqual(d, 0.0, eps)
# Parallel - On the plane; shoot ray parallel to thr plane on the plane.
ray = gmtl.Rayf(gmtl.Point3f(0.0, 0.0, 0.0), gmtl.Vec3f(1.0, 0.0, 0.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == True
assert isEqual(d, 0.0, eps)
# Plane off origin - 45 degree angle off
plane = gmtl.Planef(gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 1.0, 0.0),
gmtl.Point3f(0.0, 0.0, 1.0))
# Send ray from origin orthogonal.
ray = gmtl.Rayf(gmtl.Point3f(0.0, 0.0, 0.0), gmtl.Vec3f(1.0, 1.0, 1.0))
(res, d) = gmtl.intersect(plane, ray)
assert res == True
assert isEqual(d, 0.3333, eps)
miss_ray = gmtl.Rayf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Vec3f(-1.0, -1.0, -1.0))
(res, d) = gmtl.intersect(plane, miss_ray)
assert res == False
def testIntersectAABoxSphere(self):
# Overlapping.
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 2.0)
assert gmtl.intersect(box, sph)[0]
assert gmtl.intersect(sph, box)[0]
# Shared edge.
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
sph = gmtl.Spheref(gmtl.Point3f(2.0, 0.0, 0.0), 2.0)
assert gmtl.intersect(box, sph)[0]
assert gmtl.intersect(sph, box)[0]
# Non-overlapping.
box = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
sph = gmtl.Spheref(gmtl.Point3f(3.0, 3.0, 3.0), 2.0)
assert not gmtl.intersect(box, sph)[0]
assert not gmtl.intersect(sph, box)[0]
def testIntersectAABoxSweep(self):
box1 = gmtl.AABoxf(gmtl.Point3f(-3.0, 1.0, -3.0),
gmtl.Point3f(-2.0, 2.0, -2.0))
box2 = gmtl.AABoxf(gmtl.Point3f(2.0, 1.0, -3.0),
gmtl.Point3f(3.0, 3.0, -2.0))
path1 = gmtl.Vec3f(5.0, 0.0, 0.0)
path2 = gmtl.Vec3f(-5.0, 0.0, 0.0)
(result, first, second) = gmtl.intersect(box1, path1, box2, path2)
assert result
assert isEqual(first, 0.4)
assert isEqual(second, 0.6)
def testIntersectSphereSweep(self):
sph1 = gmtl.Spheref(gmtl.Point3f(-3.0, 1.0, -3.0), 2.0)
sph2 = gmtl.Spheref(gmtl.Point3f(2.0, 1.0, -3.0), 1.0)
path1 = gmtl.Vec3f(5.0, 0.0, 0.0)
path2 = gmtl.Vec3f(-5.0, 0.0, 0.0)
(result, first, second) = gmtl.intersect(sph1, path1, sph2, path2)
assert result
assert isEqual(first, 0.2, 0.001)
assert isEqual(second, 0.8, 0.001)
class IntersectionMetricTest(unittest.TestCase):
def testTimingIntersectAABoxAABox(self):
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
box2 = gmtl.AABoxf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 2.0, 2.0))
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.intersect(box1, box2)[0]:
true_count += 1
box2.max[0] += 0.01
assert true_count > 0
def testTimingIntersectAABoxPoint(self):
box1 = gmtl.AABoxf(gmtl.Point3f(-1.0, -1.0, -1.0),
gmtl.Point3f(1.0, 1.0, 1.0))
point = gmtl.Point3f(-0.5, -0.5, -1.01)
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.intersect(box1, point)[0]:
true_count += 1
point[0] += 0.01
assert true_count == 0
def testTimingIntersectAABoxSweep(self):
box1 = gmtl.AABoxf(gmtl.Point3f(-3.0, 1.0, -3.0),
gmtl.Point3f(-2.0, 2.0, -2.0))
box2 = gmtl.AABoxf(gmtl.Point3f(2.0, 1.0, -3.0),
gmtl.Point3f(3.0, 3.0, -2.0))
path1 = gmtl.Vec3f(1.0, 0.0, 0.0)
path2 = gmtl.Vec3f(-5.0, 0.0, 0.0)
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.intersect(box1, path1, box2, path2)[0]:
true_count += 1
path1[0] += 0.1
assert true_count > 0
def testTimingIntersectSphereSweep(self):
sph1 = gmtl.Spheref(gmtl.Point3f(-3.0, 1.0, -3.0), 2.0)
sph2 = gmtl.Spheref(gmtl.Point3f(2.0, 1.0, -3.0), 1.0)
path1 = gmtl.Vec3f(1.0, 0.0, 0.0)
path2 = gmtl.Vec3f(-5.0, 0.0, 0.0)
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.intersect(sph1, path1, sph2, path2)[0]:
true_count += 1
path1[0] += 0.1
assert true_count > 0
class LineSegTest(unittest.TestCase):
def setUp(self):
self.origin = gmtl.Point3f(0.0, 0.0, 0.0)
self.x1_pt = gmtl.Point3f(1.0, 0.0, 0.0)
self.y1_pt = gmtl.Point3f(0.0, 1.0, 0.0)
self.z1_pt = gmtl.Point3f(0.0, 0.0, 1.0)
self.x1_v = gmtl.Vec3f(1.0, 0.0, 0.0)
self.y1_v = gmtl.Vec3f(0.0, 1.0, 0.0)
self.z1_v = gmtl.Vec3f(0.0, 0.0, 1.0)
self.x1_lineseg = gmtl.LineSegf(self.origin, self.x1_v)
self.y1_lineseg = gmtl.LineSegf(self.origin, self.y1_v)
self.z1_lineseg = gmtl.LineSegf(self.origin, self.z1_v)
def testCreation(self):
test_lineseg = gmtl.LineSegf()
zeroVec = gmtl.Vec3f(0.0, 0.0, 0.0)
assert test_lineseg.origin == self.origin
assert test_lineseg.dir == zeroVec
def testPtVecCreation(self):
assert self.x1_lineseg.origin == self.origin
assert self.y1_lineseg.origin == self.origin
assert self.z1_lineseg.origin == self.origin
assert self.x1_lineseg.dir == self.x1_v
assert self.y1_lineseg.dir == self.y1_v
assert self.z1_lineseg.dir == self.z1_v
vec = gmtl.Vec3f(1.0, 1.0, 1.0)
test_lineseg = gmtl.LineSegf(self.x1_pt, vec)
assert test_lineseg.origin == self.x1_pt
assert test_lineseg.dir == vec
def testPtPtCreation(self):
test_lineseg = gmtl.LineSegf(self.origin, self.x1_pt)
assert test_lineseg.origin == self.origin
assert test_lineseg.dir == gmtl.Vec3f(self.x1_pt - self.origin)
test_lineseg = gmtl.LineSegf(self.x1_pt, self.y1_pt)
assert test_lineseg.origin == self.x1_pt
assert test_lineseg.dir == gmtl.Vec3f(self.y1_pt - self.x1_pt)
def testCopyConstruct(self):
test_lineseg = gmtl.LineSegf(self.x1_lineseg)
assert test_lineseg.origin == self.x1_lineseg.origin
assert test_lineseg.dir == self.x1_lineseg.dir
def testGetOrigin(self):
assert self.x1_lineseg.getOrigin() == self.origin
assert self.y1_lineseg.getOrigin() == self.origin
assert self.z1_lineseg.getOrigin() == self.origin
pt = gmtl.Point3f(25.0, 23.0, 0.0)
test_lineseg = gmtl.LineSegf(pt, self.x1_pt)
assert test_lineseg.getOrigin() == pt
def testSetOrigin(self):
test_lineseg = gmtl.LineSegf()
test_lineseg.setOrigin(self.x1_pt)
assert test_lineseg.getOrigin() == self.x1_pt
def testGetDir(self):
assert self.x1_lineseg.getDir() == self.x1_v
assert self.y1_lineseg.getDir() == self.y1_v
assert self.z1_lineseg.getDir() == self.z1_v
dir = gmtl.Vec3f(25.0, 23.0, 0.0)
test_lineseg = gmtl.LineSegf(self.x1_pt, dir)
assert test_lineseg.getDir() == dir
def testSetDir(self):
test_lineseg = gmtl.LineSegf()
test_lineseg.setDir(self.x1_v)
assert test_lineseg.getDir() == self.x1_v
def testGetLength(self):
test_lineseg1 = gmtl.LineSegf(self.x1_pt, self.x1_v)
assert test_lineseg1.getLength() == gmtl.length(self.x1_v)
def testEqualityCompare(self):
test_lineseg1 = gmtl.LineSegf(self.x1_pt, self.x1_v)
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
assert test_lineseg1 == test_lineseg2
assert not test_lineseg1 != test_lineseg2
# Set equal, vary origin.
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
test_lineseg2.origin[0] += 2.0
assert test_lineseg1 != test_lineseg2
assert not test_lineseg1 == test_lineseg2
# Set equal, vary dir
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
test_lineseg2.dir[0] += 2.0
assert test_lineseg1 != test_lineseg2
assert not test_lineseg1 == test_lineseg2
def testIsEqual(self):
test_lineseg1 = gmtl.LineSegf(self.x1_pt, self.x1_v)
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_lineseg1, test_lineseg2, eps)
eps += 0.05
for elt in range(6):
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
if elt < 3:
test_lineseg2.origin[elt] += 20.0
else:
test_lineseg2.dir[elt - 3] += 20.0
assert not gmtl.isEqual(test_lineseg1, test_lineseg2, 10.0)
assert not gmtl.isEqual(test_lineseg1, test_lineseg2, 19.9)
assert gmtl.isEqual(test_lineseg1, test_lineseg2, 20.1)
assert gmtl.isEqual(test_lineseg1, test_lineseg2, 22.0)
def testIntersectLineSegPlane(self):
lineseg = gmtl.LineSegf(gmtl.Point3f(0.0, 1.0, 0.0),
gmtl.Point3f(0.0, -1.0, 0.0))
plane = gmtl.Planef(gmtl.Vec3f(0.0, 1.0, 0.0), 0.0)
(result, t) = gmtl.intersect(plane, lineseg)
assert t == 0.5 and result == True
def testIntersectLineSegTri(self):
# Test t
l = gmtl.LineSegf(gmtl.Point3f(0.0, 1.0, 0.0),
gmtl.Point3f(0.0, -1.0, 0.0))
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 1.0),
gmtl.Point3f(1.0, 0.0, 1.0),
gmtl.Point3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, l)
assert t == 0.5 and result == True
# Test u and v
l = gmtl.LineSegf(gmtl.Point3f(0.25, 1.0, -0.25),
gmtl.Point3f(0.25, -1.0, -0.25))
tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, l)
assert t == 0.5 and result == True
assert u == 0.25 and v == 0.25
# Test outside of tri.
tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, -1.0))
lineseg = gmtl.LineSegf(gmtl.Point3f(-0.25, 1.0, 0.0),
gmtl.Point3f(-0.25, 1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert result == False
lineseg = gmtl.LineSegf(gmtl.Point3f(0.0, 1.0, 0.25),
gmtl.Point3f(0.0, -1.0, 0.25))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert result == False
# Right on edge of tri should give intersection.
lineseg = gmtl.LineSegf(gmtl.Point3f(0.0, 1.0, 0.0),
gmtl.Point3f(0.0, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert t == 0.5 and result == True
# Right off edge of tri should not.
lineseg = gmtl.LineSegf(gmtl.Point3f(-0.000001, 1.0, 0.0),
gmtl.Point3f(-0.000001, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert result == False
# Test other places.
# x/y plane
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, 0.0), gmtl.Point3f(0.0, 1.0, 0.0))
lineseg = gmtl.LineSegf(gmtl.Point3f(0.0, 0.0, 1.0),
gmtl.Point3f(0.0, 0.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert t == 1.0 and result == True
# Try flipped about the x/y plane.
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(-2.0, 0.0, 0.0),
gmtl.Point3f(-1.0, 1.0, 0.0))
lineseg = gmtl.LineSegf(gmtl.Point3f(-1.5, 0.0, -1.0),
gmtl.Point3f(-1.5, 0.0, 1.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert t == 0.5 and result == True
# Make sure backfacing triangles don't intersect.
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(-2.0, 0.0, 0.0),
gmtl.Point3f(-1.0, 1.0, 0.0))
lineseg = gmtl.LineSegf(gmtl.Point3f(-1.5, 0.0, 1.0),
gmtl.Point3f(-1.5, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, lineseg)
assert result == False
def testIntersectRayPlane(self):
r = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
plane = gmtl.Planef(gmtl.Vec3f(0.0, 1.0, 0.0), 0.0)
(result, t) = gmtl.intersect(plane, r)
assert t == 1.0 and result == True
def testIntersectRayTri(self):
# Test t
r = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 1.0),
gmtl.Point3f(1.0, 0.0, 1.0),
gmtl.Point3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert t == 1.0 and result == True
# Test u and v
r = gmtl.Rayf(gmtl.Point3f(0.25, 1.0, -0.25), gmtl.Vec3f(0.0, -1.0, 0.0))
tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert t == 1.0 and result == True
assert u == 0.25 and v == 0.25
# Test outside of tri.
tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, -1.0))
r = gmtl.Rayf(gmtl.Point3f(-0.25, 1.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert result == False
r = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.25), gmtl.Vec3f(0.0, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert result == False
# Right on edge of tri should give intersection.
r = gmtl.Rayf(gmtl.Point3f(0.0, 1.0, 0.0), gmtl.Vec3f(0.0, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert t == 1.0 and result == True
# Right off edge of tri should not.
r = gmtl.Rayf(gmtl.Point3f(-0.000001, 1.0, 0.0),
gmtl.Vec3f(0.0, -1.0, 0.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert result == False
# Test other places.
# x/y plane
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 0.0, 0.0), gmtl.Point3f(0.0, 1.0, 0.0))
r = gmtl.Rayf(gmtl.Point3f(0.0, 0.0, 1.0), gmtl.Vec3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert t == 1.0 and result == True
# Try flipped about the x/y plane.
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(-2.0, 0.0, 0.0),
gmtl.Point3f(-1.0, 1.0, 0.0))
r = gmtl.Rayf(gmtl.Point3f(-1.5, 0.0, -1.0), gmtl.Vec3f(0.0, 0.0, 1.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert t == 1.0 and result == True
# Make sure backfacing triangles don't intersect.
tri = gmtl.Trif(gmtl.Point3f(-1.0, 0.0, 0.0),
gmtl.Point3f(-2.0, 0.0, 0.0),
gmtl.Point3f(-1.0, 1.0, 0.0))
r = gmtl.Rayf(gmtl.Point3f(-1.5, 0.0, 1.0), gmtl.Vec3f(0.0, 0.0, -1.0))
(result, u, v, t) = gmtl.intersect(tri, r)
assert result == False
class LineSegMetricTest(unittest.TestCase):
def setUp(self):
self.origin = gmtl.Point3f(0.0, 0.0, 0.0)
self.x1_pt = gmtl.Point3f(1.0, 0.0, 0.0)
self.y1_pt = gmtl.Point3f(0.0, 1.0, 0.0)
self.z1_pt = gmtl.Point3f(0.0, 0.0, 1.0)
self.x1_v = gmtl.Vec3f(1.0, 0.0, 0.0)
self.y1_v = gmtl.Vec3f(0.0, 1.0, 0.0)
self.z1_v = gmtl.Vec3f(0.0, 0.0, 1.0)
self.x1_lineseg = gmtl.LineSegf(self.origin, self.x1_v)
self.y1_lineseg = gmtl.LineSegf(self.origin, self.y1_v)
self.z1_lineseg = gmtl.LineSegf(self.origin, self.z1_v)
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg = gmtl.LineSegf()
use_value += test_lineseg.dir[0] + 1.0
assert use_value > 0.0
def testTimingPtVecCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg2 = gmtl.LineSegf(self.y1_pt, self.z1_v)
use_value += test_lineseg2.dir[0] + 1.0
assert use_value > 0
def testTimingPtPtCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg2 = gmtl.LineSegf(self.x1_pt, self.z1_pt)
use_value += test_lineseg2.dir[0]
assert use_value != 0
def testTimingCopyConstructor(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg2 = gmtl.LineSegf(self.x1_lineseg)
use_value += test_lineseg2.dir[0]
assert use_value > 0
def testTimingGetOrigin(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
pt = self.x1_lineseg.getOrigin()
use_value += pt[0] + 1.0
assert use_value > 0
def testTimingSetOrigin(self):
test_lineseg = gmtl.LineSegf()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg.setOrigin(self.x1_pt)
use_value += test_lineseg.origin[0]
assert use_value > 0
def testTimingGetDir(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
vec = self.x1_lineseg.getDir()
use_value += vec[0] + 1.0
assert use_value > 0
def testTimingSetDir(self):
test_lineseg = gmtl.LineSegf()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_lineseg.setDir(self.x1_v)
use_value += test_lineseg.dir[0]
assert use_value > 0
def testTimingGetLength(self):
lineseg = gmtl.LineSegf()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
use_value += lineseg.getLength()
assert use_value == 0
def testTimingEqualityCompare(self):
test_lineseg1 = gmtl.LineSegf(self.x1_pt, self.x1_v)
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
iters = 400000
true_count = 0
# Equality.
for iter in xrange(iters):
if test_lineseg1 == test_lineseg2:
true_count += 1
test_lineseg1.origin[0] += 1.0
test_lineseg2.origin[0] += 2.0
# Inequality.
test_lineseg1.origin = self.x1_pt
test_lineseg1.dir = self.x1_v
assert test_lineseg1.origin is not self.x1_pt
assert test_lineseg1.dir is not self.x1_v
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
for iter in xrange(iters):
if test_lineseg1 == test_lineseg2:
true_count += 1
test_lineseg1.origin[0] += 1.0
test_lineseg2.origin[0] += 2.0
assert true_count > 0
def testTimingIsEqual(self):
test_lineseg1 = gmtl.LineSegf(self.x1_pt, self.x1_v)
test_lineseg2 = gmtl.LineSegf(test_lineseg1)
iters = 400000
true_count = 0
for iter in xrange(iters):
test_lineseg1.origin[0] += 1.0
test_lineseg2.origin[0] += 2.0
if gmtl.isEqual(test_lineseg1, test_lineseg2, 1.0):
true_count += 1
if gmtl.isEqual(test_lineseg1, test_lineseg2, 0.1):
true_count += 1
if gmtl.isEqual(test_lineseg1, test_lineseg2, 100000.0):
true_count += 1
class MathTest(unittest.TestCase):
def testQuadraticFormula(self):
(result, r1, r2) = gmtl.Math.quadraticFormula(1.0, 3.0, 2.0)
assert result
assert r1 == -1
assert r2 == -2
(result, r1, r2) = gmtl.Math.quadraticFormula(1.0, 5.0, 6.0)
assert result
assert r1 == -2
assert r2 == -3
# Imaginary roots.
(result, r1, r2) = gmtl.Math.quadraticFormula(1.0, 2.0, 3.0)
assert not result
def __testSign(self, dataType):
val = dataType(2.5)
assert gmtl.Math.sign(val) == 1
val = dataType(-2.5)
assert gmtl.Math.sign(val) == -1
val = dataType(0)
assert gmtl.Math.sign(val) == 0
def testSigni(self):
self.__testSign(int)
def testSignf(self):
self.__testSign(float)
class MatrixClassTest(unittest.TestCase):
def testMatrixIdentity(self):
mat44 = gmtl.Matrix44f()
assert mat44[0][0] == 1.0
assert mat44[1][1] == 1.0
assert mat44[2][2] == 1.0
assert mat44[3][3] == 1.0
assert mat44[1][0] == 0.0
assert mat44[2][0] == 0.0
assert mat44[3][0] == 0.0
assert mat44[0][1] == 0.0
assert mat44[2][1] == 0.0
assert mat44[3][1] == 0.0
assert mat44[0][2] == 0.0
assert mat44[1][2] == 0.0
assert mat44[3][2] == 0.0
assert mat44[0][3] == 0.0
assert mat44[1][3] == 0.0
assert mat44[2][3] == 0.0
mat33 = gmtl.Matrix33f()
assert mat44[0][0] == 1.0
assert mat44[1][1] == 1.0
assert mat44[2][2] == 1.0
assert mat44[1][0] == 0.0
assert mat44[2][0] == 0.0
assert mat44[0][1] == 0.0
assert mat44[2][1] == 0.0
assert mat44[0][2] == 0.0
assert mat44[1][2] == 0.0
# Make sure copy constructor works.
src_mat = gmtl.Matrix44f()
src_mat.set(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0)
test_mat = gmtl.Matrix44f(src_mat)
assert src_mat == test_mat
src_mat = gmtl.Matrix33f()
src_mat.set(1.0, 2.0, 3.0,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0)
test_mat = gmtl.Matrix33f(src_mat)
assert src_mat == test_mat
# Make sure assginment works (this is rather pointless in Python).
src_mat = gmtl.Matrix44f()
src_mat.set(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0)
test_mat = src_mat
assert test_mat == src_mat
src_mat = gmtl.Matrix33f()
src_mat.set(1.0, 2.0, 3.0,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0)
test_mat = src_mat
assert src_mat == test_mat
def __testMatrix44SetPtr(self, matType, dataType):
mat44 = [
dataType(0.0), dataType(1.0), dataType(2.0), dataType(3.0),
dataType(4.0), dataType(5.0), dataType(6.0), dataType(7.0),
dataType(8.0), dataType(9.0), dataType(10.0), dataType(11.0),
dataType(12.0), dataType(13.0), dataType(14.0), dataType(15.0)]
test_mat = matType()
test_mat.set(mat44)
assert test_mat(0, 0) == 0
assert test_mat(1, 0) == 1
assert test_mat(2, 0) == 2
assert test_mat(3, 0) == 3
assert test_mat(0, 1) == 4
assert test_mat(1, 1) == 5
assert test_mat(2, 1) == 6
assert test_mat(3, 1) == 7
assert test_mat(0, 2) == 8
assert test_mat(1, 2) == 9
assert test_mat(2, 2) == 10
assert test_mat(3, 2) == 11
assert test_mat(0, 3) == 12
assert test_mat(1, 3) == 13
assert test_mat(2, 3) == 14
assert test_mat(3, 3) == 15
assert test_mat[0][0] == 0
assert test_mat[1][0] == 1
assert test_mat[2][0] == 2
assert test_mat[3][0] == 3
assert test_mat[0][1] == 4
assert test_mat[1][1] == 5
assert test_mat[2][1] == 6
assert test_mat[3][1] == 7
assert test_mat[0][2] == 8
assert test_mat[1][2] == 9
assert test_mat[2][2] == 10
assert test_mat[3][2] == 11
assert test_mat[0][3] == 12
assert test_mat[1][3] == 13
assert test_mat[2][3] == 14
assert test_mat[3][3] == 15
def __testMatrix33SetPtr(self, matType, dataType):
mat33 = [
dataType(0.0), dataType(1.0), dataType(2.0),
dataType(3.0), dataType(4.0), dataType(5.0),
dataType(6.0), dataType(7.0), dataType(8.0)
]
test_mat = matType()
test_mat.set(mat33)
assert test_mat(0, 0) == 0
assert test_mat(1, 0) == 1
assert test_mat(2, 0) == 2
assert test_mat(0, 1) == 3
assert test_mat(1, 1) == 4
assert test_mat(2, 1) == 5
assert test_mat(0, 2) == 6
assert test_mat(1, 2) == 7
assert test_mat(2, 2) == 8
assert test_mat[0][0] == 0
assert test_mat[1][0] == 1
assert test_mat[2][0] == 2
assert test_mat[0][1] == 3
assert test_mat[1][1] == 4
assert test_mat[2][1] == 5
assert test_mat[0][2] == 6
assert test_mat[1][2] == 7
assert test_mat[2][2] == 8
def testMatrixSetPtr(self):
self.__testMatrix44SetPtr(gmtl.Matrix44f, float)
self.__testMatrix33SetPtr(gmtl.Matrix33f, float)
def __testMatrix44SetTransposePtr(self, matType, dataType):
mat44 = [
dataType(0.0), dataType(1.0), dataType(2.0), dataType(3.0),
dataType(4.0), dataType(5.0), dataType(6.0), dataType(7.0),
dataType(8.0), dataType(9.0), dataType(10.0), dataType(11.0),
dataType(12.0), dataType(13.0), dataType(14.0), dataType(15.0)
]
test_mat = matType()
test_mat.setTranspose(mat44)
assert test_mat[0][0] == 0
assert test_mat[0][1] == 1
assert test_mat[0][2] == 2
assert test_mat[0][3] == 3
assert test_mat[1][0] == 4
assert test_mat[1][1] == 5
assert test_mat[1][2] == 6
assert test_mat[1][3] == 7
assert test_mat[2][0] == 8
assert test_mat[2][1] == 9
assert test_mat[2][2] == 10
assert test_mat[2][3] == 11
assert test_mat[3][0] == 12
assert test_mat[3][1] == 13
assert test_mat[3][2] == 14
assert test_mat[3][3] == 15
def __testMatrix33SetTransposePtr(self, matType, dataType):
mat33 = [
dataType(0.0), dataType(1.0), dataType(2.0),
dataType(3.0), dataType(4.0), dataType(5.0),
dataType(6.0), dataType(7.0), dataType(8.0)
]
test_mat = matType()
test_mat.setTranspose(mat33)
assert test_mat[0][0] == 0
assert test_mat[0][1] == 1
assert test_mat[0][2] == 2
assert test_mat[1][0] == 3
assert test_mat[1][1] == 4
assert test_mat[1][2] == 5
assert test_mat[2][0] == 6
assert test_mat[2][1] == 7
assert test_mat[2][2] == 8
def testMatrixSetTransposePtr(self):
self.__testMatrix44SetTransposePtr(gmtl.Matrix44f, float)
self.__testMatrix33SetTransposePtr(gmtl.Matrix33f, float)
def testMatrix44Creation(self):
src_mat = gmtl.Matrix44f()
src_mat.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
assert src_mat[0][0] == 0
assert src_mat[1][0] == 4
assert src_mat[2][0] == 8
assert src_mat[3][0] == 12
assert src_mat[0][1] == 1
assert src_mat[1][1] == 5
assert src_mat[2][1] == 9
assert src_mat[3][1] == 13
assert src_mat[0][2] == 2
assert src_mat[1][2] == 6
assert src_mat[2][2] == 10
assert src_mat[3][2] == 14
assert src_mat[0][3] == 3
assert src_mat[1][3] == 7
assert src_mat[2][3] == 11
assert src_mat[3][3] == 15
def testMatrix33Creation(self):
src_mat = gmtl.Matrix33f()
src_mat.set(0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0)
assert src_mat[0][0] == 0
assert src_mat[1][0] == 3
assert src_mat[2][0] == 6
assert src_mat[0][1] == 1
assert src_mat[1][1] == 4
assert src_mat[2][1] == 7
assert src_mat[0][2] == 2
assert src_mat[1][2] == 5
assert src_mat[2][2] == 8
class MatrixClassMetricTest(unittest.TestCase):
def testTimingDefaultConstructor(self):
iters = 25000
use_value = 0.0
for iter in xrange(iters):
test_mat33 = gmtl.Matrix33f()
test_mat33[1][1] = 2.0
test_mat44 = gmtl.Matrix44f()
test_mat44[3][3] = 3.0
use_value = use_value + test_mat33.data[4] + test_mat44.data[15]
assert use_value > 0.0
def testTimingCopyConstructor(self):
src_mat33 = gmtl.Matrix33f()
src_mat33[1][1] = 2.0
src_mat44 = gmtl.Matrix44f()
src_mat44[3][3] = 3.0
iters = 25000
for iter in xrange(iters):
test_mat33 = gmtl.Matrix33f(src_mat33)
test_mat44 = gmtl.Matrix44f(src_mat44)
test_mat33[1][1] = 2.0
test_mat44[3][3] = 3.0
def testTimingOpEqual(self):
src_mat33 = gmtl.Matrix33f()
src_mat33[1][1] = 2.0
src_mat44 = gmtl.Matrix44f()
src_mat44[3][3] = 3.0
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
test_mat33 = src_mat33
test_mat44 = src_mat44
def testTimingOpParen(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
# Note: gmtl.Matrix*.__call__ returns a read-only value.
test_mat33(1, 1)
test_mat44(3, 3)
def testTimingOpBracket(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
test_mat33[1][1] = 0.0
test_mat44[3][3] = 0.0
def testTimingSetPtr(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
test_mat33.set(gmtl.Matrix33f().getData())
test_mat44.set(gmtl.Matrix44f().getData())
def testTimingSetTransposePtr(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
test_mat33.setTranspose(gmtl.Matrix33f().getData())
test_mat44.setTranspose(gmtl.Matrix44f().getData())
def testTimingGetData(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
bok = 0.0
bokk = 0.0
for iter in xrange(iters):
temp2 = test_mat33.getData()
bok += temp2[3]
temp4 = test_mat44.getData()
bokk += temp4[15]
def testTimingSet(self):
iters = 25000
test_mat33 = gmtl.Matrix33f()
test_mat44 = gmtl.Matrix44f()
for iter in xrange(iters):
test_mat33.set(2, 3, 4, 5, 6, 7, 7, 10, 1451235)
test_mat44.set(2, 3, 4, 5, 6, 7, 7, 10, 1451235, 1, 2, 3, 1, 2, 3, 4)
class MatrixCompareTest(unittest.TestCase):
def __testMatEquality(self, matType, dataType):
array = [
dataType(0.78), dataType(1.4), dataType(2.9), dataType(3.45),
dataType(4.21), dataType(57.9), dataType(65.9), dataType(74.6),
dataType(89.2), dataType(99.2), dataType(10.9), dataType(11.9),
dataType(12.5), dataType(13.9), dataType(14.78), dataType(15.6),
dataType(4.21), dataType(57.9), dataType(65.9), dataType(74.6),
dataType(89.2), dataType(99.2), dataType(10.9), dataType(11.9),
dataType(89.2), dataType(99.2), dataType(10.9), dataType(11.9)
]
mat1 = matType()
mat1.set(array)
mat2 = matType()
mat1 = matType(mat2)
assert mat1 == mat2
assert mat2 == mat1
for i in range(matType.Params.Rows):
for j in range(matType.Params.Cols):
mat2[i][j] = dataType(1221.0)
assert mat1 != mat2
assert not mat1 == mat2
mat2[i][j] = mat1[i][j]
# Test for epsilon equals working.
assert gmtl.isEqual(mat1, mat2)
assert gmtl.isEqual(mat1, mat2, dataType(0.0))
assert gmtl.isEqual(mat2, mat1, dataType(0.0))
assert gmtl.isEqual(mat2, mat1, dataType(100000))
eps = dataType(10.0)
for i in range(matType.Params.Rows):
for j in range(matType.Params.Cols):
mat2[i][j] = mat1[i][j] - (eps / dataType(2.0))
assert gmtl.isEqual(mat1, mat2, eps)
assert not gmtl.isEqual(mat1, mat2, dataType(eps / 3.0))
mat2[i][j] = mat1[i][j]
def testMatEqualityFloatTest(self):
self.__testMatEquality(gmtl.Matrix44f, float)
self.__testMatEquality(gmtl.Matrix33f, float)
# def testMatEqualityDoubleTest(self):
# self.__testMatEquality(gmtl.Matrix44d, double)
# self.__testMatEquality(gmtl.Matrix33d, double)
# def testMatEqualityIntTest(self):
# self.__testMatEquality(gmtl.Matrix44i, int)
# self.__testMatEquality(gmtl.Matrix33i, int)
class MatrixCompareMetricTest(unittest.TestCase):
def testMatTimingOpEqualityTest(self):
iters = 25000
src_mat33 = gmtl.Matrix33f()
src_mat44 = gmtl.Matrix44f()
# Half will be equal.
src_mat33[1][1] = 2.0
test_mat33 = gmtl.Matrix33f(src_mat33)
test_mat44 = gmtl.Matrix44f(src_mat44)
# Half will be unequal.
src_mat44[3][3] = 3.0
true_count = 0
for iter in xrange(iters):
if src_mat33 == test_mat33:
true_count += 1
if src_mat44 == test_mat44:
true_count += 1
assert true_count > 0
def testMatTimingOpNotEqualityTest(self):
iters = 25000
src_mat33 = gmtl.Matrix33f()
src_mat44 = gmtl.Matrix44f()
# Half will be equal.
src_mat33[1][1] = 2.0
test_mat33 = gmtl.Matrix33f(src_mat33)
test_mat44 = gmtl.Matrix44f(src_mat44)
# Half will be unequal.
src_mat44[3][3] = 3.0
true_count = 0
for iter in xrange(iters):
if src_mat33 != test_mat33:
true_count += 1
if src_mat44 != test_mat44:
true_count += 1
assert true_count > 0
def testMatTimingIsEqualTest(self):
iters = 25000
src_mat33 = gmtl.Matrix33f()
src_mat44 = gmtl.Matrix44f()
# Half will be equal.
src_mat33[1][1] = 2.0
test_mat33 = gmtl.Matrix33f(src_mat33)
test_mat44 = gmtl.Matrix44f(src_mat44)
# Half will be unequal.
src_mat44[3][3] = 3.0
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(src_mat33, test_mat33):
true_count += 1
if gmtl.isEqual(src_mat44, test_mat44):
true_count += 1
assert true_count > 0
class MatrixGenTest(unittest.TestCase):
def testMatrixsetViewing(self):
mat = gmtl.Matrix44f()
gmtl.setFrustum(mat, -1.0, 1.0, 1.0, -1.0, 0.02, 100.0)
data = [
0.02, 0.0, 0.0, 0.0,
0.0, 0.02, 0.0, 0.0,
0.0, 0.0, -1.0004, -0.040008,
0.0, 0.0, -1.0, 0.0
]
expected = gmtl.Matrix44f()
expected.setTranspose(data)
assert gmtl.isEqual(expected, mat, 0.001)
mat = gmtl.Matrix44f()
gmtl.setPerspective(mat, 89.0, 1.33, 0.001, 1000.0)
data = [
0.765118, 0.0, 0.0, 0.0,
0.0, 1.01761, 0.0, 0.0,
0.0, 0.0, -1.0, -0.002,
0.0, 0.0, -1.0, 0.0
]
expected = gmtl.Matrix44f()
expected.setTranspose(data)
assert gmtl.isEqual(expected, mat, 0.001)
def testMatrixsetTrans(self):
eps = 0.001
# 2D rot/trans/skew.
mat33 = gmtl.Matrix33f()
trans_vec = gmtl.Vec2f(32.0, 33.0)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 32.0,
0.0, 1.0, 33.0,
0.0, 0.0, 1.0)
gmtl.setTrans(mat33, trans_vec)
assert gmtl.isEqual(expected_result33, mat33, eps)
test_trans_vec = gmtl.makeTransVec2(mat33)
assert test_trans_vec == trans_vec
# 2D rot/trans/skew by homogeneous vector.
mat33 = gmtl.Matrix33f()
trans_vec = gmtl.Vec3f(32.0, 33.0, 0.5)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 64.0,
0.0, 1.0, 66.0,
0.0, 0.0, 1.0)
gmtl.setTrans(mat33, trans_vec)
assert gmtl.isEqual(expected_result33, mat33, eps)
test_trans_vec = gmtl.makeTransVec3(mat33)
assert test_trans_vec == gmtl.Vec3f(64.0, 66.0, 1.0)
# 3D rot/trans/skew.
mat44 = gmtl.Matrix44f()
expected_result44 = gmtl.Matrix44f()
expected_result44.set(1.0, 0.0, 0.0, 32.0,
0.0, 1.0, 0.0, 33.0,
0.0, 0.0, 1.0, 34.0,
0.0, 0.0, 0.0, 1.0)
gmtl.setTrans(mat44, gmtl.Vec3f(32.0, 33.0, 34.0))
assert gmtl.isEqual(expected_result44, mat44, eps)
# 3D rot/trans/skew by homogeneous vector.
mat44 = gmtl.Matrix44f()
expected_result44 = gmtl.Matrix44f()
expected_result44.set(1.0, 0.0, 0.0, 64.0,
0.0, 1.0, 0.0, 66.0,
0.0, 0.0, 1.0, 68.0,
0.0, 0.0, 0.0, 1.0)
gmtl.setTrans(mat44, gmtl.Vec4f(32.0, 33.0, 34.0, 0.5))
assert gmtl.isEqual(expected_result44, mat44, eps)
# Test standalone makeTrans(trans) against setTrans(mat, trans).
expected_mat = gmtl.Matrix44f()
trans3 = gmtl.Vec3f(1.0, 2.0, 3.0)
gmtl.setTrans(expected_mat, trans3)
assert gmtl.isEqual(gmtl.makeTransMatrix44(trans3), expected_mat, eps)
def testMatrixsetAxes(self):
eps = 0.001
a = 98234576.0
mat33 = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat33.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, 1.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, -1.0)
gmtl.setAxes(mat33, gmtl.Vec3f(0.0, 1.0, 0.0), gmtl.Vec3f(1.0, 0.0, 0.0),
gmtl.Vec3f(0.0, 0.0, -1.0))
assert gmtl.isEqual(expected_result33, mat33, eps)
test_mat = gmtl.makeAxesMatrix33(gmtl.Vec3f(0.0, 1.0, 0.0),
gmtl.Vec3f(1.0, 0.0, 0.0),
gmtl.Vec3f(0.0, 0.0, -1.0))
assert test_mat == mat33
mat44 = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat44.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(0.0, 1.0, 0.0, a,
1.0, 0.0, 0.0, a,
0.0, 0.0, -1.0, a,
a, a, a, a)
gmtl.setAxes(mat44, gmtl.Vec3f(0.0, 1.0, 0.0), gmtl.Vec3f(1.0, 0.0, 0.0),
gmtl.Vec3f(0.0, 0.0, -1.0))
assert gmtl.isEqual(expected_result44, mat44, eps)
# Make sure make and set are the same.
new_mat = gmtl.Matrix44f()
gmtl.setAxes(new_mat, gmtl.Vec3f(0.0, 1.0, 0.0),
gmtl.Vec3f(1.0, 0.0, 0.0), gmtl.Vec3f(0.0, 0.0, -1.0))
test_mat = gmtl.makeAxesMatrix44(gmtl.Vec3f(0.0, 1.0, 0.0),
gmtl.Vec3f(1.0, 0.0, 0.0),
gmtl.Vec3f(0.0, 0.0, -1.0))
assert test_mat == new_mat
def testMatrixsetDirCos(self):
eps = 0.01
# Two points that should match in different frames.
pt_I = gmtl.Point3f(1.0, 0.0, 0.0) # Point in identity frame
pt_T = gmtl.Point3f(0.0, 0.0, 1.0) # Point in the transformed frame
# Basis vectors of the T coordinate frame in the I coordinate frame.
x_axis = gmtl.Vec3f(0.0, 1.0, 0.0)
y_axis = gmtl.Vec3f(0.0, 0.0, 1.0)
z_axis = gmtl.Vec3f(1.0, 0.0, 0.0)
# Build the transformation matrix.
i_M_t = gmtl.makeDirCosMatrix44(x_axis, y_axis, z_axis)
# Test point going from T to I.
result_pt = i_M_t * pt_T
assert gmtl.isEqual(result_pt, pt_I, eps)
# Test point going from I to T.
result_pt = gmtl.makeInvert(i_M_t) * pt_I
assert gmtl.isEqual(result_pt, pt_T, eps)
def testMatrixsetScale(self):
eps = 0.001
a = 98234576.0
# 2D rot/trans/skew.
mat33 = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat33.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(32.0, a, a,
a, 33.0, a,
a, a, a)
gmtl.setScale(mat33, gmtl.Vec2f(32.0, 33.0))
assert gmtl.isEqual(expected_result33, mat33, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix33f()
gmtl.setScale(new_mat, gmtl.Vec2f(32.0, 33.0))
assert gmtl.makeScaleMatrix33(gmtl.Vec2f(32.0, 33.0)) == new_mat
# 3D rot/trans/skew.
mat44 = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat44.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(32.0, a, a, a,
a, 33.0, a, a,
a, a, 34.0, a,
a, a, a, a)
gmtl.setScale(mat44, gmtl.Vec3f(32.0, 33.0, 34.0))
assert gmtl.isEqual(expected_result44, mat44, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix44f()
gmtl.setScale(new_mat, gmtl.Vec3f(32.0, 33.0, 34.0))
assert gmtl.makeScaleMatrix44(gmtl.Vec3f(32.0, 33.0, 34.0)) == new_mat
# 2D rot/trans/skew.
mat33 = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat33.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(32.0, a, a,
a, 32.0, a,
a, a, a)
gmtl.setScale(mat33, 32.0)
assert gmtl.isEqual(expected_result33, mat33, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix33f()
gmtl.setScale(new_mat, 32.0)
assert gmtl.makeScaleMatrix33(32.0) == new_mat
# 3D rot/trans/skew.
mat44 = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat44.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(32.0, a, a, a,
a, 32.0, a, a,
a, a, 32.0, a,
a, a, a, a)
gmtl.setScale(mat44, 32.0)
assert gmtl.isEqual(expected_result44, mat44, eps)
# MAke sure set and make are the same.
new_mat = gmtl.Matrix44f()
gmtl.setScale(new_mat, 32.0)
assert gmtl.makeScaleMatrix44(32.0) == new_mat
def testMatrixsetRot(self):
eps = 0.01
a = 98234576.0
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 0.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0)
vec = gmtl.Vec3f(1.0, 0.0, 0.0)
gmtl.normalize(vec)
gmtl.setRot(mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), vec))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure that the other version works the same.
mat2 = gmtl.Matrix33f()
gmtl.setRot(mat2, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
1.0, 0.0, 0.0)))
assert gmtl.isEqual(mat2, mat, eps)
# Make sure set and make are the smae.
mat3 = gmtl.makeRotMatrix33(gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
1.0, 0.0, 0.0)))
assert mat3 == mat2
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0)
vec = gmtl.Vec3f(-1.0, 1.0, -1.0)
gmtl.normalize(vec)
gmtl.setRot(mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(-360.0), vec))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure that the other version works the same.
mat2 = gmtl.Matrix33f()
gmtl.setRot(mat2,
gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(-360.0),
-1.0, 1.0, -1.0)))
assert gmtl.isEqual(mat2, mat, eps)
# Make sure set and make are the smae.
mat3 = gmtl.makeRotMatrix33(gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(-360.0),
-1.0, 1.0, -1.0)))
assert gmtl.isEqual(mat3, mat2, eps)
mat3 = gmtl.makeRotMatrix33(gmtl.AxisAnglef(gmtl.Math.deg2Rad(-360.0),
vec))
assert gmtl.isEqual(mat3, mat2, eps)
# Test that unnormalized vedc works.
mat = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(0.804738, -0.310617, 0.505879, a,
0.505879, 0.804738, -0.310617, a,
-0.310617, 0.505879, 0.804738, a,
a, a, a, a)
vec = gmtl.Vec3f(1.7, 1.7, 1.7)
gmtl.normalize(vec)
gmtl.setRot(mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), vec))
assert gmtl.isEqual(expected_result44, mat, eps)
# Make sure that the other version works the same.
mat2 = gmtl.Matrix44f()
mat2.set(data)
gmtl.setRot(mat2, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0),
1.7, 1.7, 1.7)))
assert gmtl.isEqual(mat2, mat, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix44f()
gmtl.setRot(new_mat,
gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0),
1.7, 1.7, 1.7)))
assert gmtl.makeRotMatrix44(gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0),
1.7, 1.7, 1.7))) == new_mat
gmtl.setRot(new_mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), vec))
assert gmtl.makeRotMatrix44(gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), vec)) == new_mat
# Test standalone now.
mat = gmtl.Matrix44f()
rot_axis = gmtl.Vec3f(1.0, 2.0, 3.0)
gmtl.normalize(rot_axis)
axis_angle = gmtl.AxisAnglef(1.1, rot_axis)
expected_mat = gmtl.Matrix44f()
gmtl.setRot(expected_mat, axis_angle)
mat = gmtl.makeRotMatrix44(axis_angle)
assert gmtl.isEqual(mat, expected_mat, eps)
assert gmtl.isEqual(gmtl.makeRotMatrix44(axis_angle), expected_mat, eps)
def testMatrixgetRotEuler(self):
eps = 0.01
matrix = gmtl.Matrix44f()
# XYZ
euler = gmtl.EulerAngleXYZf()
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 90.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 0.0, eps)
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(-90.0), 1.0, 0.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), -90.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 0.0, eps)
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(35.0), 0.0, 1.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 35.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 0.0, eps)
# Test cos y = 0 singularity.
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 1.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), -180.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 90.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), -180.0, eps)
# Test cos z = 0 singularity.
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 0.0, 1.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 90.0, eps)
# ZYX
euler = gmtl.EulerAngleZYXf()
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 90.0, eps)
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(-90.0), 1.0, 0.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 0.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), -90.0, eps)
# Test sin x = 0 singularity.
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 0.0, 1.0))
gmtl.set(euler, matrix)
# assert isEqual(gmtl.Math.rad2Deg(euler[0]), 0.0, eps)
# assert isEqual(gmtl.Math.rad2Deg(euler[1]), 35.0, eps)
# assert isEqual(gmtl.Math.rad2Deg(euler[2]), 0.0, eps)
# Test cos y = 0 singularity.
gmtl.set(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 1.0, 0.0))
gmtl.set(euler, matrix)
assert isEqual(gmtl.Math.rad2Deg(euler[0]), 180.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[1]), 90.0, eps)
assert isEqual(gmtl.Math.rad2Deg(euler[2]), 180.0, eps)
def testMatrixsetRotEuler(self):
eps = 0.001
a = 98234576.0
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.683013, -0.183013, 0.707107,
0.683013, -0.183013, -0.707107,
0.258819, 0.965926, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(45.0),
gmtl.Math.deg2Rad(15.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 0.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0))) == mat
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, 0.0, 1.0,
0.0, 1.0, 0.0,
-1.0, 0.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0))) == mat
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, -1.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, 1.0)
gmtl.setRot(mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0))) == mat
mat = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(0.697193, 0.0121696, 0.71678, a,
-0.275553, -0.918494, 0.283617, a,
0.66181, -0.395247, -0.637014, a,
a, a, a, a)
gmtl.setRot(mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0)))
assert gmtl.isEqual(expected_result44, mat, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix44f()
gmtl.setRot(new_mat, gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0)))
assert gmtl.makeRotMatrix44(gmtl.EulerAngleXYZf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0))) == new_mat
# ZYX.
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, -0.965926, 0.258819,
0.707107, 0.183013, 0.683013,
-0.707107, 0.183013, 0.683013)
gmtl.setRot(mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(45.0),
gmtl.Math.deg2Rad(15.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(45.0),
gmtl.Math.deg2Rad(15.0))) == mat
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, -1.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, 1.0)
gmtl.setRot(mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix33f()
gmtl.setRot(new_mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.makeRotMatrix33(gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0))) == new_mat
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, 0.0, 1.0,
0.0, 1.0, 0.0,
-1.0, 0.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0))) == mat
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 0.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
# Make sure set and make are the same.
assert gmtl.makeRotMatrix33(gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0))) == mat
mat = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(-0.637014, 0.418103, -0.647613, a,
-0.283617, -0.908318, -0.30744, a,
-0.71678, -0.0121696, 0.697193, a,
a, a, a, a)
gmtl.setRot(mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0)))
assert gmtl.isEqual(expected_result44, mat, eps)
# Make sure set and make are the same.
new_mat = gmtl.Matrix44f()
gmtl.setRot(new_mat, gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0)))
assert gmtl.makeRotMatrix44(gmtl.EulerAngleZYXf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0))) == new_mat
# ZXY.
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(-0.183013, -0.707107, 0.683013,
0.965926, 0.0, 0.258819,
-0.183013, 0.707107, 0.683013)
gmtl.setRot(mat, gmtl.EulerAngleZXYf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(45.0),
gmtl.Math.deg2Rad(15.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, -1.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, 1.0)
gmtl.setRot(mat, gmtl.EulerAngleZXYf(gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(1.0, 0.0, 0.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleZXYf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0),
gmtl.Math.deg2Rad(0.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
mat = gmtl.Matrix33f()
data = []
for i in range(9):
data.append(a)
mat.set(data)
expected_result33 = gmtl.Matrix33f()
expected_result33.set(0.0, 0.0, 1.0,
0.0, 1.0, 0.0,
-1.0, 0.0, 0.0)
gmtl.setRot(mat, gmtl.EulerAngleZXYf(gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(0.0),
gmtl.Math.deg2Rad(90.0)))
assert gmtl.isEqual(expected_result33, mat, eps)
mat = gmtl.Matrix44f()
data = []
for i in range(16):
data.append(a)
mat.set(data)
expected_result44 = gmtl.Matrix44f()
expected_result44.set(-0.918494, 0.283617, -0.275553, a,
-0.395247, -0.637014, 0.66181, a,
0.0121696, 0.71678, 0.697193, a,
a, a, a, a)
gmtl.setRot(mat, gmtl.EulerAngleZXYf(gmtl.Math.deg2Rad(-156.0),
gmtl.Math.deg2Rad(45.7892892),
gmtl.Math.deg2Rad(-361.0)))
assert gmtl.isEqual(expected_result44, mat, eps)
# Test standalone setRot(val, val, val) against setRot(mat, val, val, val)
expected_mat = gmtl.Matrix44f()
gmtl.setRot(expected_mat, gmtl.EulerAngleXYZf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix44(gmtl.EulerAngleXYZf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
gmtl.setRot(expected_mat, gmtl.EulerAngleZXYf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix44(gmtl.EulerAngleZXYf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
gmtl.setRot(expected_mat, gmtl.EulerAngleZYXf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix44(gmtl.EulerAngleZYXf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
expected_mat = gmtl.Matrix33f()
gmtl.setRot(expected_mat, gmtl.EulerAngleXYZf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix33(gmtl.EulerAngleXYZf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
gmtl.setRot(expected_mat, gmtl.EulerAngleZXYf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix33(gmtl.EulerAngleZXYf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
gmtl.setRot(expected_mat, gmtl.EulerAngleZYXf(0.1, 2.3, -2.1))
mat = gmtl.makeRotMatrix33(gmtl.EulerAngleZYXf(0.1, 2.3, -2.1))
assert gmtl.isEqual(mat, expected_mat, eps)
def __matMakeInverse(self, matType):
eps = 0.001
mat1 = matType()
mat1.set(0.78, 1.4, 2.9, 3.45,
4.21, 57.9, 65.9, 74.6,
89.2, 99.2, 10.9, 11.9,
12.5, 13.9, 14.78, 15.6)
expected_value = matType()
expected_value.set( 0.3071733, -0.0239700, 0.0034853, 0.0440345,
-0.2891106, 0.0216826, 0.0079218, -0.0457924,
-3.0532152, 0.0305681, -0.0547335, 0.5708037,
2.9041982, -0.0290744, 0.0420053, -0.4711792)
identity = matType()
# Make sure our pre-computed answer is right.
result = matType()
gmtl.mult(result, mat1, expected_value)
assert gmtl.isEqual(result, identity, eps)
# Test inversion.
result = gmtl.makeInvert(mat1)
assert gmtl.isEqual(result, expected_value, eps)
def testMatrixmakeInverse(self):
self.__matMakeInverse(gmtl.Matrix44f)
# self.__matMakeInverse(gmtl.Matrix44d)
class MatrixGenMetricTest(unittest.TestCase):
def testTimingsetTrans(self):
mat33 = gmtl.Matrix33f()
mat44 = gmtl.Matrix44f()
a = 1.0
iters = 25000
# 2D translation.
for iter in xrange(iters):
gmtl.setTrans(mat33, gmtl.Vec2f(a, 2.0))
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setTrans(mat33, gmtl.Vec3f(1.0, a, 1.0)) # homogeneous
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.321
# 3D translation.
for iter in xrange(iters):
gmtl.setTrans(mat44, gmtl.Vec3f(30.0, a, 121.0))
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setTrans(mat44, gmtl.Vec4f(30.0, 32.0, a, 1.0)) # homogeneous
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.321
def testTimingsetScale(self):
a = 2.1
mat33 = gmtl.Matrix33f()
mat44 = gmtl.Matrix44f()
iters = 25000
for iter in xrange(iters):
gmtl.setScale(mat33, gmtl.Vec2f(a, 2.0))
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setScale(mat44, gmtl.Vec3f(30.0, 32.0, a))
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setScale(mat33, a)
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setScale(mat44, a)
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.321
def testTimingsetRot33(self):
mat = gmtl.Matrix33f()
a = 0.0
iters = 25000
for iter in xrange(iters):
gmtl.setRot(mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(a), 1.0, 0.0, 0.0))
a += mat.data[3]
assert mat.data[3] != 1234.0456 and a != 987654.321
def testTimingsetRot44(self):
mat = gmtl.Matrix44f()
a = 0.0
iters = 25000
for iter in xrange(iters):
gmtl.setRot(mat, gmtl.AxisAnglef(gmtl.Math.deg2Rad(a), 1.0, 0.0, 0.0))
a += mat.data[3]
assert mat.data[3] != 1234.0456 and a != 987654.321
def testTimingGetRot(self):
pass
def __testTimingsetRotEuler(self, mat):
a = 0.0
iters = 25000
for iter in xrange(iters):
gmtl.setRot(mat, gmtl.EulerAngleZXYf(a, 45.0, 35.0))
a -= mat.data[4]
assert mat.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setRot(mat, gmtl.EulerAngleZYXf(a, 45.0, 35.0))
a += mat.data[4]
assert mat.data[3] != 1234.0456 and a != 987654.321
for iter in xrange(iters):
gmtl.setRot(mat, gmtl.EulerAngleXYZf(a, 45.0, 35.0))
a -= mat.data[4]
assert mat.data[3] != 1234.0456 and a != 987654.321
def testTimingsetRotEuler33(self):
self.__testTimingsetRotEuler(gmtl.Matrix33f())
# def testTimingsetRotEuler34(self):
# self.__testTimingsetRotEuler(gmtl.Matrix34f())
def testTimingsetRotEuler44(self):
self.__testTimingsetRotEuler(gmtl.Matrix44f())
def __testTimingsetDirCos(self, mat):
a = 0.0
iters = 25000
for iter in xrange(iters):
gmtl.setDirCos(mat, gmtl.Vec3f(1.0, 0.0, 0.0),
gmtl.Vec3f(a, 1.0, 0.0), gmtl.Vec3f(0.0, 0.0, 1.0))
a += mat.data[1]
assert mat.data[3] != 1234.0456 and a != 987654.321
def testTimingsetDirCos33(self):
self.__testTimingsetDirCos(gmtl.Matrix33f())
# def testTimingsetDirCos34(self):
# self.__testTimingsetDirCos(gmtl.Matrix34f())
def testTimingsetDirCos44(self):
self.__testTimingsetDirCos(gmtl.Matrix44f())
def __testTimingsetAxes(self, mat):
a = 0.0
iters = 25000
for iter in xrange(iters):
gmtl.setAxes(mat, gmtl.Vec3f(1.0, a, 0.0), gmtl.Vec3f(0.0, 1.0, 0.0),
gmtl.Vec3f(0.0, 0.0, 1.0))
a += mat.data[1]
assert mat.data[3] != 1234.0456 and a != 987654.321
def testTimingsetAxes33(self):
self.__testTimingsetAxes(gmtl.Matrix33f())
# def testTimingsetAxes34(self):
# self.__testTimingsetAxes(gmtl.Matrix34f())
def testTimingsetAxes44(self):
self.__testTimingsetAxes(gmtl.Matrix44f())
class MatrixOpsTest(unittest.TestCase):
def testMatrixIdentity(self):
ident_mat = gmtl.Matrix44f()
test_mat = gmtl.Matrix44f()
test_mat.set(0.0, 1.0, 2.0, 3.0,
0.0, 1.0, 2.0, 3.0,
0.0, 1.0, 2.0, 3.0,
0.0, 1.0, 2.0, 3.0)
assert test_mat != ident_mat
gmtl.identity(test_mat)
assert test_mat == ident_mat
def testMatrixSetTrans(self):
eps = 0.01
# 3D trans.
mat44 = gmtl.Matrix44f()
expected_result44 = gmtl.Matrix44f()
gmtl.setRot(expected_result44, gmtl.EulerAngleXYZf(0.5, 1.0, -1.0))
expected_result44[0][3] = 21
expected_result44[1][3] = 22
expected_result44[2][3] = 23
gmtl.setRot(mat44, gmtl.EulerAngleXYZf(0.5, 1.0, -1.0))
gmtl.setTrans(mat44, gmtl.Vec3f(21.0, 22.0, 23.0))
assert gmtl.isEqual(expected_result44, mat44, eps)
# 3D rot/trans/skew set by homogeneous vector.
mat44 = gmtl.Matrix44f()
expected_result44 = gmtl.Matrix44f()
gmtl.setRot(expected_result44, gmtl.EulerAngleXYZf(0.5, 1.0, -1.0))
expected_result44[0][3] = 42
expected_result44[1][3] = 44
expected_result44[2][3] = 46
gmtl.setRot(mat44, gmtl.EulerAngleXYZf(0.5, 1.0, -1.0))
gmtl.setTrans(mat44, gmtl.Vec4f(21.0, 22.0, 23.0, 0.5))
assert gmtl.isEqual(expected_result44, mat44, eps)
def __transposeTest(self, matType):
test_mat = matType()
res_mat = matType()
test_mat[test_mat.Params.Rows - 1][0] = 9
res_mat[0][test_mat.Params.Rows - 1] = 9
test_mat[1][0] = 2
res_mat[0][1] = 2
gmtl.transpose(res_mat)
assert res_mat == test_mat
gmtl.transpose(res_mat)
# Test the other transpose op.
gmtl.transpose(res_mat, res_mat)
assert res_mat == test_mat
def testMatrixTranspose(self):
test_mat = gmtl.Matrix33f()
res_mat = gmtl.Matrix33f()
test_mat.set(0.0, 1.0, 2.0,
4.0, 5.0, 6.0,
8.0, 9.0, 10.0)
res_mat.set(0.0, 4.0, 8.0,
1.0, 5.0, 9.0,
2.0, 6.0, 10.0)
gmtl.transpose(res_mat)
assert res_mat == test_mat
gmtl.transpose(res_mat)
gmtl.transpose(res_mat, res_mat)
assert res_mat == test_mat
test_mat = gmtl.Matrix44f()
res_mat = gmtl.Matrix44f()
test_mat.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
res_mat.set(0.0, 4.0, 8.0, 12.0,
1.0, 5.0, 9.0, 13.0,
2.0, 6.0, 10.0, 14.0,
3.0, 7.0, 11.0, 15.0)
gmtl.transpose(res_mat)
assert res_mat == test_mat
gmtl.transpose(res_mat)
gmtl.transpose(res_mat, res_mat)
assert res_mat == test_mat
self.__transposeTest(gmtl.Matrix33f)
self.__transposeTest(gmtl.Matrix44f)
def testMatrixAddSub33(self):
test_mat1 = gmtl.Matrix33f()
res_mat = gmtl.Matrix33f()
ans_mat = gmtl.Matrix33f()
test_mat1.set(0.0, 1.0, 2.0,
4.0, 5.0, 6.0,
8.0, 9.0, 10.0)
test_mat2 = gmtl.Matrix33f(test_mat1)
ans_mat.set(0.0, 2.0, 4.0,
8.0, 10.0, 12.0,
16.0, 18.0, 20.0)
gmtl.add(res_mat, test_mat1, test_mat2) # rm = m1 + m2
assert res_mat == ans_mat
diff_mat = gmtl.Matrix33f()
gmtl.sub(diff_mat, res_mat, test_mat1) # rm = m1 - m2
assert diff_mat != res_mat
assert diff_mat == test_mat2
test_mat1 = gmtl.Matrix44f()
res_mat = gmtl.Matrix44f()
ans_mat = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
ans_mat.set(0.0, 2.0, 4.0, 6.0,
8.0, 10.0, 12.0, 14.0,
16.0, 18.0, 20.0, 22.0,
24.0, 26.0, 28.0, 30.0)
gmtl.add(res_mat, test_mat1, test_mat2) # rm = m1 + m2
assert res_mat == ans_mat
diff_mat = gmtl.Matrix44f()
gmtl.sub(diff_mat, res_mat, test_mat1) # rm = m1 - m2
assert diff_mat != res_mat
assert diff_mat == test_mat2
def testMatrixMult33(self):
mat1 = gmtl.Matrix33f()
mat2 = gmtl.Matrix33f()
eps = 0.001
mat1.set(1.1000, 2.2000, 3.3000,
5.5000, 6.6000, 7.7000,
9.9000, 10.1000, 11.1100)
mat2.set(43.0, -8.0, -4.0,
23.0, 22.0, 72.0,
-34.0, -23.0, 99.0)
# Make sure mat3 = mat1 * mat2 yields the correct result.
mat3 = gmtl.Matrix33f()
gmtl.mult(mat3, mat1, mat2)
res_mat = gmtl.Matrix33f()
res_mat.set(-14.300, -36.300, 480.700,
126.500, -75.900, 1215.500,
280.260, -112.530, 1787.490)
assert gmtl.isEqual(res_mat, mat3, eps)
# Test post and pre mult operators.
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
gmtl.postMult(m1, m2)
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
m1 *= m2
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
gmtl.preMult(m2, m1)
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
result = mat1 * mat2
assert gmtl.isEqual(res_mat, result, eps)
# Make sure mult is not commutitive.
gmtl.mult(mat3, mat2, mat1)
assert not gmtl.isEqual(res_mat, mat3, eps)
# Make sure mat3 = mat2 * mat1 yields the correct result.
res_mat.set(-36.3000, 1.4000, 35.8600,
859.1000, 923.0000, 1045.2200,
816.2000, 773.3000, 810.5900)
assert gmtl.isEqual(res_mat, mat3, eps)
# Test post and pre mult operators.
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
gmtl.postMult(m2, m1)
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
m2 *= m1
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
gmtl.preMult(m1, m2)
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix33f(mat1)
m2 = gmtl.Matrix33f(mat2)
result = mat2 * mat1
assert gmtl.isEqual(res_mat, result, eps)
def testMatrixMult44(self):
mat1 = gmtl.Matrix44f()
mat2 = gmtl.Matrix44f()
eps = 0.001
mat1.set( 1.1000, 2.2000, 3.3000, 4.4000,
5.5000, 6.6000, 7.7000, 8.8000,
9.9000, 10.1000, 11.1100, 12.1200,
13.1300, 14.1400, 15.1500, 16.1600)
mat2.set( 43, -8, -4, 7,
23, 22, 72, 69,
-34, -23, 99, -48,
12, 16, 21, 18)
# Make sure mat3 = mat1 * mat2 yields the correct result.
mat3 = gmtl.Matrix44f()
gmtl.mult(mat3, mat1, mat2)
res_mat = gmtl.Matrix44f()
res_mat.set( 38.500, 34.100, 573.100, 80.300,
232.100, 64.900, 1400.300, 282.700,
425.700, 81.390, 2042.010, 451.080,
568.630, 116.150, 2804.770, 631.250)
assert gmtl.isEqual(res_mat, mat3, eps)
# Test post and pre mult operators.
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
gmtl.postMult(m1, m2)
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
m1 *= m2
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
gmtl.preMult(m2, m1)
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
result = mat1 * mat2
assert gmtl.isEqual(res_mat, result, eps)
# Make sure mult is not commutitive.
gmtl.mult(mat3, mat2, mat1)
assert not gmtl.isEqual(res_mat, mat3, eps)
# Make sure mat3 = mat2 * mat1 yields the correct result.
res_mat.set( 55.610, 100.380, 141.910, 183.440,
1765.070, 1898.660, 2090.570, 2282.480,
185.960, 94.580, 83.390, 72.200,
545.440, 598.620, 668.810, 739.000)
assert gmtl.isEqual(res_mat, mat3, eps)
# Test post and pre mult operators.
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
gmtl.postMult(m2, m1)
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
m2 *= m1
assert gmtl.isEqual(res_mat, m2, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
gmtl.preMult(m1, m2)
assert gmtl.isEqual(res_mat, m1, eps)
m1 = gmtl.Matrix44f(mat1)
m2 = gmtl.Matrix44f(mat2)
result = mat2 * mat1
assert gmtl.isEqual(res_mat, result, eps)
def testMatrixScalarMult44(self):
mat1 = gmtl.Matrix44f()
expected_result = gmtl.Matrix44f()
eps = 0.001
mat1.set( 1.1000, 2.2000, 3.3000, 4.4000,
5.5000, 6.6000, 7.7000, 8.8000,
9.9000, 10.1000, 11.1100, 12.1200,
13.1300, 14.1400, 15.1500, 16.1600)
expected_result.set( 3.3000, 6.6000, 9.9000, 13.2000,
16.5000, 19.8000, 23.1000, 26.4000,
29.7000, 30.3000, 33.3300, 36.3600,
39.3900, 42.4200, 45.4500, 48.4800)
res_mat = gmtl.Matrix44f()
# result = mat * scalar
gmtl.mult(res_mat, mat1, 3)
assert gmtl.isEqual(expected_result, res_mat, eps)
# result *= scalar
res_mat = gmtl.Matrix44f(mat1)
gmtl.mult(res_mat, 3)
assert gmtl.isEqual(expected_result, res_mat, eps)
# result *= scalar
res_mat = gmtl.Matrix44f(mat1)
res_mat *= 3
assert gmtl.isEqual(expected_result, res_mat, eps)
def testMatInvertKnownFull44(self):
mat1 = gmtl.Matrix44f()
expected_value = gmtl.Matrix44f()
mat1.set(0.78, 1.4, 2.9, 3.45,
4.21, 57.9, 65.9, 74.6,
89.2, 99.2, 10.9, 11.9,
12.5, 13.9, 14.78, 15.6)
expected_value.set( 0.3071733, -0.0239700, 0.0034853, 0.0440345,
-0.2891106, 0.0216826, 0.0079218, -0.0457924,
-3.0532152, 0.0305681, -0.0547335, 0.5708037,
2.9041982, -0.0290744, 0.0420053, -0.4711792)
eps = 0.001
result = gmtl.Matrix44f()
identity = gmtl.Matrix44f()
# Make sure our pre-computed answer is right.
gmtl.mult(result, mat1, expected_value)
assert gmtl.isEqual(result, identity, eps)
# Test inversion.
result = gmtl.Matrix44f()
gmtl.invert(result, mat1)
assert gmtl.isEqual(result, expected_value, eps)
# Test inversion in place.
gmtl.invert(mat1)
assert gmtl.isEqual(mat1, expected_value, eps)
def __testMatInvertFull(self, matType):
iters = 100
eps = 0.001
mat = matType()
inv_mat = matType()
expected_mat = matType()
for iter in xrange(iters):
for r in range(mat.Params.Rows):
for c in range(mat.Params.Cols):
mat[r][c] = float(random.randrange(1, 10)) / 10.0
mat.state = matType.XformState.FULL
gmtl.invert(inv_mat, mat)
mult_mat = mat * inv_mat
# This fails sometimes, but I don't know why.
assert gmtl.isEqual(mult_mat, expected_mat, eps)
inv_mat = matType(mat)
gmtl.invert(inv_mat)
assert gmtl.isEqual(mult_mat, expected_mat, eps)
def testMatInvert(self):
eps = 0.001
# Test translation creation and inversion.
trans_range = 100
trans_inc = 10
for x in xrange(-trans_range, trans_range, trans_inc):
for y in xrange(-trans_range, trans_range, trans_inc):
for z in xrange(-trans_range, trans_range, trans_inc):
expected_inv = gmtl.Matrix44f()
expected_inv.set(1.0, 0.0, 0.0, -x,
0.0, 1.0, 0.0, -y,
0.0, 0.0, 1.0, -z,
0.0, 0.0, 0.0, 1.0)
src_mat = gmtl.Matrix44f()
gmtl.setTrans(src_mat, gmtl.Vec3f(x, y, z))
inv_mat = gmtl.Matrix44f()
gmtl.invertFull_GJ(inv_mat, src_mat)
assert gmtl.isEqual(inv_mat, expected_inv, eps)
gmtl.identity(inv_mat)
gmtl.invert(inv_mat, src_mat)
assert gmtl.isEqual(inv_mat, expected_inv, eps)
self.__testMatInvertFull(gmtl.Matrix33f)
self.__testMatInvertFull(gmtl.Matrix44f)
class MatrixOpsMetricTest(unittest.TestCase):
def testMatrixTimeIdentity44f(self):
test_mat = gmtl.Matrix44f()
bogus_value = 0.0
iters = 50000
for iter in xrange(iters):
test_mat.set(0.0, iter + 1, iter +2, iter + 3,
0.0, 1.0, 2.0, 3.0,
0.0, 1.0, 2.0, 3.0,
0.0, 1.0, 2.0, 3.0)
gmtl.identity(test_mat)
bogus_value += test_mat(1, 1) # Should add noe every time
assert isEqual(bogus_value, iters, 0.5)
def testTimingMakeTrans(self):
mat33 = gmtl.Matrix33f()
mat44 = gmtl.Matrix44f()
a = 1.0
iters = 100000
for iter in xrange(iters):
gmtl.setTrans(mat33, gmtl.Vec2f(a, 2.0))
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.311
for iter in xrange(iters):
gmtl.setTrans(mat33, gmtl.Vec3f(1.0, a, 1.0)) # homogeneous
a += mat33.data[3]
assert mat33.data[3] != 1234.0456 and a != 987654.311
for iter in xrange(iters):
gmtl.setTrans(mat44, gmtl.Vec3f(30.0, a, 121.0))
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.311
for iter in xrange(iters):
gmtl.setTrans(mat44, gmtl.Vec4f(30.0, 32.0, a, 1.0)) # homogeneous
a += mat44.data[3]
assert mat44.data[3] != 1234.0456 and a != 987654.311
def testMatrixTimeTranspose44f(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
iters = 50000
for iter in xrange(iters):
gmtl.transpose(test_mat1)
test_mat1[0][2] += test_mat1.data[3]
test_mat1[0][4] += test_mat1.data[1]
assert test_mat1.data[2] != test_mat1.data[0]
def testMatrixTimeMult44_mult(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
res_mat = gmtl.Matrix44f(test_mat2)
iters = 50000
for iter in xrange(iters):
gmtl.mult(res_mat, res_mat, test_mat1)
assert test_mat1.data[2] != test_mat2.data[0]
def testMatrixTimeMult44_operatorStar(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
res_mat = gmtl.Matrix44f(test_mat2)
iters = 50000
for iter in xrange(iters):
res_mat = test_mat1 * res_mat
assert test_mat1.data[2] != test_mat2.data[0]
def testMatrixTimeMult44_operatorStarStar(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
res_mat = gmtl.Matrix44f(test_mat2)
iters = 50000
for iter in xrange(iters):
res_mat = test_mat1 * res_mat * test_mat2
assert test_mat1.data[2] != test_mat2.data[0]
def testMatrixTimeMult33_operatorStarStar(self):
test_mat1 = gmtl.Matrix33f()
test_mat1.set(0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0)
test_mat2 = gmtl.Matrix33f(test_mat1)
res_mat = gmtl.Matrix33f(test_mat2)
iters = 50000
for iter in xrange(iters):
res_mat = test_mat1 * res_mat
assert test_mat1.data[2] != test_mat2.data[0]
def testMatrixTimeAdd44(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
res_mat = gmtl.Matrix44f(test_mat2)
iters = 50000
for iter in xrange(iters):
gmtl.add(res_mat, res_mat, test_mat2)
assert test_mat1.data[2] != test_mat2.data[0]
assert res_mat.data[2] != 1000.0
def testMatrixTimeAdd44(self):
test_mat1 = gmtl.Matrix44f()
test_mat1.set(0.0, 1.0, 2.0, 3.0,
4.0, 5.0, 6.0, 7.0,
8.0, 9.0, 10.0, 11.0,
12.0, 13.0, 14.0, 15.0)
test_mat2 = gmtl.Matrix44f(test_mat1)
res_mat = gmtl.Matrix44f(test_mat2)
iters = 50000
for iter in xrange(iters):
gmtl.sub(res_mat, res_mat, test_mat2)
assert test_mat1.data[2] != test_mat2.data[0]
assert res_mat.data[2] != 1000.0
class MatrixStateTrackingTest(unittest.TestCase):
def testMatrixStateTracking(self):
test_states = [
gmtl.Matrix44f.XformState.IDENTITY,
gmtl.Matrix44f.XformState.TRANS,
gmtl.Matrix44f.XformState.ORTHOGONAL,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
]
# Test combine utility function.
expected = [
gmtl.Matrix44f.XformState.IDENTITY, # ident
gmtl.Matrix44f.XformState.TRANS,
gmtl.Matrix44f.XformState.ORTHOGONAL,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.TRANS, # trans
gmtl.Matrix44f.XformState.TRANS,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.ORTHOGONAL, # ORTHOGONAL
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.ORTHOGONAL,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE, # AFFINE
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.AFFINE,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR, # NON_UNISCALE
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE, # AFFINE | NON_UNISCALE
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.FULL, # FULL
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.FULL,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR, # XFORM_ERROR
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR,
gmtl.Matrix44f.XformState.XFORM_ERROR
]
total = 0
for x in range(len(test_states)):
for y in range(len(test_states)):
assert gmtl.combineMatrixStates(test_states[x], test_states[y]) == expected[total]
total += 1
# Test core matrix class.
# Test default constructor.
mat = gmtl.Matrix44f()
assert mat.state == gmtl.Matrix44f.XformState.IDENTITY
# Test copy constructor.
mat1 = gmtl.Matrix44f()
mat1.state = gmtl.Matrix44f.XformState.FULL
mat2 = gmtl.Matrix44f(mat1)
assert mat2.state == gmtl.Matrix44f.XformState.FULL
# Test set.
mat = gmtl.Matrix44f()
mat.set(range(16))
assert mat.state == gmtl.Matrix44f.XformState.FULL
# Test gmtl.setTranspose()
mat = gmtl.Matrix44f()
gmtl.identity(mat)
assert mat.state == gmtl.Matrix44f.XformState.IDENTITY
# Make sure gmtl.identity() sets the flag when matrix wasn't originally
# identity.
mat.state = gmtl.Matrix44f.XformState.FULL
gmtl.identity(mat)
assert mat.state == gmtl.Matrix44f.XformState.IDENTITY
# Test gmtl.zero().
mat = gmtl.Matrix44f()
gmtl.zero(mat)
# Test composing two matrices.
for x in range(len(test_states)):
for y in range(len(test_states)):
mat1 = gmtl.Matrix44f()
mat2 = gmtl.Matrix44f()
mat1.state = test_states[x]
mat2.state = test_states[y]
# Multiply two matrices using __mult__
result = mat1 * mat2
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
result = mat2 * mat1
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
# Multiply two matrices using gmtl.mult()
gmtl.mult(result, mat1, mat2)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.mult(result, mat2, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
# Multiply two matrices using gmtl.preMult()
result.state = test_states[y]
gmtl.preMult(result, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.preMult(result, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
# Multiply two matrices using gmtl.postMult()
result.state = test_states[y]
gmtl.postMult(result, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.postMult(result, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
# add(res, mat, mat), sub(res, mat, mat)
gmtl.add(result, mat1, mat2)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.add(result, mat2, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.sub(result, mat1, mat2)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
gmtl.sub(result, mat2, mat1)
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
# mutl(res, mat, scalar)
gmtl.mult(result, mat1, 45.0)
assert result.state == mat1.state
# mutl(res, scalar)
result.state = test_states[x]
gmtl.mult(result, 45.0)
assert result.state == test_states[x]
# operator*=(mat, mat)
mat1.state = test_states[x]
result.state = test_states[y]
result *= mat1
assert result.state == gmtl.combineMatrixStates(test_states[x],
test_states[y])
mat1.state = test_states[x]
result.state = test_states[y]
mat1 *= result
# test copying, equality, inequality, isEqual()
mat1 = gmtl.Matrix44f()
result = gmtl.Matrix44f()
mat1.state = gmtl.Matrix44f.XformState.ORTHOGONAL
result.state = gmtl.Matrix44f.XformState.FULL
result = gmtl.Matrix44f(mat1)
assert result.state == gmtl.Matrix44f.XformState.ORTHOGONAL
# Make sure they are still equal (== and != should not observe the state)
result.state = gmtl.Matrix44f.XformState.FULL
assert not result != mat1
result.state = gmtl.Matrix44f.XformState.ORTHOGONAL
assert result == mat1
result.state = gmtl.Matrix44f.XformState.FULL
assert gmtl.isEqual(result, mat1, 0.0001)
# Generators.
# Test gmtl.setScale()
mat = gmtl.Matrix44f()
gmtl.setScale(mat, 2345.0)
assert mat.state == gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
mat2 = gmtl.makeScaleMatrix44(2345.0)
assert mat2.state == gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
mat = gmtl.Matrix44f()
mat2 = gmtl.Matrix44f()
gmtl.setScale(mat, gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat.state == gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
mat2 = gmtl.makeScaleMatrix44(gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat2.state == gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
# Test gmtl.setTrans()
mat = gmtl.Matrix44f()
# Set
gmtl.setTrans(mat, gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat.state == gmtl.Matrix44f.XformState.TRANS
mat.state = gmtl.Matrix44f.XformState.FULL
gmtl.setTrans(mat, gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat.state == gmtl.Matrix44f.XformState.FULL
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
gmtl.setTrans(mat, gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat.state == gmtl.Matrix44f.XformState.AFFINE
mat.state = gmtl.Matrix44f.XformState.AFFINE
gmtl.setTrans(mat, gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat.state == gmtl.Matrix44f.XformState.AFFINE
# make
mat2 = gmtl.makeTransMatrix44(gmtl.Vec3f(983.0, 234.0, 1.0))
assert mat2.state == gmtl.Matrix44f.XformState.TRANS
# Test setRot(gmtl.AxisAngle)
self.__testStateTracking_setRot(gmtl.AxisAnglef(90.0,
gmtl.Vec3f(0.0, 1.0, 0.0)))
# Test setRot(gmtl.EulerAngle)
self.__testStateTracking_setRot(gmtl.EulerAngleXYZf())
# Test gmtl.setFrustum()
mat = gmtl.Matrix44f()
gmtl.setFrustum(mat, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
assert mat.state == gmtl.Matrix44f.XformState.FULL
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
gmtl.setFrustum(mat, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
assert mat.state == gmtl.Matrix44f.XformState.FULL
# Test gmtl.setPerspective()
mat = gmtl.Matrix44f()
gmtl.setPerspective(mat, 60.0, 1.33, 0.0004, 100.0)
assert mat.state == gmtl.Matrix44f.XformState.FULL
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
gmtl.setPerspective(mat, 60.0, 1.33, 0.0004, 100.0)
assert mat.state == gmtl.Matrix44f.XformState.FULL
# Test set(gmtl.Coord3fXYZ)
self.__testStateTracking_set(gmtl.Coord3fXYZ(),
gmtl.Matrix44f.XformState.AFFINE)
# Test set(gmtl.Coord3fQuat)
self.__testStateTracking_set(gmtl.Coord3fQuat(),
gmtl.Matrix44f.XformState.AFFINE)
# Test set(gmtl.Coord3fAxisAngle)
self.__testStateTracking_set(gmtl.Coord3fAxisAngle(),
gmtl.Matrix44f.XformState.AFFINE)
# Test set(gmtl.Quatf)
self.__testStateTracking_set(gmtl.Quatf(),
gmtl.Matrix44f.XformState.ORTHOGONAL)
# Test set(gmtl.AxisAnglef)
self.__testStateTracking_set(gmtl.AxisAnglef(),
gmtl.Matrix44f.XformState.ORTHOGONAL)
# Test gmtl.invert()
for x in range(len(test_states)):
# gmtl.invertFull(result, mat)
self.__testStateTracking_invert(test_states[x], gmtl.invertFull)
# gmtl.invertTrans(result, mat)
self.__testStateTracking_invert(test_states[x], gmtl.invertTrans)
# gmtl.invertOrthogonal(result, mat)
self.__testStateTracking_invert(test_states[x], gmtl.invertOrthogonal)
# gmtl.invertAffine(result, mat)
self.__testStateTracking_invert(test_states[x], gmtl.invertAffine)
mat = gmtl.Matrix44f()
eps = 0.0001
# gmtl.Matrix44f.XformState.IDENTITY
mat.set( 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 )
mat.state = gmtl.Matrix44f.XformState.IDENTITY
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_nochange = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
assert gmtl.isEqual(iv, iv_nochange, eps) and gmtl.isEqual(iv, iv_full, eps)
# gmtl.Matrix44f.XformState.TRANS
mat.set(1, 0, 0, 4,
0, 1, 0, 5,
0, 0, 1, 6,
0, 0, 0, 1)
mat.state = gmtl.Matrix44f.XformState.TRANS
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_trans = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
gmtl.invertTrans(iv_trans, iv_trans)
assert gmtl.isEqual(iv, iv_trans, eps) and gmtl.isEqual(iv, iv_full, eps)
# gmtl.Matrix44f.XformState.ORTHOGONAL
mat.set(0, 0, -1, 0,
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 0, 1)
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_ortho = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
gmtl.invertOrthogonal(iv_ortho, iv_ortho)
assert gmtl.isEqual(iv, iv_ortho, eps) and gmtl.isEqual(iv, iv_full, eps)
# gmtl.Matrix44f.XformState.AFFINE
mat.set(0, 0, -1, 10,
1, 0, 0, 11,
0, -1, 0, 12,
0, 0, 0, 20057)
mat.state = gmtl.Matrix44f.XformState.AFFINE
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_affine = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
gmtl.invertAffine(iv_affine, iv_affine)
assert gmtl.isEqual(iv, iv_affine, eps) and gmtl.isEqual(iv, iv_full, eps)
# gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
mat.set(0, 2, 0, 10,
0, 0, -8, 11,
-3, 0, 0, 12,
0, 0, 0, 1)
mat.state = gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_affine = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
gmtl.invertAffine(iv_affine, iv_affine)
assert gmtl.isEqual(iv, iv_affine, eps) and gmtl.isEqual(iv, iv_full, eps)
mat.set(0, 2, 0, 10,
0, 0, -8, 11,
-3, 0, 0, 12,
0, 0, 0, 23489)
mat.state = gmtl.Matrix44f.XformState.AFFINE | gmtl.Matrix44f.XformState.NON_UNISCALE
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
iv_affine = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
gmtl.invertAffine(iv_affine, iv_affine)
assert gmtl.isEqual(iv, iv_affine, eps) and gmtl.isEqual(iv, iv_full, eps)
# gmtl.Matrix44f.XformState.FULL
mat.set(range(1, 17))
mat.state = gmtl.Matrix44f.XformState.FULL
iv = gmtl.Matrix44f(mat)
iv_full = gmtl.Matrix44f(mat)
gmtl.invert(iv)
gmtl.invertFull(iv_full, iv_full)
assert gmtl.isEqual(iv, iv_full, eps)
def __testStateTracking_setRot(self, rot):
mat = gmtl.Matrix44f()
# Set
gmtl.setRot(mat, rot)
assert mat.state == gmtl.Matrix44f.XformState.ORTHOGONAL
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
gmtl.setRot(mat, rot)
assert mat.state == gmtl.Matrix44f.XformState.ORTHOGONAL
mat.state = gmtl.Matrix44f.XformState.TRANS
gmtl.setRot(mat, rot)
assert mat.state == gmtl.Matrix44f.XformState.AFFINE
mat.state = gmtl.Matrix44f.XformState.AFFINE
gmtl.setRot(mat, rot)
assert mat.state == gmtl.Matrix44f.XformState.AFFINE
mat.state = gmtl.Matrix44f.XformState.FULL
gmtl.setRot(mat, rot)
assert mat.state == gmtl.Matrix44f.XformState.FULL
# make
mat2 = gmtl.makeRotMatrix44(rot)
assert mat2.state == gmtl.Matrix44f.XformState.ORTHOGONAL
def __testStateTracking_set(self, xform, state):
mat = gmtl.Matrix44f()
# set
gmtl.set(mat, xform)
assert mat.state == state
mat.state = gmtl.Matrix44f.XformState.ORTHOGONAL
gmtl.set(mat, xform)
assert mat.state == state
mat.state = gmtl.Matrix44f.XformState.TRANS
gmtl.set(mat, xform)
assert mat.state == state
mat.state = gmtl.Matrix44f.XformState.AFFINE
gmtl.set(mat, xform)
assert mat.state == state
mat.state = gmtl.Matrix44f.XformState.FULL
gmtl.set(mat, xform)
assert mat.state == state
# make
# mat2 = gmtl.makeMatrix44(xform)
# assert mat2.state == state
def __testStateTracking_invert(self, state, inverter):
mat = gmtl.Matrix44f()
result = gmtl.Matrix44f()
mat.state = state
inverter(result, mat)
assert result.state == mat.state
class PlaneTest(unittest.TestCase):
def setUp(self):
self.origin = gmtl.Point3f(0.0, 0.0, 0.0)
self.x1_v = gmtl.Vec3f(1.0, 0.0, 0.0)
self.y1_v = gmtl.Vec3f(0.0, 1.0, 0.0)
self.z1_v = gmtl.Vec3f(0.0, 0.0, 1.0)
self.x1_pt = gmtl.Point3f(1.0, 0.0, 0.0)
self.y1_pt = gmtl.Point3f(0.0, 1.0, 0.0)
self.z1_pt = gmtl.Point3f(0.0, 0.0, 1.0)
self.xy_plane = gmtl.Planef(self.origin, self.x1_pt, self.y1_pt)
self.zx_plane = gmtl.Planef(self.origin, self.z1_pt, self.x1_pt)
self.yz_plane = gmtl.Planef(self.origin, self.y1_pt, self.z1_pt)
def testCreation(self):
test_plane = gmtl.Planef()
zero_vec = gmtl.Vec3f(0.0, 0.0, 0.0)
assert test_plane.norm == zero_vec
assert test_plane.offset == 0.0
def testThreePtCreation(self):
assert self.xy_plane.norm == self.z1_v # Z-plane
assert self.zx_plane.norm == self.y1_v # Y-plane
assert self.yz_plane.norm == self.x1_v # X-plane
assert self.xy_plane.offset == 0.0
assert self.zx_plane.offset == 0.0
assert self.yz_plane.offset == 0.0
test_plane = gmtl.Planef(gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(1.0, 1.0, 0.0),
gmtl.Point3f(1.0, 0.0, 1.0))
assert test_plane.norm == self.x1_v
assert test_plane.offset == 1.0
def testNormPtCreation(self):
test_plane = gmtl.Planef(self.x1_v, self.origin) # X-axis through origin
assert test_plane.norm == self.x1_v
assert test_plane.offset == 0.0
test_plane = gmtl.Planef(self.x1_v, self.x1_pt) # X-axis through (1,0,0)
assert test_plane.norm == self.x1_v
assert test_plane.offset == 1.0
test_plane = gmtl.Planef(self.z1_v, self.x1_pt) # Z-axis through (1,0,0)
assert test_plane.norm == self.z1_v
assert test_plane.offset == 0.0
# Z-axis through (0,0,-1)
test_plane = gmtl.Planef(self.z1_v, gmtl.Point3f(0.0, 0.0, -1.0))
assert test_plane.norm == self.z1_v
assert test_plane.offset == -1.0
def testNormOffsetCreation(self):
test_plane = gmtl.Planef(self.x1_v, 0.0) # X-axis through origin
assert test_plane.norm == self.x1_v
assert test_plane.offset == 0.0
def testCopyConstruct(self):
test_plane = gmtl.Planef(self.xy_plane)
assert test_plane is not self.xy_plane
assert test_plane.norm == self.xy_plane.norm
assert test_plane.offset == self.xy_plane.offset
def testEqualityCompare(self):
test_plane1 = gmtl.Planef(self.x1_v, 35.0)
test_plane2 = gmtl.Planef(test_plane1)
assert test_plane1 == test_plane2
assert not test_plane1 != test_plane2
# Set equal, vary normal.
test_plane2 = gmtl.Planef(test_plane1)
test_plane2.norm[0] += 2.0
assert test_plane1 != test_plane2
assert not test_plane1 == test_plane2
# Set equal, vary offset.
test_plane2 = gmtl.Planef(test_plane1)
test_plane2.offset += 2.0
assert test_plane1 != test_plane2
assert not test_plane1 == test_plane2
def testIsEqual(self):
test_plane1 = gmtl.Planef(self.x1_v, 0.0)
test_plane2 = gmtl.Planef(test_plane1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_plane1, test_plane2, eps)
eps += 0.05
for elt in range(4):
test_plane2 = gmtl.Planef(test_plane1)
if elt < 3:
test_plane2.norm[elt] += 20.0
else:
test_plane2.offset += 20.0
assert not gmtl.isEqual(test_plane1, test_plane2, 10.0)
assert not gmtl.isEqual(test_plane1, test_plane2, 19.9)
assert gmtl.isEqual(test_plane1, test_plane2, 20.1)
assert gmtl.isEqual(test_plane1, test_plane2, 22.0)
def testDistance(self):
test_plane = gmtl.Planef(self.x1_v, 25.0)
assert gmtl.distance(test_plane, self.origin) == -25.0
assert gmtl.distance(test_plane, self.x1_pt) == -24.0
assert gmtl.distance(self.xy_plane, self.z1_pt) == 1.0
pt = gmtl.Point3f(-12.0, 5.0, -17.0)
assert gmtl.distance(self.xy_plane, pt) == -17.0
slanted_plane = gmtl.Planef(gmtl.Vec3f(1.0, 1.0, 1.0), self.origin)
assert gmtl.distance(slanted_plane, self.origin) == 0.0
pt.set(1.0, 1.0, 1.0)
assert gmtl.distance(slanted_plane, pt) > 0.0
def testWhichSide(self):
answer = gmtl.whichSide(self.xy_plane, gmtl.Point3f(0.0, 0.0, 1.0))
assert answer == gmtl.PlaneSide.POS_SIDE
answer = gmtl.whichSide(self.xy_plane, gmtl.Point3f(0.0, 0.0, -12.0))
assert answer == gmtl.PlaneSide.NEG_SIDE
answer = gmtl.whichSide(self.zx_plane, gmtl.Point3f(0.0, 1e-10, 0.0))
assert answer == gmtl.PlaneSide.POS_SIDE
answer = gmtl.whichSide(self.zx_plane, gmtl.Point3f(0.0, -1e10, 0.0))
assert answer == gmtl.PlaneSide.NEG_SIDE
answer = gmtl.whichSide(self.xy_plane, gmtl.Point3f(0.0, -0.0, 0.0))
assert answer == gmtl.PlaneSide.ON_PLANE
def testFindReflect(self):
plane = gmtl.Planef(gmtl.Vec3f(0.0, 1.0, 0.0), 0.0)
point = gmtl.Point3f(3.0, 5.0, 6.0)
result = gmtl.Point3f()
gmtl.reflect(result, plane, point)
assert result == gmtl.Vec3f(3.0, -5.0, 6.0)
def testFindNearestPt(self):
# XY distance to point off origin.
test_point = gmtl.Point3f(0.0, 0.0, 1.0)
answer = gmtl.Point3f()
assert gmtl.distance(self.xy_plane, test_point) == \
gmtl.findNearestPt(self.xy_plane, test_point, answer)
# XY distance to point at (12,21).
test_point = gmtl.Point3f(12.0, -21.0, -13.0)
correct_result = gmtl.Point3f(12.0, -21.0, 0.0)
assert gmtl.distance(self.xy_plane, test_point) == \
gmtl.findNearestPt(self.xy_plane, test_point, answer)
assert answer == correct_result
# XY distance to point on plane at (-17.05, 0.334)
test_point = gmtl.Point3f(-17.05, 0.334, 0.0)
assert gmtl.distance(self.xy_plane, test_point) == \
gmtl.findNearestPt(self.xy_plane, test_point, answer)
assert answer == test_point
class PlaneMetricTest(unittest.TestCase):
def setUp(self):
self.origin = gmtl.Point3f(0.0, 0.0, 0.0)
self.x1_v = gmtl.Vec3f(1.0, 0.0, 0.0)
self.y1_v = gmtl.Vec3f(0.0, 1.0, 0.0)
self.z1_v = gmtl.Vec3f(0.0, 0.0, 1.0)
self.x1_pt = gmtl.Point3f(1.0, 0.0, 0.0)
self.y1_pt = gmtl.Point3f(0.0, 1.0, 0.0)
self.z1_pt = gmtl.Point3f(0.0, 0.0, 1.0)
self.xy_plane = gmtl.Planef(self.origin, self.x1_pt, self.y1_pt)
self.zx_plane = gmtl.Planef(self.origin, self.z1_pt, self.x1_pt)
self.yz_plane = gmtl.Planef(self.origin, self.y1_pt, self.z1_pt)
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_plane2 = gmtl.Planef()
use_value += test_plane2.offset + 1.0
assert use_value > 0.0
def testTimingThreePtCreation(self):
iters = 400000
for iter in xrange(iters):
test_plane = gmtl.Planef(self.x1_pt, self.y1_pt, self.z1_pt)
test_plane.offset = 1.0
def testTimingNormPtCreation(self):
iters = 400000
for iter in xrange(iters):
test_plane2 = gmtl.Planef(self.x1_v, self.z1_pt)
test_plane2.offset = 1.0
def testTimingNormOffsetCreation(self):
iters = 400000
for iter in xrange(iters):
test_plane2 = gmtl.Planef(self.x1_v, 25.0)
test_plane2.offset = 1.0
def testTimingCopyConstruct(self):
test_plane = gmtl.Planef(self.xy_plane)
iters = 400000
for iter in xrange(iters):
test_plane2 = gmtl.Planef(test_plane)
test_plane2.offset = 1.0
def testTimingEqualityCompare(self):
test_plane1 = gmtl.Planef(self.x1_v, 35.0)
test_plane2 = gmtl.Planef(test_plane1)
iters = 400000
true_count = 0
for iter in xrange(iters):
test_plane1.offset += 1
test_plane2.offset += 2
if test_plane1 == test_plane2:
true_count += 1
# Inequality.
test_plane1.norm = self.x1_v
test_plane1.offset = 0.0
test_plane2 = gmtl.Planef(test_plane1)
for iter in xrange(iters):
test_plane1.offset += 1.0
test_plane2.offset += 2.0
if test_plane1 == test_plane2:
true_count += 1
def testTimingIsEqual(self):
test_plane1 = gmtl.Planef(self.x1_v, 0.0)
iters = 400000
true_count = 0
test_plane2 = gmtl.Planef(test_plane1)
for iter in xrange(iters):
test_plane1.offset += 1.0
test_plane2.offset += 2.0
if gmtl.isEqual(test_plane1, test_plane2, 1.0):
true_count += 1
if gmtl.isEqual(test_plane1, test_plane2, 0.1):
true_count += 1
if gmtl.isEqual(test_plane1, test_plane2, 100000.0):
true_count += 1
def testTimingDistance(self):
test_plane = gmtl.Planef(self.x1_v, 25.0)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_plane.offset += 1.0
use_value = use_value + gmtl.distance(test_plane, self.y1_pt)
def testTimingWhichSide(self):
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.distance(self.xy_plane, self.y1_pt) == gmtl.PlaneSide.POS_SIDE:
true_count += 1
def testTimingFindNearestPt(self):
iters = 400000
use_value = 0.0
test_point = gmtl.Point3f(-17.05, 0.334, 0.0)
answer = gmtl.Point3f()
for iter in xrange(iters):
dist = gmtl.findNearestPt(self.xy_plane, test_point, answer)
use_value = use_value + dist + answer[0]
class PointTest(unittest.TestCase):
def testCreation(self):
point = gmtl.Point3d()
assert point[0] == 0.0
assert point[1] == 0.0
assert point[2] == 0.0
def testCopyConstruct(self):
test_point = gmtl.Point3d()
test_point[0] = 2.0
test_point[1] = 4.0
test_point[2] = 8.0
test_point_copy = gmtl.Point3d(test_point)
assert test_point_copy[0] == 2.0
assert test_point_copy[1] == 4.0
assert test_point_copy[2] == 8.0
def testConstructors(self):
# test_point4 = gmtl.Point4f(1.0, 2.0, 3.0, 4.0)
# assert test_point4[0] == 1.0
# assert test_point4[1] == 2.0
# assert test_point4[2] == 3.0
# assert test_point4[3] == 4.0
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
assert test_point3[0] == 1.0
assert test_point3[1] == 2.0
assert test_point3[2] == 3.0
test_point2 = gmtl.Point2f(1.0, 2.0)
assert test_point2[0] == 1.0
assert test_point2[1] == 2.0
def testSet(self):
test_point3 = gmtl.Point3f()
test_point3.set(1.0, 2.0, 3.0)
assert test_point3[0] == 1.0
assert test_point3[1] == 2.0
assert test_point3[2] == 3.0
test_point2 = gmtl.Point2f()
test_point2.set(1.0, 2.0)
assert test_point2[0] == 1.0
assert test_point2[1] == 2.0
def testSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
# test_point4 = gmtl.Point4f()
# test_point4.set(data)
# assert test_point4[0] == 1.0
# assert test_point4[1] == 2.0
# assert test_point4[2] == 3.0
# assert test_point4[3] == 4.0
test_point3 = gmtl.Point3f()
test_point3.set(data)
assert test_point3[0] == 1.0
assert test_point3[1] == 2.0
assert test_point3[2] == 3.0
test_point2 = gmtl.Point2f()
test_point2.set(data)
assert test_point2[0] == 1.0
assert test_point2[1] == 2.0
def testGetData(self):
# test_point4 = gmtl.Point4f(1.0, 2.0, 3.0, 4.0)
# data = test_point4.getData()
# assert data[0] == 1.0
# assert data[1] == 2.0
# assert data[2] == 3.0
# assert data[3] == 4.0
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
data = test_point3.getData()
assert data[0] == 1.0
assert data[1] == 2.0
assert data[2] == 3.0
test_point2 = gmtl.Point2f(1.0, 2.0)
data = test_point2.getData()
assert data[0] == 1.0
assert data[1] == 2.0
def testEqualityCompare(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point2 = gmtl.Point3f(test_point1)
assert test_point1 == test_point2
assert not test_point1 != test_point2
# Set equal, vary elt 0
test_point2 = gmtl.Point3f(test_point1)
test_point2[0] = 21.10
assert test_point1 != test_point2
assert not test_point1 == test_point2
# Set equal, vary elt 1
test_point2 = gmtl.Point3f(test_point1)
test_point2[1] = 21.10
assert test_point1 != test_point2
assert not test_point1 == test_point2
# Set equal, vary elt 2
test_point2 = gmtl.Point3f(test_point1)
test_point2[2] = 21.10
assert test_point1 != test_point2
assert not test_point1 == test_point2
def testIsEqual(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point2 = gmtl.Point3f(test_point1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_point1, test_point2, eps)
eps += 0.05
test_point1.set(1.0, 1.0, 1.0)
for elt in range(3):
test_point2 = gmtl.Point3f(test_point1)
test_point2[elt] = 21.0
assert not gmtl.isEqual(test_point1, test_point2, 10.0)
assert not gmtl.isEqual(test_point1, test_point2, 19.9)
assert gmtl.isEqual(test_point1, test_point2, 20.1)
assert gmtl.isEqual(test_point1, test_point2, 22.0)
def testOpPlusEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point1 += test_point2
assert test_point1[0] == 3.0 and \
test_point1[1] == 4.0 and \
test_point1[2] == 5.0
def testOpPlus(self):
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point1 = test_point3 + test_point2
assert test_point1[0] == 3.0 and \
test_point1[1] == 4.0 and \
test_point1[2] == 5.0
def testOpMinusEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point1 -= test_point2
assert test_point1[0] == -1.0 and \
test_point1[1] == 0.0 and \
test_point1[2] == 1.0
def testOpMinus(self):
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
vec_ans = test_point3 - test_point2
# The result must be convertible to gmtl.Vec3f
v = gmtl.Vec3f(vec_ans)
assert vec_ans[0] == -1.0 and \
vec_ans[1] == 0.0 and \
vec_ans[2] == 1.0
def testOpMultScalarEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point1 *= 4.0
assert test_point1[0] == 4.0 and \
test_point1[1] == 8.0 and \
test_point1[2] == 12.0
def testOpMultScalar(self):
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point1 = test_point3 * 4.0
assert test_point1[0] == 4.0 and \
test_point1[1] == 8.0 and \
test_point1[2] == 12.0
def testOpDivScalarEq(self):
test_point1 = gmtl.Point3f(12.0, 8.0, 4.0)
test_point1 /= 4.0
assert test_point1[0] == 3.0 and \
test_point1[1] == 2.0 and \
test_point1[2] == 1.0
def testOpDivScalar(self):
test_point3 = gmtl.Point3f(12.0, 8.0, 4.0)
test_point1 = test_point3 / 4.0
assert test_point1[0] == 3.0 and \
test_point1[1] == 2.0 and \
test_point1[2] == 1.0
class PointMetricTest(unittest.TestCase):
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_point2 = gmtl.Point2f()
test_point2[0] = 1.0
test_point3 = gmtl.Point3f()
test_point3[0] = 1.0
# test_point4 = gmtl.Point4f()
# test_point4[0] = 1.0
use_value += test_point2[0] + test_point3[0] # + test_point4[0]
assert use_value > 0.0
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
# test_point4 = gmtl.Point4f(1.0, 2.0, 3.0, 4.0)
test_point3 = gmtl.Point3f(1.0, 2.0, 3.0)
test_point2 = gmtl.Point2f(1.0, 2.0)
# use_value += test_point4[3] + test_point3[2] + test_point2[1]
use_value += test_point3[2] + test_point2[1]
def testTimingSet(self):
test_point3 = gmtl.Point3f()
test_point2 = gmtl.Point2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_point3.set(iters + 0, iters + 1, iters + 2)
test_point2.set(iters + 0, iters + 1)
use_value = use_value + test_point3[2] + test_point2[1]
assert use_value > 0.0
def testTimingSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
# test_point4 = gmtl.Point4f()
test_point3 = gmtl.Point3f()
test_point2 = gmtl.Point2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
data[0] += 1.0
data[1] += 2.0
data[2] += 4.0
data[3] += 8.0
# test_point4.set(data)
test_point3.set(data)
test_point2.set(data)
# use_value += test_point4[3] + test_point3[2] + test_point2[2]
use_value += test_point3[2] + test_point2[2]
assert use_value > 0.0
def testTimingEqualityCompare(self):
test_point1 = gmtl.Point3f()
test_point2 = gmtl.Point3f()
iters = 400000
true_count = 0
false_count = 0
test_point1.set(0.0, 0.0, 2000.0)
test_point2.set(0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_point1[2] += 1.0
test_point2[2] += 1.0
if test_point1 == test_point2:
true_count += 0
test_point1.set(0.0, 0.0, 2000.0)
test_point2.set(0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_point1[2] += 1.0
test_point2[2] += 2.0
if test_point1 != test_point2:
false_count += 1
def testTimingIsEqual(self):
test_point1 = gmtl.Point3f()
test_point2 = gmtl.Point3f()
iters = 400000
true_count = 0
test_point1.set(0.0, 0.0, 2000.0)
test_point2.set(0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_point1[2] += 1.0
test_point2[2] += 1.0
if gmtl.isEqual(test_point1, test_point2, 1.0):
true_count += 0
if gmtl.isEqual(test_point1, test_point2, 0.1):
true_count += 0
if gmtl.isEqual(test_point1, test_point2, 100000.0):
true_count += 0
def testTimingOpPlusEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
iters = 400000
test_point3 = gmtl.Point3f(5.0, 7.0, 9.0)
for iter in xrange(iters):
test_point3.set(iter, iter + 1, iter + 2)
test_point1 += test_point3
test_point2 = gmtl.Point3f(test_point1)
def testTimingOpPlus(self):
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point3 = gmtl.Point3f()
iters = 400000
for iter in xrange(iters):
test_point3.set(iter, iter + 1, iter + 2)
test_point1 = test_point3 + test_point2
def testTimingOpMinusEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
iters = 400000
test_point3 = gmtl.Point3f(5.0, 7.0, 9.0)
for iter in xrange(iters):
test_point3.set(iter, iter + 1, iter + 2)
test_point1 -= test_point3
test_point2 = gmtl.Point3f(test_point1)
def testTimingOpMinus(self):
test_point2 = gmtl.Point3f(2.0, 2.0, 2.0)
test_point3 = gmtl.Point3f()
iters = 400000
for iter in xrange(iters):
test_point3.set(iter, iter + 1, iter + 2)
test_point1 = test_point3 - test_point2
def testTimingOpMultScalarEq(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
iters = 400000
for iter in xrange(iters):
test_point1 *= 1.05
def testTimingOpMultScalar(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
iters = 400000
for iter in xrange(iters):
test_point3 = gmtl.Point3f(test_point1)
test_point1 = test_point3 * 1.05
def testTimingOpDivScalarEq(self):
test_point1 = gmtl.Point3f(12.0, 4.0, 8.0)
iters = 400000
for iter in xrange(iters):
test_point1 /= 0.95
def testTimingOpDivScalar(self):
test_point1 = gmtl.Point3f(1.0, 2.0, 3.0)
iters = 400000
for iter in xrange(iters):
test_point3 = gmtl.Point3f(test_point1)
test_point1 = test_point3 / 1.05
class QuatCompareTest(unittest.TestCase):
def __testEqual(self, quatType, dataType):
quat1 = quatType()
quat1.set(dataType(1.0), dataType(2.0), dataType(3.0), dataType(4.0))
quat2 = quatType(quat1)
assert quat1 == quat2
assert quat2 == quat1
# Test that != works on all elements.
for j in range(4):
quat2[j] = dataType(1221.0)
assert quat1 != quat2
assert not quat1 == quat2
quat2[j] = quat1[j] # put it back
assert gmtl.isEqual(quat1, quat2)
assert gmtl.isEqual(quat1, quat2, dataType(0.0))
assert gmtl.isEqual(quat2, quat1, dataType(0.0))
assert gmtl.isEqual(quat2, quat1, dataType(100000.0))
eps = dataType(10.0)
for j in range(4):
quat2[j] = quat1[j] - (eps / dataType(2.0))
assert gmtl.isEqual(quat1, quat2, eps)
assert not gmtl.isEqual(quat1, quat2, dataType(eps / 3.0))
quat2[j] = quat1[j] # put it back
def __testEquiv(self, quatType, dataType):
quat1 = quatType(dataType(1.0), dataType(2.0), dataType(34.0),
dataType(4.0))
quat2 = quatType(dataType(-1.0), dataType(-2.0), dataType(-34.0),
dataType(-4.0))
quat3 = quatType(dataType(1.0), dataType(2.0), dataType(34.0),
dataType(4.0))
quat4 = quatType()
# Test for geometric equivalency.
assert gmtl.isEquiv(quat1, quat2)
assert gmtl.isEquiv(quat1, quat2, dataType(0.0))
assert gmtl.isEquiv(quat2, quat1, dataType(0.0))
assert gmtl.isEquiv(quat2, quat1, dataType(100000.0))
# Test for geometric equivalency.
assert gmtl.isEquiv(quat1, quat3)
assert gmtl.isEquiv(quat1, quat3, dataType(0.0))
assert gmtl.isEquiv(quat3, quat1, dataType(0.0))
assert gmtl.isEquiv(quat3, quat1, dataType(100000.0))
# Test for geometric inequivalency.
assert not gmtl.isEquiv(quat1, quat4)
assert not gmtl.isEquiv(quat1, quat4, dataType(0.0))
assert not gmtl.isEquiv(quat4, quat1, dataType(0.0))
assert not gmtl.isEquiv(quat4, quat1, dataType(30.0))
def testQuatEquiv(self):
self.__testEquiv(gmtl.Quatf, float)
self.__testEquiv(gmtl.Quatd, float)
def testQuatEqualityFloatTest(self):
for i in range(10):
self.__testEqual(gmtl.Quatf, float)
def testQuatEqualityDoubleTest(self):
for i in range(10):
self.__testEqual(gmtl.Quatd, float)
class QuatCompareMetricTest(unittest.TestCase):
def testQuatTimingOpEqualityTest(self):
iters = 40000
src_quat11 = gmtl.Quatf()
src_quat22 = gmtl.Quatf()
src_quat33 = gmtl.Quatf()
src_quat34 = gmtl.Quatf()
src_quat44 = gmtl.Quatf()
src_quat101 = gmtl.Quatd()
# Half of these will be equal.
src_quat11[0] = 1.0
src_quat22[0] = 1.0
src_quat33[0] = 2.0
test_quat11 = gmtl.Quatf(src_quat11)
test_quat22 = gmtl.Quatf(src_quat22)
test_quat33 = gmtl.Quatf(src_quat33)
test_quat34 = gmtl.Quatf(src_quat34)
test_quat44 = gmtl.Quatf(src_quat44)
test_quat101 = gmtl.Quatd(src_quat101)
# Half of these will be equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 2.0
true_count = 0
for iter in xrange(iters):
if src_quat11 == test_quat11:
true_count += 1
if src_quat22 == test_quat22:
true_count += 1
if src_quat33 == test_quat33:
true_count += 1
if src_quat34 == test_quat34:
true_count += 1
if src_quat44 == test_quat44:
true_count += 1
if src_quat101 == test_quat101:
true_count += 1
assert true_count > 0
def testQuatTimingOpNotEqualityTest(self):
iters = 40000
src_quat11 = gmtl.Quatf()
src_quat22 = gmtl.Quatf()
src_quat33 = gmtl.Quatf()
src_quat34 = gmtl.Quatf()
src_quat44 = gmtl.Quatf()
src_quat101 = gmtl.Quatd()
# Half of these will be equal.
src_quat11[0] = 1.0
src_quat22[0] = 1.0
src_quat33[0] = 2.0
test_quat11 = gmtl.Quatf(src_quat11)
test_quat22 = gmtl.Quatf(src_quat22)
test_quat33 = gmtl.Quatf(src_quat33)
test_quat34 = gmtl.Quatf(src_quat34)
test_quat44 = gmtl.Quatf(src_quat44)
test_quat101 = gmtl.Quatd(src_quat101)
# Half of these will be equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 2.0
true_count = 0
for iter in xrange(iters):
if src_quat11 != test_quat11:
true_count += 1
if src_quat22 != test_quat22:
true_count += 1
if src_quat33 != test_quat33:
true_count += 1
if src_quat34 != test_quat34:
true_count += 1
if src_quat44 != test_quat44:
true_count += 1
if src_quat101 != test_quat101:
true_count += 1
assert true_count > 0
def testQuatTimingOpIsEqualTest(self):
iters = 40000
src_quat11 = gmtl.Quatf()
src_quat22 = gmtl.Quatf()
src_quat33 = gmtl.Quatf()
src_quat34 = gmtl.Quatf()
src_quat44 = gmtl.Quatf()
src_quat101 = gmtl.Quatd()
# Half of these will be equal.
src_quat11[0] = 1.0
src_quat22[0] = 1.0
src_quat33[0] = 2.0
test_quat11 = gmtl.Quatf(src_quat11)
test_quat22 = gmtl.Quatf(src_quat22)
test_quat33 = gmtl.Quatf(src_quat33)
test_quat34 = gmtl.Quatf(src_quat34)
test_quat44 = gmtl.Quatf(src_quat44)
test_quat101 = gmtl.Quatd(src_quat101)
# Half of these will be equal.
src_quat34[0] = 2.0
src_quat44[1] = 3.0
src_quat101[3] = 2.0
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(src_quat11, test_quat11):
true_count += 1
if gmtl.isEqual(src_quat22, test_quat22):
true_count += 1
if gmtl.isEqual(src_quat33, test_quat33):
true_count += 1
if gmtl.isEqual(src_quat34, test_quat34):
true_count += 1
if gmtl.isEqual(src_quat44, test_quat44):
true_count += 1
if gmtl.isEqual(src_quat101, test_quat101):
true_count += 1
assert true_count > 0
def testQuatTimingEquiv(self):
quat1 = gmtl.Quatf(1.0, 2.0, 34.0, 4.0)
quat2 = gmtl.Quatf(-1.0, -2.0, -34.0, -4.0)
true_count = 0
iters = 200000
for iter in xrange(iters):
if gmtl.isEquiv(quat1, quat2, 0.0001):
true_count += 1
assert true_count > 0
class QuatGenTest(unittest.TestCase):
def testQuatMakePure(self):
vec = gmtl.Vec3f(121, 232, 343)
quat = gmtl.Quatf(gmtl.makePure(vec))
assert quat[gmtl.VectorIndex.Xelt] == 121.0
assert quat[gmtl.VectorIndex.Yelt] == 232.0
assert quat[gmtl.VectorIndex.Zelt] == 343.0
# Make sure set works the same.
q2 = gmtl.Quatf()
gmtl.setPure(q2, vec)
assert q2[gmtl.VectorIndex.Xelt] == 121.0
assert q2[gmtl.VectorIndex.Yelt] == 232.0
assert q2[gmtl.VectorIndex.Zelt] == 343.0
def testQuatMakeConf(self):
quat = gmtl.Quatf(0.0, 21.0, 31.0, 1234.0)
quat2 = gmtl.makeConj(quat)
# Make sure the function didn't munge the data.
assert quat[gmtl.VectorIndex.Xelt] == 0.0
assert quat[gmtl.VectorIndex.Yelt] == 21.0
assert quat[gmtl.VectorIndex.Zelt] == 31.0
assert quat[gmtl.VectorIndex.Welt] == 1234.0
# Make sure conj worked.
assert quat2[gmtl.VectorIndex.Xelt] == -0.0
assert quat2[gmtl.VectorIndex.Yelt] == -21.0
assert quat2[gmtl.VectorIndex.Zelt] == -31.0
assert quat2[gmtl.VectorIndex.Welt] == 1234.0
def testQuatMakeInvert(self):
eps = 0.0001
q = gmtl.Quatf(0.2, 0.33, 0.44, 0.101)
expected_result = gmtl.Quatf(-0.567053, -0.935637, -1.24752, 0.286362)
q4 = gmtl.makeInvert(q)
assert gmtl.isEqual(expected_result, q4, eps)
def testQuatMakeRot(self):
eps = 0.0001
q1 = gmtl.Quatf()
q2 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(32.0), 0.0, 1.0, 0.0))
expected_result1 = gmtl.Quatf(0.707107, 0.0, 0.0, 0.707107)
expected_result2 = gmtl.Quatf(0.0, 0.275637, 0.0, 0.961262)
assert gmtl.isEqual(expected_result1, q1, eps)
assert gmtl.isEqual(expected_result2, q2, eps)
# Values from VR Juggler math library.
quats = [
gmtl.Quatf(0.0, 0.0, 0.0, -1.0),
gmtl.Quatf(-0, -0.173648, -0, -0.984808),
gmtl.Quatf(-0, -0.34202, -0, -0.939693 ),
gmtl.Quatf(-0, -0.5, -0, -0.866025 ),
gmtl.Quatf(-0, -0.642788, -0, -0.766044),
gmtl.Quatf(-0, -0.766044, -0, -0.642788),
gmtl.Quatf(-0, -0.866025, -0, -0.5 ),
gmtl.Quatf(-0, -0.939693, -0, -0.34202 ),
gmtl.Quatf(-0, -0.984808, -0, -0.173648),
gmtl.Quatf(-0, -1, -0, 0 ),
gmtl.Quatf(-0, -0.984808, -0, 0.173648 ),
gmtl.Quatf(-0, -0.939693, -0, 0.34202 ),
gmtl.Quatf(-0, -0.866025, -0, 0.5 ),
gmtl.Quatf(-0, -0.766044, -0, 0.642788 ),
gmtl.Quatf(-0, -0.642788, -0, 0.766044 ),
gmtl.Quatf(-0, -0.5, -0, 0.866025 ),
gmtl.Quatf(-0, -0.34202, -0, 0.939693 ),
gmtl.Quatf(-0, -0.173648, -0, 0.984808 ),
gmtl.Quatf(0, 0, 0, 1 ),
gmtl.Quatf(0, 0.173648, 0, 0.984808 ),
gmtl.Quatf(0, 0.34202, 0, 0.939693 ),
gmtl.Quatf(0, 0.5, 0, 0.866025 ),
gmtl.Quatf(0, 0.642788, 0, 0.766044 ),
gmtl.Quatf(0, 0.766044, 0, 0.642788 ),
gmtl.Quatf(0, 0.866025, 0, 0.5 ),
gmtl.Quatf(0, 0.939693, 0, 0.34202 ),
gmtl.Quatf(0, 0.984808, 0, 0.173648 ),
gmtl.Quatf(0, 1, 0, 0 ),
gmtl.Quatf(0, 0.984808, 0, -0.173648 ),
gmtl.Quatf(0, 0.939693, 0, -0.34202 ),
gmtl.Quatf(0, 0.866025, 0, -0.5 ),
gmtl.Quatf(0, 0.766044, 0, -0.642788 ),
gmtl.Quatf(0, 0.642788, 0, -0.766044 ),
gmtl.Quatf(0, 0.5, 0, -0.866025 ),
gmtl.Quatf(0, 0.34202, 0, -0.939693 ),
gmtl.Quatf(0, 0.173648, 0, -0.984808 ),
gmtl.Quatf(-0, 0, -0, -1 ),
]
count = 0
for x in xrange(-360, 360, 20):
assert count >= 0
q3 = gmtl.Quatf()
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(float(x)),
0.0, 1.0, 0.0))
gmtl.set(q3, gmtl.AxisAnglef(gmtl.Math.deg2Rad(float(x)),
gmtl.Vec3f(0.0, 1.0, 0.0)))
assert gmtl.isEqual(quats[count], q2, eps)
assert gmtl.isEqual(q3, q2, eps)
count += 1
def testQuatGetRot(self):
eps = 0.0001
vecs = [
gmtl.Vec4f( 6.28319, 1, 0, 0 ),
gmtl.Vec4f( 5.93412, -0, -1, -0 ),
gmtl.Vec4f( 5.58505, -0, -1, -0 ),
gmtl.Vec4f( 5.23599, -0, -1, -0 ),
gmtl.Vec4f( 4.88692, -0, -1, -0 ),
gmtl.Vec4f( 4.53786, -0, -1, -0 ),
gmtl.Vec4f( 4.18879, -0, -1, -0 ),
gmtl.Vec4f( 3.83972, -0, -1, -0 ),
gmtl.Vec4f( 3.49066, -0, -1, -0 ),
gmtl.Vec4f( 3.14159, -0, -1, -0 ),
gmtl.Vec4f( 2.79253, -0, -1, -0 ),
gmtl.Vec4f( 2.44346, -0, -1, -0 ),
gmtl.Vec4f( 2.0944, -0, -1, -0 ),
gmtl.Vec4f( 1.74533, -0, -1, -0 ),
gmtl.Vec4f( 1.39626, -0, -1, -0 ),
gmtl.Vec4f( 1.0472, -0, -1, -0 ),
gmtl.Vec4f( 0.698132, -0, -1, -0 ),
gmtl.Vec4f( 0.349066, -0, -0.999999, -0),
gmtl.Vec4f( 0, 1, 0, 0 ),
gmtl.Vec4f( 0.349066, 0, 0.999999, 0 ),
gmtl.Vec4f( 0.698132, 0, 1, 0 ),
gmtl.Vec4f( 1.0472, 0, 1, 0 ),
gmtl.Vec4f( 1.39626, 0, 1, 0 ),
gmtl.Vec4f( 1.74533, 0, 1, 0 ),
gmtl.Vec4f( 2.0944, 0, 1, 0 ),
gmtl.Vec4f( 2.44346, 0, 1, 0 ),
gmtl.Vec4f( 2.79253, 0, 1, 0 ),
gmtl.Vec4f( 3.14159, 0, 1, 0 ),
gmtl.Vec4f( 3.49066, 0, 1, 0 ),
gmtl.Vec4f( 3.83972, 0, 1, 0 ),
gmtl.Vec4f( 4.18879, 0, 1, 0 ),
gmtl.Vec4f( 4.53786, 0, 1, 0 ),
gmtl.Vec4f( 4.88692, 0, 1, 0 ),
gmtl.Vec4f( 5.23599, 0, 1, 0 ),
gmtl.Vec4f( 5.58505, 0, 1, 0 ),
gmtl.Vec4f( 5.93412, 0, 1, 0 ),
gmtl.Vec4f( 6.28319, 1, 0, 0 ),
]
q2 = gmtl.Quatf()
axis_angle = gmtl.AxisAnglef()
count = 0
for x in xrange(-360, 360, 20):
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(float(x)),
0.0, 1.0, 0.0))
gmtl.set(axis_angle, q2)
assert gmtl.isEqual(vecs[count], gmtl.Vec4f(axis_angle), eps)
count += 1
def testQuatMakeGetMakeRot(self):
eps = 0.0001
axis_angle = gmtl.AxisAnglef()
axis_angle1 = gmtl.AxisAnglef()
q2 = gmtl.Quatf()
q3 = gmtl.Quatf()
for x in xrange(-360, 360, 20):
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(float(x)),
0.0, 1.0, 0.0))
gmtl.set(axis_angle, q2)
gmtl.set(q3, axis_angle)
gmtl.set(axis_angle1, q3)
assert gmtl.isEqual(q3, q2, eps)
assert gmtl.isEqual(axis_angle1, axis_angle, eps)
class QuatGenMetricTest(unittest.TestCase):
def testGenTimingMakeInvert1(self):
q1 = gmtl.Quatf()
iters = 25000
for iter in xrange(iters):
q1 = gmtl.makeInvert(q1)
q2 = gmtl.Quatd()
for iter in xrange(iters):
q2 = gmtl.makeInvert(q2)
assert q1[0] != 10000.0
assert q2[0] != 10000.0
def testGenTimingMakeConj(self):
q1 = gmtl.Quatf()
iters = 50000
for iter in xrange(iters):
q1 = gmtl.makeConj(q1)
q2 = gmtl.Quatd()
for iter in xrange(iters):
q2 = gmtl.makeConj(q2)
assert q1[0] != 10000.0
assert q2[0] != 10000.0
def testGenTimingMakePure(self):
v1 = gmtl.Vec3d()
iters = 25000
for iter in xrange(iters):
q1 = gmtl.makePure(v1)
q1[2] -= v1[0]
v2 = gmtl.Vec3f()
for iter in xrange(iters):
q2 = gmtl.makePure(v2)
q2[2] += v2[0]
assert q2[0] != 10000.0
assert q1[0] != 10000.0
def testGenTimingMakeNormalQuat(self):
q1 = gmtl.Quatf()
iters = 25000
for iter in xrange(iters):
q1 = gmtl.makeNormal(q1)
q2 = gmtl.Quatd()
for iter in xrange(iters):
q2 = gmtl.makeNormal(q2)
assert q1[0] != 10000.0
assert q2[0] != 10000.0
def testGenTimingMakeRot(self):
v = 1.0
q1 = gmtl.Quatd()
iters = 25000
for iter in xrange(iters):
gmtl.set(q1, gmtl.makeNormal(gmtl.AxisAngled(v, v, v, v)))
v += q1[2]
v = 1.0
q2 = gmtl.Quatf()
for iter in xrange(iters):
gmtl.set(q2, gmtl.makeNormal(gmtl.AxisAnglef(v, v, v, v)))
v += q2[2]
v = 1.0
q3 = gmtl.Quatd()
for iter in xrange(iters):
gmtl.set(q3, gmtl.makeNormal(gmtl.AxisAngled(v, gmtl.Vec3d(v, v, v))))
v *= q3[1] + 1.234
v = 1.0
q4 = gmtl.Quatf()
for iter in xrange(iters):
gmtl.set(q4, gmtl.makeNormal(gmtl.AxisAnglef(v, gmtl.Vec3f(v, v, v))))
v *= q4[1] + 1.234
q5 = gmtl.Quatd()
v4 = gmtl.Vec3d(1, 2, 3)
v5 = gmtl.Vec3d(1, 2, 3)
for iter in xrange(iters):
q5 = gmtl.makeRotQuat(gmtl.makeNormal(v4), gmtl.makeNormal(v5))
v4[2] += q5[1] + 1.234
v5[2] += q5[1] + 1.234
q6 = gmtl.Quatf()
v6 = gmtl.Vec3f(1, 2, 3)
v7 = gmtl.Vec3f(1, 2, 3)
for iter in xrange(iters):
q6 = gmtl.makeRotQuat(gmtl.makeNormal(v6), gmtl.makeNormal(v7))
v6[2] += q6[1] + 1.234
v7[2] += q6[1] + 1.234
axis_angle = gmtl.AxisAnglef()
for iter in xrange(iters):
gmtl.set(axis_angle, q6)
q6[0] = axis_angle[0] + axis_angle[1] - axis_angle[2] - axis_angle[3]
axis_angle[0] += q6[1] + 1.234
axis_angle[1] -= q6[2] * -0.22 + 1.234
axis_angle[2] += q6[1] + 0.1
axis_angle[3] -= q6[2] - 0.99
assert v != 0.998 and v != 0.0988
assert q1[0] != 10000.0
assert q2[1] != 10000.0
assert q3[2] != 10000.0
assert q4[3] != 10000.0
assert q5[0] != 10000.0
assert q6[1] != 10000.0
def testGenTimingSetRot(self):
v = 1.0
q1 = gmtl.Quatd()
iters = 25000
for iter in xrange(iters):
gmtl.set(q1, gmtl.makeNormal(gmtl.AxisAngled(v, v, v, v)))
v += q1[2]
q2 = gmtl.Quatf()
v = 1.0
for iter in xrange(iters):
gmtl.set(q2, gmtl.makeNormal(gmtl.AxisAnglef(v, v, v, v)))
v -= q2[3]
q3 = gmtl.Quatd()
v = 1.0
for iter in xrange(iters):
gmtl.set(q3, gmtl.makeNormal(gmtl.AxisAngled(v, gmtl.Vec3d(v, v, v))))
v *= q3[1] + 1.2
q4 = gmtl.Quatf()
v = 1.0
for iter in xrange(iters):
gmtl.set(q4, gmtl.makeNormal(gmtl.AxisAnglef(v, gmtl.Vec3f(v, v, v))))
v += q4[1] + 1.2
q5 = gmtl.Quatd()
v4 = gmtl.Vec3d(1, 2, 3)
v5 = gmtl.Vec3d(1, 2, 3)
for iter in xrange(iters):
gmtl.setRot(q5, gmtl.makeNormal(v4), gmtl.makeNormal(v5))
v4[2] += q5[1] + 1.2
v5[2] += q5[2] + 1.2
q6 = gmtl.Quatd()
v6 = gmtl.Vec3d(1, 2, 3)
v7 = gmtl.Vec3d(1, 2, 3)
for iter in xrange(iters):
gmtl.setRot(q6, gmtl.makeNormal(v6), gmtl.makeNormal(v7))
v6[2] += q6[1] + 1.2
v7[2] += q6[2] + 1.2
assert v != 0.998 and v != 0.0998
assert q1[0] != 10000.0
assert q2[1] != 10000.0
assert q3[2] != 10000.0
assert q4[3] != 10000.0
assert q5[0] != 10000.0
assert q6[1] != 10000.0
class QuatOpsTest(unittest.TestCase):
def testQuatMult(self):
def testMult(q, eps = 0.0001):
sx = gmtl.Vec3f(1.0, 0.0, 0.0)
sy = gmtl.Vec3f(0.0, 1.0, 0.0)
sz = gmtl.Vec3f(0.0, 0.0, 1.0)
ex = gmtl.Vec3f(0.0, 0.0, -1.0)
ey = gmtl.Vec3f(-1.0, 0.0, 0.0)
ez = gmtl.Vec3f(0.0, 1.0, 0.0)
tx = q * sx
ty = q * sy
tz = q * sz
assert gmtl.isEqual(ex, tx, eps)
assert gmtl.isEqual(ey, ty, eps)
assert gmtl.isEqual(ez, tz, eps)
q3 = gmtl.makeRotMatrix44(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 1.0, 0.0))
q4 = gmtl.makeRotMatrix44(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 0.0, 1.0))
q6 = gmtl.Matrix44f()
# Make sure the mult() function works.
gmtl.mult(q6, q4, q3)
testMult(q6)
# Make sure the operator* works, too.
q6 = q4 * q3
testMult(q6)
# Make sure the operator*= works, too.
q6 = gmtl.Matrix44f(q4)
q6 *= q3
testMult(q6)
q3 = gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 1.0, 0.0))
q4 = gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 0.0, 1.0))
q6 = gmtl.Quatf()
# Make sure the mult() function works.
gmtl.mult(q6, q4, q3)
testMult(q6)
# Make sure the operator* works, too.
q6 = q4 * q3
testMult(q6)
# Make sure the operator*= works, too.
q6 = gmtl.Quatf(q4)
q6 *= q3
testMult(q6)
def testQuatDif(self):
def testMult(q, eps = 0.0001):
sx = gmtl.Vec3f(6.0, 0.0, 0.0)
sy = gmtl.Vec3f(0.0, 4.0, 0.0)
sz = gmtl.Vec3f(0.0, 0.0, 9.0)
ex = gmtl.Vec3f(0.0, 0.0, 6.0)
ey = gmtl.Vec3f(-4.0, 0.0, 0.0)
ez = gmtl.Vec3f(0.0, -9.0, 0.0)
tx = q * sx
ty = q * sy
tz = q * sz
assert gmtl.isEqual(ex, tx, eps)
assert gmtl.isEqual(ey, ty, eps)
assert gmtl.isEqual(ez, tz, eps)
q3 = gmtl.makeRotMatrix44(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 1.0, 0.0))
q4 = gmtl.makeRotMatrix44(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 0.0, 1.0))
q6 = gmtl.Matrix44f()
gmtl.invert(q3) # There is no matrix div, so do this to simulate it
# Make sure the mult() function works.
gmtl.mult(q6, q4, q3)
testMult(q6)
# Make sure the operator* works, too.
q6 = q4 * q3
testMult(q6)
# Make sure the operator*= works, too.
q6 = gmtl.Matrix44f(q4)
q6 *= q3
testMult(q6)
q3 = gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 1.0, 0.0))
q4 = gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
0.0, 0.0, 1.0))
q6 = gmtl.Quatf()
# Make sure the div() function works.
gmtl.div(q6, q4, q3)
testMult(q6)
# Make sure the operator/ works, too.
q6 = q4 / q3
testMult(q6)
# Make sure the operator/= works, too.
q6 = gmtl.Quatf(q4)
q6 /= q3
testMult(q6)
def testQuatVectorMult(self):
eps = 0.0001
q3 = gmtl.Quatf(1.0, 2.0, 3.0, 4.0)
q5 = gmtl.Quatf()
gmtl.mult(q5, q3, 23.0)
expected_result = gmtl.Quatf(1 * 23.0, 2 * 23.0, 3 * 23.0, 4 * 23.0)
assert gmtl.isEqual(expected_result, q5, eps)
def testQuatVectorAdd(self):
eps = 0.0001
q3 = gmtl.Quatf(1.0, 2.0, 3.0, 4.0)
q6 = gmtl.Quatf(2.0, 3.0, 4.0, 5.0)
q5 = gmtl.Quatf()
gmtl.add(q5, q3, q6)
expected_result = gmtl.Quatf(3.0, 5.0, 7.0, 9.0)
assert gmtl.isEqual(expected_result, q5, eps)
def testQuatVectorSub(self):
eps = 0.0001
q3 = gmtl.Quatf(1.0, 2.0, 3.0, 4.0)
q6 = gmtl.Quatf(2.0, 3.0, 4.0, 5.0)
q5 = gmtl.Quatf()
gmtl.sub(q5, q3, q6)
expected_result = gmtl.Quatf(-1.0, -1.0, -1.0, -1.0)
assert gmtl.isEqual(expected_result, q5, eps)
def testQuatVectorDot(self):
eps = 0.0001
assert isEqual(gmtl.dot(gmtl.Quatf(1.0, 0.0, 0.0, 0.0),
gmtl.Quatf(1.0, 0.0, 0.0, 0.0)),
1.0, eps)
assert isEqual(gmtl.dot(gmtl.Quatf(1.0, 0.0, 0.0, 0.0),
gmtl.Quatf(0.0, 1.0, 0.0, 0.0)),
0.0, eps)
assert isEqual(gmtl.dot(gmtl.Quatf(1.0, 1.0, 0.0, 0.0),
gmtl.Quatf(0.0, 1.0, 0.0, 0.0)),
1.0, eps)
assert isEqual(gmtl.dot(gmtl.Quatf(1.0, 0.0, 0.0, 10.0),
gmtl.Quatf(1.0, 0.0, 0.0, 223.0)),
2231.0, eps)
def testQuatNorm(self):
eps = 0.0001
q1 = gmtl.Quatf(1.0, 1.0, 1.0, 1.0)
assert isEqual(gmtl.lengthSquared(q1), 4.0, eps)
def testQuatMag(self):
eps = 0.0001
q1 = gmtl.Quatf(1.0, 1.0, 1.0, 1.0)
assert isEqual(gmtl.length(q1), 2.0, eps)
def testQuatNormalize(self):
eps = 0.0001
q3 = gmtl.Quatf(0.0, 0.0, 342334.0, 0.0)
q5 = gmtl.Quatf(342334.0, -342334.0, 342334.0, -342334.0)
gmtl.normalize(q3)
gmtl.normalize(q5)
expected_result1 = gmtl.Quatf(0.0, 0.0, 1.0, 0.0)
expected_result2 = gmtl.Quatf(0.5, -0.5, 0.5, -0.5)
assert gmtl.isEqual(expected_result1, q3, eps)
assert gmtl.isEqual(expected_result2, q5, eps)
def testQuatConj(self):
eps = 0.0001
q3 = gmtl.Quatf(0.0, 0.0, 342334.0, 0.0)
q5 = gmtl.Quatf(342334.0, -342334.0, 342334.0, -342334.0)
gmtl.conj(q3)
gmtl.conj(q5)
expected_result1 = gmtl.Quatf(0.0, 0.0, -342334.0, 0.0)
expected_result2 = gmtl.Quatf(-342334.0, 342334.0, -342334.0, -342334.0)
assert gmtl.isEqual(expected_result1, q3, eps)
assert gmtl.isEqual(expected_result2, q5, eps)
def testQuatNegate(self):
eps = 0.0001
q3 = gmtl.Quatf(0.0, 0.0, 342334.0, 0.0)
q5 = gmtl.Quatf(342334.0, -342334.0, 342334.0, -342334.0)
expected_result1 = gmtl.Quatf(0.0, 0.0, -342334.0, 0.0)
expected_result2 = gmtl.Quatf(-342334.0, 342334.0, -342334.0, 342334.0)
# Test operator-
assert gmtl.isEqual(expected_result1, -q3, eps)
assert gmtl.isEqual(expected_result2, -q5, eps)
# Test gmtl.negate(quat)
gmtl.negate(q3)
gmtl.negate(q5)
assert gmtl.isEqual(expected_result1, q3, eps)
assert gmtl.isEqual(expected_result2, q5, eps)
def testQuatInvert(self):
eps = 0.0001
q = gmtl.Quatf(0.2, 0.33, 0.44, 0.101)
expected_result = gmtl.Quatf(-0.567053, -0.935637, -1.24752, 0.286362)
q2 = gmtl.Quatf(q)
q3 = gmtl.invert(q2)
assert gmtl.isEqual(expected_result, q3, eps)
assert gmtl.isEqual(expected_result, q2, eps)
q4 = gmtl.makeInvert(q)
assert gmtl.isEqual(expected_result, q4, eps)
def testQuatLerp(self):
eps = 0.0001
q1 = gmtl.Quatf(1.0, 2.0, 3.0, 4.0)
q2 = gmtl.Quatf(9.0, 8.0, 7.0, 6.0)
# Make sure they are valid rotation quaternions.
gmtl.normalize(q1)
gmtl.normalize(q2)
expected_result1 = gmtl.Quatf(q1)
expected_result2 = gmtl.Quatf(q2)
res1 = gmtl.Quatf()
res2 = gmtl.Quatf()
gmtl.lerp(res1, 0.0, q1, q2)
gmtl.lerp(res2, 1.0, q1, q2)
assert gmtl.isEqual(expected_result1, res1, eps)
assert gmtl.isEqual(expected_result2, res2, eps)
def testQuatSlerp(self):
eps = 0.0001
q1 = gmtl.Quatf(100.0, 2.0, 3.0, 4.0)
q2 = gmtl.Quatf(9.01, 8.4, 7.1, 6.0)
# Make sure they are valid rotation quaternions.
gmtl.normalize(q1)
gmtl.normalize(q2)
expected_result1 = gmtl.Quatf(q1)
expected_result2 = gmtl.Quatf(q2)
res1 = gmtl.Quatf()
res2 = gmtl.Quatf()
gmtl.slerp(res1, 0.0, q1, q2)
gmtl.slerp(res2, 1.0, q1, q2)
assert gmtl.isEqual(expected_result1, res1, eps)
assert gmtl.isEqual(expected_result2, res2, eps)
quadrant = [
gmtl.Vec3f( 1.0, 1.0, 1.0),
gmtl.Vec3f(-1.0, 1.0, 1.0),
gmtl.Vec3f(-1.0, 1.0, -1.0),
gmtl.Vec3f( 1.0, 1.0, -1.0),
gmtl.Vec3f( 1.0, -1.0, -1.0),
gmtl.Vec3f( 1.0, -1.0, 1.0),
gmtl.Vec3f(-1.0, -1.0, 1.0),
gmtl.Vec3f(-1.0, -1.0, -1.0)
]
q0 = [
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
]
q180 = [
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
]
q90 = [
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
]
q_0001 = [
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
gmtl.Quatf(),
]
for x in range(len(quadrant)):
gmtl.normalize(quadrant[x])
gmtl.setRot(q0[x], gmtl.AxisAnglef(gmtl.Math.deg2Rad(0.0),
quadrant[x]))
gmtl.setRot(q180[x], gmtl.AxisAnglef(gmtl.Math.deg2Rad(180.0),
quadrant[x]))
gmtl.setRot(q90[x], gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
quadrant[x]))
gmtl.setRot(q_0001[x], gmtl.AxisAnglef(gmtl.Math.deg2Rad(0.0001),
quadrant[x]))
# same yields same.
result = gmtl.Quatf()
gmtl.slerp(result, 0.0, q0[x], q0[x]) # yields q0[x]
assert result == q0[x]
gmtl.slerp(result, 0.5, q0[x], q0[x]) # yields q0[x]
assert result == q0[x]
gmtl.slerp(result, 1.0, q0[x], q0[x]) # yields q0[x]
assert result == q0[x]
# # 180 degree - there is more then one valid path to take.
# gmtl.slerp(result, 0.0, q0[x], q180[x]) # yields q0[x]
# gmtl.slerp(result, 0.5, q0[x], q180[x]) # yields shortest path
# gmtl.slerp(result, 1.0, q0[x], q180[x]) # yields q90[x]
#
# # 90 degree
# gmtl.slerp(result, 0.0, q0[x], q90[x]) # yields q0[x]
# gmtl.slerp(result, 0.5, q0[x], q90[x]) # yields shortest path
# gmtl.slerp(result, 1.0, q0[x], q90[x]) # yields q90[x]
#
# # 0.0001 degree
# gmtl.slerp(result, 0.0, q0[x], q_0001[x]) # yields q0[x]
# gmtl.slerp(result, 0.5, q0[x], q_0001[x]) # yields shortest path
# gmtl.slerp(result, 1.0, q0[x], q_0001[x]) # yields q90[x]
class QuatOpsMetricTest(unittest.TestCase):
def testQuatTimingNegate(self):
q4 = gmtl.Quatf()
iters = 25000
for iter in xrange(iters):
gmtl.negate(q4)
q4[1] += q4[2]
assert q4[2] != 1234.5
def testQuatTimingOperatorMinus(self):
q4 = gmtl.Quatf()
iters = 25000
for iter in xrange(iters):
q4 = -q4
q4[1] += q4[2]
assert q4[2] != 1234.5
def testQuatTimingMult(self):
q2 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 25000
for iter in xrange(iters):
gmtl.mult(q4, q2, q4)
assert q4[2] != 1234.5
def testQuatTimingOperatorMult(self):
q2 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
q4 = q2 * q4
assert q4[2] != 1234.5
def testQuatTimingDiv(self):
q3 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.div(q4, q4, q3)
assert q4[2] != 1234.5
def testQuatTimingLerp(self):
qfrom = gmtl.Quatf()
result = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.lerp(result, float(iter) / float(iters), qfrom, result)
assert result[2] != 1234.5
for iter in xrange(iters):
gmtl.slerp(result, float(iter) / float(iters), qfrom, result)
assert result[2] != 1234.5
def testQuatTimingVectorMult(self):
q3 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.mult(q4, q3, q4[2])
assert q4[2] != 1234.5
def testQuatTimingVectorAss(self):
q3 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.add(q4, q4, q3)
assert q4[2] != 1234.5
def testQuatTimingVectorSub(self):
q3 = gmtl.Quatf()
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.sub(q4, q4, q3)
assert q4[2] != 1234.5
def testQuatTimingVectorDot(self):
q1 = gmtl.Quatf()
q2 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
q1[2] += gmtl.dot(q1, q2)
assert q1[2] != 1234.5
def testQuatTimingNorm(self):
q1 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
q1[2] += gmtl.lengthSquared(q1)
assert q1[2] != 1234.5
def testQuatTimingMag(self):
q1 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
q1[2] += gmtl.length(q1)
assert q1[2] != 1234.5
def testQuatTimingNormalize(self):
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.normalize(q4)
assert q4[2] != 1234.5
def testQuatTimingConj(self):
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.conj(q4)
assert q4[2] != 1234.5
def testQuatTimingInvert(self):
q4 = gmtl.Quatf()
iters = 10000
for iter in xrange(iters):
gmtl.invert(q4)
assert q4[2] != 1234.5
class QuatStuffTest(unittest.TestCase):
def makeRotTest(self):
q1 = gmtl.Quatf()
q2 = gmtl.Quatf()
q3 = gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), 0.0, 1.0, 0.0))
q4 = gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
gmtl.normalize(q3)
gmtl.normalize(q4)
# Make sure that normalize doesn't change the rotation.
assert gmtl.isEqual(q1, q3, 0.0001)
assert gmtl.isEqual(q2, q4, 0.0001)
assert gmtl.isEqual(q1, gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), 0.0, 1.0, 0.0)), 0.0001)
assert gmtl.isEqual(q1, gmtl.makeRotQuat(gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0)), 0.0001)
# Set the euler parameters from the given quat.
axis_angle = gmtl.AxisAnglef()
gmtl.set(axis_angle, q1)
assert gmtl.isEqual(axis_angle,
gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0),
0.0, 1.0, 0.0),
0.0001)
gmtl.set(axis_angle, q2)
assert gmtl.isEqual(axis_angle,
gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
1.0, 0.0, 0.0),
0.0001)
def testXformVecSweep(self):
q = gmtl.Quatf()
q2 = gmtl.Quatf()
v = gmtl.Vec3f(0.0, 0.0, 1.0)
for x in range(180, 90):
gmtl.set(q, gmtl.AxisAnglef(gmtl.Math.deg2Rad(x), 1.0, 0.0, 0.0))
result = gmtl.Vec3f(q * v)
if x == 0:
assert result[0] < 0.001 and result[1] < 0.001 and \
result[2] > 0.999
if x == 90:
assert result[0] < 0.001 and result[1] < -0.999 and \
result[2] < 0.001
if x == 180:
assert result[0] < 0.001 and result[1] < 0.0001 and \
result[2] < -0.999
def testMakeRotGetRotSanity(self):
def round(x):
return math.floor(x + 0.5)
# Testing sanity of gmtl.makeRot() and gmtl.set(), the gmtl.makeRot()
for i in xrange(-360, 360, 20):
q = gmtl.Quatf()
gmtl.set(q, gmtl.AxisAnglef(gmtl.Math.deg2Rad(i), 1.0, 0.0, 0.0))
# Set euler parameters from quaternion.
axis_angle = gmtl.AxisAnglef()
gmtl.set(axis_angle, q)
# Set quaternion from euler parameters.
q2 = gmtl.Quatf()
gmtl.set(q2, axis_angle)
sanity = gmtl.Quatf()
gmtl.set(sanity, axis_angle)
assert q2 == sanity
assert gmtl.isEqual(q, q2, 0.0001)
b = float(i)
while b < 0.0:
b += 360.0
if i >= 0:
c = math.fabs(round(b) % 360)
temp1 = gmtl.rad2Deg(axis_angle.getAngle())
temp1 = round(temp1) % 360
temp2 = c + 0.5
temp3 = gmtl.Math.rad2Deg(axis_angle.getAngle())
temp3 = round(temp3) % 360
temp4 = c - 0.5
assert temp1 <= temp2 and temp3 >= temp4
def testSimpleQuatProduct(self):
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(0.0, 1.0, 0.0, 0.0))
q2 = gmtl.Quatf()
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
# First rotate by q2, then by q1.
q3 = q1 * q2
v = gmtl.Vec3f(0.0, 1.0, 0.0)
r = q3 * v
assert r[2] > 0.99
def testSecondQuatProduct(self):
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), 0.0, 1.0, 0.0))
q2 = gmtl.Quatf()
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
# First rotate by q2, then by q1.
q3 = q1 * q2
v = gmtl.Vec3f(0.0, 1.0, 0.0)
r = q3 * v
assert r[0] > 0.7 and r[2] > 0.7
def testXformVec(self):
q1 = gmtl.Quatf()
q2 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), 0.0, -1.0, 0.0))
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(45.0), 1.0, 0.0, 0.0))
v = gmtl.Vec3f(0.0, 1.0, 0.0)
# Should not move.
r = q1 * v
assert r[1] > 0.999
# Rotate forward.
r = q2 * v
assert r[1] > 0.7 and r[2] > 0.7
def testSpecialCases(self):
q = gmtl.Quatf(0.0, -0.000313354, 0.0, 1.0)
axis_angle = gmtl.AxisAnglef()
gmtl.set(axis_angle, q)
half_angle = 0.000626708 * 0.5
sin_half_angle = math.sin(half_angle)
w = math.cos(half_angle)
sin_half_angle += 1.0 # use sin_half_angle
w += 1.0 # use w
qqq = gmtl.Quatf()
gmtl.set(qqq, gmtl.AxisAnglef(gmtl.Math.deg2Rad(180.0), 0.0, 1.0, 0.0))
assert isEqual(qqq[gmtl.VectorIndex.Welt], 0.0, 0.0001) and \
qqq[gmtl.VectorIndex.Xelt] == 0.0 and \
isEqual(qqq[gmtl.VectorIndex.Yelt], 1.0, 0.0001) and \
qqq[gmtl.VectorIndex.Zelt] == 0.0
def testVectorScale(self):
for x in xrange(360):
q = gmtl.Quatf()
gmtl.set(q, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(x),
0.7, 0.7, 0.7)))
q2 = gmtl.Quatf()
gmtl.mult(q2, q, 0.5)
# No longer a valid rotation (non-unit length).
# Should be normalized to define an actual rotation.
assert not gmtl.isNormalized(q2)
# axis_angle = gmtl.AxisAnglef()
# gmtl.set(axis_angle, q2)
for x in xrange(360):
q = gmtl.Quatf()
gmtl.set(q, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(x),
0.7, 0.7, 0.7)))
q2 = gmtl.Quatf()
gmtl.mult(q2, q, 0.5)
gmtl.normalize(q2)
assert gmtl.isEqual(q2, q, 0.0001)
def testQuatAdd(self):
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
q2 = gmtl.Quatf()
gmtl.set(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(180.0), 1.0, 0.0, 0.0))
q = gmtl.Quatf()
gmtl.add(q, q1, q2)
gmtl.normalize(q)
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
q = gmtl.Quatf()
q = q1 * q
def testPureQuatMult(self):
for x in xrange(100):
w = gmtl.Vec3f(0.0, x, 0.0) # angular velocity
wq = gmtl.makePure(w)
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 1.0, 0.0))
q2 = wq * q1
ww = gmtl.Vec3f(0.0, 56.0, 0.0)
wq = gmtl.makePure(ww)
q1 = gmtl.Quatf()
gmtl.set(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 1.0, 0.0))
w1 = wq[gmtl.VectorIndex.Welt]
w2 = q1[gmtl.VectorIndex.Welt]
v1 = gmtl.Vec3f(wq[gmtl.VectorIndex.Xelt], wq[gmtl.VectorIndex.Yelt],
wq[gmtl.VectorIndex.Zelt])
v2 = gmtl.Vec3f(q1[gmtl.VectorIndex.Xelt], q1[gmtl.VectorIndex.Yelt],
q1[gmtl.VectorIndex.Zelt])
w = w1 * w2 - gmtl.dot(v1, v2)
v = (v2 * w1) + (v1 * w2) + gmtl.makeCross(v1, v2)
w += 1.0 # use w
v[0] += 1.0 # use v
class SphereTest(unittest.TestCase):
def testCreation(self):
test_sph = gmtl.Spheref()
assert test_sph.center[0] == 0.0
assert test_sph.center[1] == 0.0
assert test_sph.center[2] == 0.0
assert test_sph.radius == 0.0
def testCopyConstruct(self):
test_sph = gmtl.Spheref()
test_sph.center[0] = 2.0
test_sph.center[1] = 4.0
test_sph.center[2] = 8.0
test_sph.radius = 25.0
test_sph_copy = gmtl.Spheref(test_sph)
assert test_sph_copy.center[0] == 2.0
assert test_sph_copy.center[1] == 4.0
assert test_sph_copy.center[2] == 8.0
assert test_sph_copy.radius == 25.0
def testConstructors(self):
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
assert test_sph.center[0] == 1.0
assert test_sph.center[1] == 2.0
assert test_sph.center[2] == 3.0
assert test_sph.radius == 25
def testGetCenter(self):
center = gmtl.Point3f(1.0, 2.0, 3.0)
test_sph = gmtl.Spheref(center, 25.0)
assert test_sph.getCenter() == center
def testGetRadius(self):
radius = 25.0
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), radius)
assert test_sph.getRadius() == radius
def testSetCenter(self):
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
center = gmtl.Point3f(2.0, 4.0, 1.0)
test_sph.setCenter(center)
assert test_sph.getCenter() == center
def testSetRadius(self):
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
test_sph.setRadius(45.0)
assert test_sph.getRadius() == 45.0
def testEqualityCompare(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 4.0)
test_sph2 = gmtl.Spheref(test_sph1)
assert test_sph1 == test_sph2
assert not test_sph1 != test_sph2
# Set equal, vary center.
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.center[0] = 21.10
assert test_sph1 != test_sph2
assert not test_sph1 == test_sph2
# Set equal, vary radius.
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.radius = 21.10
assert test_sph1 != test_sph2
assert not test_sph1 == test_sph2
def testIsEqual(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 4.0)
test_sph2 = gmtl.Spheref(test_sph1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_sph1, test_sph2, eps)
eps += 0.05
test_sph1.center.set(1.0, 1.0, 1.0)
test_sph1.radius = 1.0
for elt in range(4):
test_sph2 = gmtl.Spheref(test_sph1)
if elt < 3:
test_sph2.center[elt] = 21.0
else:
test_sph2.radius = 21.0
assert not gmtl.isEqual(test_sph1, test_sph2, 10.0)
assert not gmtl.isEqual(test_sph1, test_sph2, 19.9)
assert gmtl.isEqual(test_sph1, test_sph2, 20.1)
assert gmtl.isEqual(test_sph1, test_sph2, 22.0)
def testIsInVolumePoint(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
pt = gmtl.Point3f(0.5, 0.5, 0.5)
assert gmtl.isInVolume(test_sph, pt)
pt[0] = 5.0
assert not gmtl.isInVolume(test_sph, pt)
def testIsInVolumeSphere(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
sph = gmtl.Spheref(gmtl.Point3f(0.5, 0.5, 0.5), 2.0)
assert gmtl.isInVolume(test_sph, sph)
sph.center[0] = 5.0
assert not gmtl.isInVolume(test_sph, sph)
def testIsOnVolume(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
pt = gmtl.Point3f(0.0, 0.0, 4.0)
# Zero tolerance.
assert gmtl.isOnVolume(test_sph, pt)
pt[0] = 1.0
assert not gmtl.isOnVolume(test_sph, pt)
# Epsilon tolerance.
pt.set(0.0, 0.0, 4.0)
eps = 0.0
while eps < 10.0:
assert gmtl.isOnVolume(test_sph, pt, eps)
eps += 0.05
for elt in range(3):
pt.set(0.0, 0.0, 0.0)
pt[elt] = 2.0
assert gmtl.isOnVolume(test_sph, pt, 21.0)
assert gmtl.isOnVolume(test_sph, pt, 2.0)
assert not gmtl.isOnVolume(test_sph, pt, 1.9)
assert not gmtl.isOnVolume(test_sph, pt, 1.0)
def testExtendVolumePoint(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 1.0)
pt1 = gmtl.Point3f(2.0, 0.0, 0.0)
pt2 = gmtl.Point3f(pt1)
for elt in range(3):
test_sph2 = gmtl.Spheref(test_sph1)
pt1.set(0.0, 0.0, 0.0)
pt1[elt] = 3.0
pt2.set(0.0, 0.0, 0.0)
pt2[elt] = 1.0
gmtl.extendVolume(test_sph2, pt1)
assert test_sph2.center == pt2
assert test_sph2.radius == 2.0
def testExtendVolumeSphere(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 0.0)
sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 0.0)
pt1 = gmtl.Point3f(0.0, 0.0, 0.0)
for elt in range(3):
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.center.set(0.0, 0.0, 0.0)
test_sph2.radius = 1.0
sph.center.set(0.0, 0.0, 0.0)
sph.center[elt] = 5.0
sph.radius = 2.0
pt1.set(0.0, 0.0, 0.0)
pt1[elt] = 3.0
gmtl.extendVolume(test_sph2, sph)
assert test_sph2.center == pt1
assert test_sph2.radius == 4.0
def testMakeVolumePoint(self):
test_sph = gmtl.Spheref()
pts = [
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 5.0, 0.0),
gmtl.Point3f(0.0, 5.0, 10.0),
gmtl.Point3f(0.0, 5.0, -10.0),
]
gmtl.makeVolume(test_sph, pts)
pt = gmtl.Point3f(0.25, 3.75, 0.0)
assert isEqual(test_sph.radius, 10.08, 0.01)
assert test_sph.center == pt
def __testSphereIntersect(self, x, y, z):
# Point.
# In
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
point = gmtl.Point3f(x, y, z)
assert gmtl.intersect(sphere, point)[0]
# Out
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
point = gmtl.Point3f(1.0001 + x, y, z)
assert not gmtl.intersect(sphere, point)[0]
# On
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
point = gmtl.Point3f(x, y, z - 1.0)
assert gmtl.intersect(sphere, point)[0]
# Shell tests, only register hits with the surface of the sphere.
# Ray
# origin to out
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(x, y, z), gmtl.Vec3f(1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 1
assert t0 == 1.0
# interior point to out
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(0.5 + x, y, z), gmtl.Vec3f(1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 1
assert t0 == 0.5
# edge to in
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(1.0 + x, y, z), gmtl.Vec3f(-1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 2.0
# edge to out
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(1.0 + x, y, z), gmtl.Vec3f(1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 1
assert t0 == 0.0
# outside through 1 edge (tangent surface)
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(1.0 + x, -1.0 + y, z),
gmtl.Vec3f(0.0, 1.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 1
assert t0 == 1.0
# outside through 2 edges
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(0.0 + x, -4.0 + y, 0.0 + z),
gmtl.Vec3f(0.0, 1.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
assert hits == 2
assert t0 == 3.0
assert t1 == 5.0
# outside to near miss
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(1.0001 + x, -1.0 + y, z),
gmtl.Vec3f(0.0, 1.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == False
# outside to away
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(x, 6.0 + y, z), gmtl.Vec3f(0.0, 1.0, 0.0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == False
# LineSeg
# origin to interior point
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, y, z), gmtl.Vec3f(0.5, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# origin to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, y, z), gmtl.Vec3f(4.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 0.25
# interior point to origin
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(0.5 + x, y, z),
gmtl.Vec3f(-0.5, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# interior point to interoir point
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(0.5 + x, y, z),
gmtl.Vec3f(-1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# interior point to edge
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, 0.5 + y, z),
gmtl.Vec3f(0.0, -1.5, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# interior point to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, y, z + 0.5),
gmtl.Vec3f(0.0, 0.0, -2.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert isEqual(t1, 0.75, 0.0001)
# edge to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(1.0 + x, y, z),
gmtl.Vec3f(-1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# edge to interior point
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(1.0 + x, y, z),
gmtl.Vec3f(-1.5, 0.2, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# edge to edge
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(1.0 + x, y, z),
gmtl.Vec3f(-2.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 1.0
# edge through edge to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(1.0 + x, y, z),
gmtl.Vec3f(-4.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 0.5
# edge to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(1.0 + x, y, z),
gmtl.Vec3f(45.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.0
assert t1 == 0.0
# outside to origin
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(2.0 + x, y, z),
gmtl.Vec3f(-2.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.5
assert t1 == 1.0
# outside to interior point
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, 1.5 + y, z),
gmtl.Vec3f(0.0, -2.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.25
assert t1 == 1.0
# outside to edge
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, y, 45.0 + z),
gmtl.Vec3f(0.0, 0.0, -44.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert isEqual(t0, 1.0, 0.00001)
assert isEqual(t1, 1.0, 0.00001)
# outside through 1 edge (tangent surface) to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, -2.0 + y, 1.0 + z),
gmtl.Vec3f(0.0, 4.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 1
assert t0 == 0.5
# outside through 2 edges to outside
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, -2.0 + y, z),
gmtl.Vec3f(0.0, 4.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == True
assert hits == 2
assert t0 == 0.25
assert t1 == 0.75
# outside to outside near miss
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(x, y - 2.0, z + 1.0001),
gmtl.Vec3f(0.0, 4.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == False
# outside to outside away from sphere
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(2.0 + x, y, z + 1.0001),
gmtl.Vec3f(2.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == False
# outside to outside towards sphere
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
lineseg = gmtl.LineSegf(gmtl.Point3f(3.0 + x, y, z),
gmtl.Vec3f(-1.0, 0.0, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, lineseg)
assert result == False
def testSphereIntersections(self):
x = -5.0
while x < 5.0:
y = -5.0
while y < 5.0:
z = -5.0
while z < 5.0:
self.__testSphereIntersect(x * 10.0, y * 10.0, z * 10.0)
z += 0.75
y += 1.25
x += 0.5
# Other misc tests.
x = 0.0
y = 0.0
z = 0.0
g = -2.0
while g < 2.0:
sphere = gmtl.Spheref(gmtl.Point3f(x, y, z), 1)
ray = gmtl.Rayf(gmtl.Point3f(x, y, z), gmtl.Vec3f(0, g, 0))
(result, hits, t0, t1) = gmtl.intersect(sphere, ray)
assert result == True
g+= 0.01
# Some real world data sampled from a game while an actor was standing
# still inside a sphere.
sphere = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 2.0)
ray = gmtl.LineSegf(gmtl.Point3f(-0.054072, -0.22992, -0.120733),
gmtl.Vec3f(0.0, -0.000000119209, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, ray)
assert result == True
sphere = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 2.0)
ray = gmtl.LineSegf(gmtl.Point3f(-0.143958, -0.229931, -0.013235),
gmtl.Vec3f(0.0, 0.000000119209, 0.0))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, ray)
assert result == True
sphere = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 2.0)
ray = gmtl.LineSegf(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Vec3f(0.0, 0.0, 0.105271))
(result, hits, t0, t1) = gmtl.intersectVolume(sphere, ray)
assert result == True
class SphereMetricTest(unittest.TestCase):
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_sph2 = gmtl.Spheref()
use_value += test_sph2.radius + 1.0
assert use_value > 0.0
def testTmingCopyConstruct(self):
iters = 400000
test_sph2 = gmtl.Spheref()
test_sph2.center[0] = 2.0
use_value = 0.0
for iter in xrange(iters):
test_sph2_copy = gmtl.Spheref(test_sph2)
use_value += test_sph2_copy.center[0]
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_sph2 = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
use_value += test_sph2.center[0]
def testTimingGetCenter(self):
center = gmtl.Point3f(1.0, 2.0, 3.0)
test_sph = gmtl.Spheref(center, 25.0)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
center = test_sph.getCenter()
use_value += center[0]
def testTimingGetRadius(self):
radius = 25.0
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), radius)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
radius = test_sph.getRadius()
use_value += radius
def testTimingSetCenter(self):
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
center = gmtl.Point3f(2.0, 4.0, 1.0)
iters = 400000
for iter in xrange(iters):
center.set(iter, iter, iter)
test_sph.setCenter(center)
def testTimingSetRadius(self):
test_sph = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 25.0)
center = gmtl.Point3f(2.0, 4.0, 1.0)
use_value = 1.0
iters = 400000
for iter in xrange(iters):
test_sph.setRadius(iter)
use_value += test_sph.radius
def testTimingEqualityCompare(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 4.0)
test_sph2 = gmtl.Spheref(test_sph1)
iters = 400000
true_count = 0
false_count = 0
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 2000.0
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.radius = 1000.0
for iter in xrange(iters):
test_sph1.radius += 1.0
test_sph2.radius += 2.0
if test_sph1 == test_sph2:
true_count += 1
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 2000.0
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.radius = 1000.0
for iter in xrange(iters):
test_sph1.radius += 1.0
test_sph2.radius += 2.0
if test_sph1 != test_sph2:
false_count += 1
def testTimingIsEqual(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(1.0, 2.0, 3.0), 4.0)
test_sph2 = gmtl.Spheref(test_sph1)
iters = 400000
true_count = 0
false_count = 0
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 2000.0
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.radius = 1000.0
for iter in xrange(iters):
test_sph1.radius += 1.0
test_sph2.radius += 2.0
if gmtl.isEqual(test_sph1, test_sph2, 1.0):
true_count += 1
if gmtl.isEqual(test_sph1, test_sph2, 0.1):
true_count += 1
if gmtl.isEqual(test_sph1, test_sph2, 100000.0):
true_count += 1
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 2000.0
test_sph2 = gmtl.Spheref(test_sph1)
test_sph2.radius = 1000.0
for iter in xrange(iters):
test_sph1.radius += 1.0
test_sph2.radius += 2.0
if test_sph1 != test_sph2:
false_count += 1
def testTimingIsInVolumePoint(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
pt = gmtl.Point3f(0.5, 0.5, 0.5)
iters = 400000
true_count = 0
pt.set(0.0, 0.0, 0.0)
for iter in xrange(iters):
pt[0] += 0.05
if gmtl.isInVolume(test_sph, pt):
true_count += 1
def testTimingIsInVolumeSphere(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
sph = gmtl.Spheref(gmtl.Point3f(0.5, 0.5, 0.5), 2.0)
iters = 400000
true_count = 0
sph.center.set(0.0, 0.0, 0.0)
for iter in xrange(iters):
sph.center[0] += 0.05
if gmtl.isInVolume(test_sph, sph):
true_count += 1
def testTimingIsOnVolume(self):
test_sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 4.0)
pt = gmtl.Point3f(0.0, 0.0, 4.0)
iters = 400000
true_count = 0
eps = 0.0
pt.set(0.0, 0.0, 0.0)
for iter in xrange(iters):
eps += 0.01
pt[2] += 0.1
if gmtl.isOnVolume(test_sph, pt, eps):
true_count += 1
if gmtl.isOnVolume(test_sph, pt):
true_count += 1
def testTimingExtendVolumePoint(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 1.0)
pt1 = gmtl.Point3f(2.0, 0.0, 0.0)
iters = 400000
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 0.0
pt1.set(0.0, 0.0, 0.0)
for iter in xrange(iters):
pt1[0] += 2.0
pt1[1] += 1.0
pt1[2] += 2.5
gmtl.extendVolume(test_sph1, pt1)
def testTimingExtendVolumeSphere(self):
test_sph1 = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 0.0)
sph = gmtl.Spheref(gmtl.Point3f(0.0, 0.0, 0.0), 0.0)
iters = 400000
test_sph1.center.set(0.0, 0.0, 0.0)
test_sph1.radius = 0.0
sph.center.set(0.0, 0.0, 0.0)
sph.radius = 0.0
for iter in xrange(iters):
sph.center[0] += 2.0
sph.center[1] += 1.0
sph.center[2] += 2.5
sph.radius = 0.5
gmtl.extendVolume(test_sph1, sph)
def testTimingMakeVolumePoint(self):
test_sph = gmtl.Spheref()
pts = []
iters = 2500
for i in range(100):
pt = gmtl.Point3f()
pt[0] = random.randrange(-10000, 10000)
pt[1] = random.randrange(-10000, 10000)
pt[2] = random.randrange(-10000, 10000)
pts.append(pt)
for iter in xrange(iters):
pts[iter % len(pts)][2] += 12.0
gmtl.makeVolume(test_sph, pts)
class TriTest(unittest.TestCase):
def testCreation(self):
test_tri = gmtl.Trif()
zero = gmtl.Point3f(0.0, 0.0, 0.0)
assert test_tri[0] == zero
assert test_tri[1] == zero
assert test_tri[2] == zero
def testCopyConstruct(self):
test_tri = gmtl.Trif()
test_tri[0][0] = 2.0
test_tri[1][1] = 4.0
test_tri[2][2] = 1.0
test_tri_copy = gmtl.Trif(test_tri)
assert test_tri_copy[0][0] == 2.0
assert test_tri_copy[1][1] == 4.0
assert test_tri_copy[2][2] == 1.0
def testConstructors(self):
test_tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 1.0, 0.0))
zero = gmtl.Point3f(0.0, 0.0, 0.0)
unitX = gmtl.Point3f(1.0, 0.0, 0.0)
unitY = gmtl.Point3f(0.0, 1.0, 0.0)
assert test_tri[0] == zero
assert test_tri[1] == unitX
assert test_tri[2] == unitY
def testVertexAccessor(self):
pt0 = gmtl.Point3f(2.0, 0.0, -5.0)
pt1 = gmtl.Point3f(1.0, 2.0, -5.0)
pt2 = gmtl.Point3f(1.0, -2.0, -5.0)
test_tri = gmtl.Trif(pt0, pt1, pt2)
assert test_tri[0] == pt0
assert test_tri[1] == pt1
assert test_tri[2] == pt2
def testEdges(self):
p0 = gmtl.Point3f(0.0, 0.0, 0.0)
p1 = gmtl.Point3f(1.0, 0.0, 0.0)
p2 = gmtl.Point3f(0.0, 1.0, 0.0)
test_tri = gmtl.Trif(p0, p1, p2)
e0 = gmtl.Vec3f(p1 - p0)
e1 = gmtl.Vec3f(p2 - p1)
e2 = gmtl.Vec3f(p0 - p2)
assert test_tri.edge(0) == e0
assert test_tri.edge(1) == e1
assert test_tri.edge(2) == e2
def testEqualOps(self):
test_tri1 = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 1.0, 0.0))
test_tri2 = gmtl.Trif(test_tri1)
test_tri3 = gmtl.Trif(test_tri1)
test_tri3[0][1] = 2.0
assert test_tri1 == test_tri1
assert not test_tri1 != test_tri1
assert test_tri1 == test_tri2
assert not test_tri1 != test_tri2
assert test_tri2 == test_tri1
assert not test_tri2 != test_tri1
assert not test_tri1 == test_tri3
assert test_tri1 != test_tri3
assert not test_tri3 == test_tri1
assert test_tri3 != test_tri1
def testIsEqual(self):
test_tri1 = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 0.0, 0.0),
gmtl.Point3f(1.0, 2.0, 0.0))
test_tri2 = gmtl.Trif(test_tri1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_tri1, test_tri2, eps)
eps += 0.05
for p in range(3):
for elt in range(3):
test_tri2 = gmtl.Trif(test_tri1)
test_tri2[p][elt] += 20.0
assert not gmtl.isEqual(test_tri1, test_tri2, 10.0)
assert not gmtl.isEqual(test_tri1, test_tri2, 19.9)
assert gmtl.isEqual(test_tri1, test_tri2, 20.1)
assert gmtl.isEqual(test_tri1, test_tri2, 22.0)
def testCenter(self):
test_tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(4.0, 0.0, 0.0),
gmtl.Point3f(2.0, 4.0, 0.0))
center = gmtl.center(test_tri)
correct_center = gmtl.Vec3f(2, (4.0 / 3.0), 0)
assert center == correct_center
def testNormal(self):
test_tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(4.0, 0.0, 0.0),
gmtl.Point3f(2.0, 4.0, 0.0))
normal = gmtl.normal(test_tri)
correct_normal = gmtl.Vec3f(0.0, 0.0, 1.0)
assert normal == correct_normal
class TriMetricTest(unittest.TestCase):
def testTimingCreation(self):
iters = 400000
for iter in xrange(iters):
test_tri2 = gmtl.Trif()
test_tri2[0][0] = 1.0
def testTimingCopyConstruct(self):
iters = 400000
test_tri2 = gmtl.Trif()
test_tri2[0][0] = 2.0
use_value = 0.0
for iter in xrange(iters):
test_tri2_copy = gmtl.Trif(test_tri2)
use_value += test_tri2_copy[0][0]
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_tri2 = gmtl.Trif(gmtl.Point3f(1.0, 0.0, -5.0),
gmtl.Point3f(1.0, 2.0, -5.0),
gmtl.Point3f(1.0, -2.0, -5.0))
use_value += test_tri2[0][0]
def testTimingVertexAccessor(self):
pt0 = gmtl.Point3f(2.0, 0.0, -5.0)
pt1 = gmtl.Point3f(1.0, 2.0, -5.0)
pt2 = gmtl.Point3f(1.0, -2.0, -5.0)
test_tri = gmtl.Trif(pt0, pt1, pt2)
use_value = 0.0
iters = 400000
for iter in xrange(iters):
ptr0 = test_tri[0]
use_value += pt0[0]
def testTimingEdges(self):
p0 = gmtl.Point3f(0.0, 0.0, 0.0)
p1 = gmtl.Point3f(1.0, 0.0, 0.0)
p2 = gmtl.Point3f(0.0, 1.0, 0.0)
test_tri = gmtl.Trif(p0, p1, p2)
e0 = gmtl.Vec3f(p1 - p0)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
e0 = test_tri.edge(iter % 3)
use_value += e0[0]
def testTimingEqualOps(self):
test_tri1 = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(1.0, 0.0, 0.0),
gmtl.Point3f(0.0, 1.0, 0.0))
test_tri2 = gmtl.Trif(test_tri1)
test_tri3 = gmtl.Trif(test_tri1)
iters = 400000
true_values = 0
for iter in xrange(iters):
if test_tri1 == test_tri2:
true_values += 1
if test_tri1 != test_tri2:
true_values += 1
if test_tri1 == test_tri3:
true_values += 1
if test_tri1 != test_tri3:
true_values += 1
def testTimingIsEqual(self):
test_tri1 = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(2.0, 0.0, 0.0),
gmtl.Point3f(1.0, 2.0, 0.0))
test_tri2 = gmtl.Trif(test_tri1)
iters = 400000
true_count = 0
for iter in xrange(iters):
if gmtl.isEqual(test_tri1, test_tri2, 1.0):
true_count += 1
if gmtl.isEqual(test_tri1, test_tri2, 0.1):
true_count += 1
if gmtl.isEqual(test_tri1, test_tri2, 100000.0):
true_count += 1
def testTimingCenter(self):
test_tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(4.0, 0.0, 0.0),
gmtl.Point3f(2.0, 4.0, 0.0))
center = gmtl.center(test_tri)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_tri[1][1] += 2.0
center = gmtl.center(test_tri)
use_value += center[0]
def testTimingNormal(self):
test_tri = gmtl.Trif(gmtl.Point3f(0.0, 0.0, 0.0),
gmtl.Point3f(4.0, 0.0, 0.0),
gmtl.Point3f(2.0, 4.0, 0.0))
normal = gmtl.normal(test_tri)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_tri[1][1] += 2.0
normal = gmtl.normal(test_tri)
use_value += normal[0]
class VecBaseTest(unittest.TestCase):
def testVecBaseCreation(self):
vec = gmtl.VecBase3d()
vec[0] = 0.0
def testCopyConstruct(self):
test_vec = gmtl.VecBase3f()
test_vec[0] = 2.0
test_vec[1] = 4.0
test_vec[2] = 8.0
test_vec_copy = gmtl.VecBase3f(test_vec)
assert test_vec_copy[0] == 2.0
assert test_vec_copy[1] == 4.0
assert test_vec_copy[2] == 8.0
def testConstructors(self):
test_vec4 = gmtl.VecBase4f(1.0, 2.0, 3.0, 4.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.VecBase3f(1.0, 2.0, 3.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.VecBase2f(1.0, 2.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
def testSet(self):
test_vec4 = gmtl.VecBase4f()
test_vec4.set(1.0, 2.0, 3.0, 4.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.VecBase3f()
test_vec3.set(1.0, 2.0, 3.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.VecBase2f()
test_vec2.set(1.0, 2.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
def testSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
test_vec4 = gmtl.VecBase4f()
test_vec4.set(data)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.VecBase3f()
test_vec3.set(data)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.VecBase2f()
test_vec2.set(data)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
def testGetData(self):
test_vec4 = gmtl.VecBase4f(1.0, 2.0, 3.0, 4.0)
data = test_vec4.getData()
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.VecBase3f(1.0, 2.0, 3.0)
data = test_vec3.getData()
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.VecBase2f(1.0, 2.0)
data = test_vec2.getData()
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
class VecBaseMetricTest(unittest.TestCase):
def testTimingVecBaseCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec2 = gmtl.VecBase2f()
test_vec2[0] = 1.0
test_vec3 = gmtl.VecBase3f()
test_vec3[0] = 2.0
test_vec4 = gmtl.VecBase4f()
test_vec4[0] = 3.0
use_value += test_vec2[0] + test_vec3[0] + test_vec4[0]
assert use_value > 0.0
def testTimingVecBaseCopyConstruct(self):
test_vec2 = gmtl.VecBase2f()
test_vec2[0] = 1.0
test_vec3 = gmtl.VecBase3f()
test_vec3[0] = 2.0
test_vec4 = gmtl.VecBase4f()
test_vec4[0] = 3.0
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec2_copy = gmtl.VecBase2f(test_vec2)
use_value += test_vec2_copy[0]
test_vec3_copy = gmtl.VecBase3f(test_vec3)
use_value += test_vec3_copy[0]
test_vec4_copy = gmtl.VecBase4f(test_vec4)
use_value += test_vec4_copy[0]
assert use_value > 0.0
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec4 = gmtl.VecBase4f(1.0, 2.0, 3.0, 4.0)
test_vec3 = gmtl.VecBase3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.VecBase2f(1.0, 2.0)
use_value += test_vec4[3] + test_vec3[2] + test_vec2[1]
def testTimingSet(self):
test_vec4 = gmtl.VecBase4f()
test_vec3 = gmtl.VecBase3f()
test_vec2 = gmtl.VecBase2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec4.set(iters + 0, iters + 1, iters + 2, iters + 3)
test_vec3.set(iters + 0, iters + 1, iters + 2)
test_vec2.set(iters + 0, iters + 1)
use_value += test_vec4[2] + test_vec3[2] + test_vec2[1]
assert use_value > 0.0
def testTimingSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
test_vec4 = gmtl.VecBase4f()
test_vec3 = gmtl.VecBase3f()
test_vec2 = gmtl.VecBase2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
data[0] += 1.0
data[1] += 2.0
data[2] += 4.0
data[3] += 8.0
test_vec4.set(data)
test_vec3.set(data)
test_vec2.set(data)
use_value += test_vec4[2] + test_vec3[2] + test_vec2[1]
assert use_value > 0.0
def testTimingGetData(self):
test_vec4 = gmtl.VecBase4f(1.0, 2.0, 3.0, 4.0)
iters = 400000
use_value = 0.0
for iter in xrange(iters):
data = test_vec4.getData()
use_value += data[0]
assert use_value > 0.0
class VecGenTest(unittest.TestCase):
def testMakeVecFromQuat(self):
quat = gmtl.Quatf(0.0, 21.0, 31.0, 1234.0)
vec = gmtl.makeVec(quat)
assert vec[0] == 0.0
assert vec[1] == 21.0
assert vec[2] == 31.0
def testMakeNormalVecFromVec(self):
eps = 0.001
vec = gmtl.Vec3f(0.1, 0.0, 0.0)
expected = gmtl.Vec3f(1.0, 0.0, 0.0)
result = gmtl.makeNormal(vec)
assert gmtl.isEqual(expected, result, eps)
vec = gmtl.Vec3f(0.1, 128943139.0, 0.0)
expected = gmtl.Vec3f(0.0, 1.0, 0.0)
result = gmtl.makeNormal(vec)
assert gmtl.isEqual(expected, result, eps)
vec = gmtl.Vec3f(0.0, 0.0, 0.001)
expected = gmtl.Vec3f(0.0, 0.0, 1.0)
result = gmtl.makeNormal(vec)
assert gmtl.isEqual(expected, result, eps)
def __rowTest(self, matType):
# Create a matrix filled linearly.
mat = matType()
mat.set(range(mat.Params.Rows * mat.Params.Cols))
# Get each row and test it.
for i in range(mat.Params.Rows):
row = gmtl.makeRow(mat, i)
for col in range(mat.Params.Cols):
assert row[col] == col * mat.Params.Rows + i
def testMatrixRowAccess(self):
self.__rowTest(gmtl.Matrix33f)
self.__rowTest(gmtl.Matrix44f)
def __columnTest(self, matType):
# Create a matrix filled linearly.
mat = matType()
mat.set(range(mat.Params.Rows * mat.Params.Cols))
for i in range(mat.Params.Cols):
col = gmtl.makeColumn(mat, i)
for row in range(mat.Params.Rows):
assert col[row] == i * mat.Params.Rows + row
def testMatrixColumnAccess(self):
self.__columnTest(gmtl.Matrix33f)
self.__columnTest(gmtl.Matrix44f)
class VecGenMetricTest(unittest.TestCase):
def testGenTimingMakeNormalVec1(self):
vec4d = gmtl.Vec4d()
iters = 25000
for iter in xrange(iters):
vec4d = gmtl.makeNormal(vec4d)
assert vec4d[0] != 10000.0 and vec4d[1] != 10000.0 and vec4d[2] != 10000.0
def testGenTimingMakeNormalVec2(self):
vec4f = gmtl.Vec4f()
iters = 25000
for iter in xrange(iters):
vec4f = gmtl.makeNormal(vec4f)
assert vec4f[0] != 10000.0 and vec4f[1] != 10000.0 and vec4f[2] != 10000.0
def testGenTimingMakeNormalVec3(self):
vec3d = gmtl.Vec3d()
iters = 25000
for iter in xrange(iters):
vec3d = gmtl.makeNormal(vec3d)
assert vec3d[0] != 10000.0 and vec3d[1] != 10000.0 and vec3d[2] != 10000.0
def testGenTimingMakeNormalVec4(self):
vec3f = gmtl.Vec3f()
iters = 25000
for iter in xrange(iters):
vec3f = gmtl.makeNormal(vec3f)
assert vec3f[0] != 10000.0 and vec3f[1] != 10000.0 and vec3f[2] != 10000.0
def testGenTimingMakeVec(self):
q1 = gmtl.Quatd()
iters = 25000
for iter in xrange(iters):
v1 = gmtl.makeVec(q1)
q2 = gmtl.Quatf()
for iter in xrange(iters):
v2 = gmtl.makeVec(q2)
assert v2[0] != 10000.0
assert v1[0] != 10000.0
class VecTest(unittest.TestCase):
def testCreation(self):
vec = gmtl.Vec3d()
assert vec[0] == 0.0
assert vec[1] == 0.0
assert vec[2] == 0.0
def testCopyConstruct(self):
test_vec = gmtl.Vec3d()
test_vec[0] = 2.0
test_vec[1] = 4.0
test_vec[2] = 8.0
test_vec_copy = gmtl.Vec3d(test_vec)
assert test_vec_copy[0] == 2.0
assert test_vec_copy[1] == 4.0
assert test_vec_copy[2] == 8.0
def testConstructors(self):
test_vec4 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.Vec2f(1.0, 2.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
def testSet(self):
test_vec4 = gmtl.Vec4f()
test_vec4.set(1.0, 2.0, 3.0, 4.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.Vec3f()
test_vec3.set(1.0, 2.0, 3.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
test_vec2 = gmtl.Vec2f()
test_vec2.set(1.0, 2.0)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
def testSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
test_vec4 = gmtl.Vec4f()
test_vec4.set(data)
assert test_vec4[0] == 1.0
assert test_vec4[1] == 2.0
assert test_vec4[2] == 3.0
assert test_vec4[3] == 4.0
test_vec3 = gmtl.Vec3f()
test_vec3.set(data)
assert test_vec3[0] == 1.0
assert test_vec3[1] == 2.0
assert test_vec3[2] == 3.0
test_vec2 = gmtl.Vec2f()
test_vec2.set(data)
assert test_vec2[0] == 1.0
assert test_vec2[1] == 2.0
def testGetData(self):
test_vec4 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
data = test_vec4.getData()
assert data[0] == 1.0
assert data[1] == 2.0
assert data[2] == 3.0
assert data[3] == 4.0
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
data = test_vec3.getData()
assert data[0] == 1.0
assert data[1] == 2.0
assert data[2] == 3.0
test_vec2 = gmtl.Vec2f(1.0, 2.0)
data = test_vec2.getData()
assert data[0] == 1.0
assert data[1] == 2.0
def testEqualityCompare(self):
test_vec1 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
test_vec2 = gmtl.Vec4f(test_vec1)
assert test_vec1 == test_vec2
assert not test_vec1 != test_vec2
# Set equal, vary elt 0
test_vec2 = gmtl.Vec4f(test_vec1)
test_vec2[0] = 21.10
assert test_vec1 != test_vec2
assert not test_vec1 == test_vec2
# Set equal, vary elt 1
test_vec2 = gmtl.Vec4f(test_vec1)
test_vec2[1] = 21.10
assert test_vec1 != test_vec2
assert not test_vec1 == test_vec2
# Set equal, vary elt 2
test_vec2 = gmtl.Vec4f(test_vec1)
test_vec2[2] = 21.10
assert test_vec1 != test_vec2
assert not test_vec1 == test_vec2
# Set equal, vary elt 3
test_vec2 = gmtl.Vec4f(test_vec1)
test_vec2[3] = 21.10
assert test_vec1 != test_vec2
assert not test_vec1 == test_vec2
def testIsEqual(self):
test_vec1 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
test_vec2 = gmtl.Vec4f(test_vec1)
eps = 0.0
while eps < 10.0:
assert gmtl.isEqual(test_vec1, test_vec2, eps)
eps += 0.05
test_vec1.set(1.0, 1.0, 1.0, 1.0)
for elt in range(4):
test_vec2 = gmtl.Vec4f(test_vec1)
test_vec2[elt] = 21.0
assert not gmtl.isEqual(test_vec1, test_vec2, 10.0)
assert not gmtl.isEqual(test_vec1, test_vec2, 19.9)
assert gmtl.isEqual(test_vec1, test_vec2, 20.1)
assert gmtl.isEqual(test_vec1, test_vec2, 22.0)
def testOpNegate(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = -test_vec1
assert test_vec2[0] == -1.0 and \
test_vec2[1] == -2.0 and \
test_vec2[2] == -3.0
def testOpPlusEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec1 += test_vec2
assert test_vec1[0] == 3.0 and \
test_vec1[1] == 4.0 and \
test_vec1[2] == 5.0
def testOpPlus(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec1 = test_vec3 + test_vec2
assert test_vec1[0] == 3.0 and \
test_vec1[1] == 4.0 and \
test_vec1[2] == 5.0
def testOpMinusEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec1 -= test_vec2
assert test_vec1[0] == -1.0 and \
test_vec1[1] == 0.0 and \
test_vec1[2] == 1.0
def testOpMinus(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec1 = test_vec3 - test_vec2
assert test_vec1[0] == -1.0 and \
test_vec1[1] == 0.0 and \
test_vec1[2] == 1.0
def testOpMultScalarEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec1 *= 4.0
assert test_vec1[0] == 4.0 and \
test_vec1[1] == 8.0 and \
test_vec1[2] == 12.0
def testOpMultScalar(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec1 = test_vec3 * 4.0
assert test_vec1[0] == 4.0 and \
test_vec1[1] == 8.0 and \
test_vec1[2] == 12.0
def testOpScalarVecMult(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec1 = 4.0 * test_vec3
assert test_vec1[0] == 4.0 and \
test_vec1[1] == 8.0 and \
test_vec1[2] == 12.0
def testOpDivScalarEq(self):
test_vec1 = gmtl.Vec3f(12.0, 8.0, 4.0)
test_vec1 /= 4.0
assert test_vec1[0] == 3.0 and \
test_vec1[1] == 2.0 and \
test_vec1[2] == 1.0
def testOpDivScalar(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec3 = gmtl.Vec3f(12.0, 8.0, 4.0)
test_vec1 = test_vec3 / 4.0
assert test_vec1[0] == 3.0 and \
test_vec1[1] == 2.0 and \
test_vec1[2] == 1.0
def testReflect(self):
v1 = gmtl.Point3f(1.0, 1.0, 1.0) # point or vec
v2 = gmtl.Point3f(3.0, 1.0, 2.0)
v3 = gmtl.Point3f(4.0, 5.0, 1.0)
n1 = gmtl.Vec3f(1.0, 0.0, 0.0) # normal of the surface/plane
n2 = gmtl.Vec3f(0.0, 1.0, 0.0)
n3 = gmtl.Vec3f(0.0, 0.0, 1.0)
ex1 = gmtl.Point3f(-1.0, 1.0, 1.0) # flipped about the surface
ex2 = gmtl.Point3f(3.0, -1.0, 2.0)
ex3 = gmtl.Point3f(4.0, 5.0, -1.0)
res = gmtl.Point3f()
eps = 0.001
gmtl.reflect(res, v1, n1)
assert gmtl.isEqual(res, ex1, eps)
gmtl.reflect(res, v2, n2)
assert gmtl.isEqual(res, ex2, eps)
gmtl.reflect(res, v3, n3)
assert gmtl.isEqual(res, ex3, eps)
v1 = gmtl.Vec3f(1.0, 1.0, 1.0) # point or vec
v2 = gmtl.Vec3f(3.0, 1.0, 2.0)
v3 = gmtl.Vec3f(4.0, 5.0, 1.0)
gmtl.reflect(res, v1, n1)
assert gmtl.isEqual(res, ex1, eps)
gmtl.reflect(res, v2, n2)
assert gmtl.isEqual(res, ex2, eps)
gmtl.reflect(res, v3, n3)
assert gmtl.isEqual(res, ex3, eps)
def testDot(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
v3 = gmtl.Vec3f(0.0, 0.0, 1.0)
# Base vectors
dot = gmtl.dot(v1, v2)
assert isEqual(0.0, gmtl.dot(v1, v2), 0.05)
assert isEqual(0.0, gmtl.dot(v1, v3), 0.05)
assert isEqual(0.0, gmtl.dot(v2, v3), 0.05)
# Other vectors
v1.set(13.45, -7.8, 0.056)
v2.set(0.777, 5.333, 12.21)
v3.set(3.4, -1.6, 0.23)
ans = -30.463
dot = gmtl.dot(v1, v2)
assert isNear(dot, ans, 0.01)
dot = gmtl.dot(v2, v1)
assert isNear(dot, ans, 0.01)
ans = -3.0827
dot = gmtl.dot(v2, v3)
assert isNear(dot, ans, 0.01)
dot = gmtl.dot(v3, v2)
assert isNear(dot, ans, 0.01)
def testLength(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
v3 = gmtl.Vec3f(0.0, 0.0, 1.0)
# Base vectors.
assert isEqual(gmtl.length(v1), 1.0, 0.05)
assert isEqual(gmtl.length(v2), 1.0, 0.05)
assert isEqual(gmtl.length(v3), 1.0, 0.05)
assert isEqual(gmtl.lengthSquared(v1), 1.0, 0.05)
assert isEqual(gmtl.lengthSquared(v2), 1.0, 0.05)
assert isEqual(gmtl.lengthSquared(v3), 1.0, 0.05)
# Other vectors.
v1.set(2.0, 4.0, 5.0)
v2.set(12.0, -2.0, -4.0)
ans = 4.0 + 16.0 + 25.0
len = gmtl.lengthSquared(v1)
assert isNear(len, ans, 0.01)
ans = math.sqrt(ans)
len = gmtl.length(v1)
assert isNear(len, ans, 0.01)
ans = 144.0 + 4.0 + 16.0
len = gmtl.lengthSquared(v2)
assert isNear(len, ans, 0.01)
ans = math.sqrt(ans)
len = gmtl.length(v2)
assert isNear(len, ans, 0.01)
def testNormalize(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
# Other vectors
v1.set(2.0, 4.0, 5.0)
v2 = gmtl.Vec3f(v1)
gmtl.normalize(v1)
temp = v1 * gmtl.length(v2)
assert gmtl.isEqual(v2, temp, 0.01)
v1.set(12.0, -2.0, -4.0)
v2 = gmtl.Vec3f(v1)
gmtl.normalize(v1)
assert gmtl.isEqual(v2, gmtl.Vec3f(v1 * gmtl.length(v2)), 0.01)
def testIsNormalized(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
v3 = gmtl.Vec3f(0.0, 0.0, 1.0)
v4 = gmtl.Vec3f(2.0, 4.0, 5.0)
# No tolerance.
assert gmtl.isNormalized(v1)
assert gmtl.isNormalized(v2)
assert gmtl.isNormalized(v3)
assert not gmtl.isNormalized(v4)
def testIsNormalizedEps(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(v1)
eps = 0.0
while eps < 10.0:
assert gmtl.isNormalized(v1, eps)
eps += 0.5
v2.set(21.0, 0.0, 0.0)
assert not gmtl.isNormalized(v2, 15.0 * 15.0)
assert not gmtl.isNormalized(v2, 19.9 * 19.9)
assert gmtl.isNormalized(v2, 21.0 * 21.0 - 0.9)
assert gmtl.isNormalized(v2, 21.0 * 21.0 + 0.9)
def testCross(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
v3 = gmtl.Vec3f(0.0, 0.0, 1.0)
cross = gmtl.Vec3f()
# Base vectors.
gmtl.cross(cross, v1, v2)
assert gmtl.isEqual(cross, v3, 0.01)
gmtl.cross(cross, v2, v1)
assert gmtl.isEqual(cross, -v3, 0.01)
v1.set(13.45, -7.8, 0.056)
v2.set(0.777, 5.333, 12.21)
v3.set(-95.537, -164.181, 77.789)
gmtl.cross(cross, v1, v2)
assert gmtl.isEqual(cross, v3, 0.01)
gmtl.cross(cross, v2, v1)
assert gmtl.isEqual(cross, -v3, 0.01)
def testLerp(self):
q1 = gmtl.Vec2f(2, 3)
q2 = gmtl.Vec2f(9.01, 8.4)
expected_result1 = gmtl.Vec2f(q1)
expected_result2 = gmtl.Vec2f(q2)
eps = 0.0001
res1 = gmtl.Vec2f()
res2 = gmtl.Vec2f()
gmtl.lerp(res1, 0.0, q1, q2)
gmtl.lerp(res2, 1.0, q1, q2)
assert gmtl.isEqual(expected_result1, res1, eps)
assert gmtl.isEqual(expected_result2, res2, eps)
# Test interpolated values.
q3 = gmtl.Vec2f(0.0, 0.0)
q4 = gmtl.Vec2f(1.0, 1.0)
expected_result1 = gmtl.Vec2f(0.35, 0.35)
expected_result2 = gmtl.Vec2f(0.69, 0.69)
res3 = gmtl.Vec2f()
res4 = gmtl.Vec2f()
gmtl.lerp(res3, 0.35, q3, q4)
gmtl.lerp(res4, 0.69, q3, q4)
assert gmtl.isEqual(expected_result1, res3, eps)
assert gmtl.isEqual(expected_result2, res4, eps)
q1 = gmtl.Vec3f(2.0, 3.0, 4.0)
q2 = gmtl.Vec3f(9.01, 8.4, 7.1)
expected_result1 = gmtl.Vec3f(q1)
expected_result2 = gmtl.Vec3f(q2)
res1 = gmtl.Vec3f()
res2 = gmtl.Vec3f()
gmtl.lerp(res1, 0.0, q1, q2)
gmtl.lerp(res2, 1.0, q1, q2)
assert gmtl.isEqual(expected_result1, res1, eps)
assert gmtl.isEqual(expected_result2, res2, eps)
# Test interpolated values.
q3 = gmtl.Vec3f(0.0, 0.0, 0.0)
q4 = gmtl.Vec3f(1.0, 1.0, 1.0)
expected_result3 = gmtl.Vec3f(0.35, 0.35, 0.35)
expected_result4 = gmtl.Vec3f(0.69, 0.69, 0.69)
res3 = gmtl.Vec3f()
res4 = gmtl.Vec3f()
gmtl.lerp(res3, 0.35, q3, q4)
gmtl.lerp(res4, 0.69, q3, q4)
assert gmtl.isEqual(expected_result3, res3, eps)
assert gmtl.isEqual(expected_result4, res4, eps)
q1 = gmtl.Vec4f(2.0, 3.0, 4.0, 5.0)
q2 = gmtl.Vec4f(9.01, 8.4, 7.1, 10009.0)
expected_result1 = gmtl.Vec4f(q1)
expected_result2 = gmtl.Vec4f(q2)
res1 = gmtl.Vec4f()
res2 = gmtl.Vec4f()
gmtl.lerp(res1, 0.0, q1, q2)
gmtl.lerp(res2, 1.0, q1, q2)
assert gmtl.isEqual(expected_result1, res1, eps)
assert gmtl.isEqual(expected_result2, res2, eps)
# Test interpolated values.
q3 = gmtl.Vec4f(0.0, 0.0, 0.0, 0.0)
q4 = gmtl.Vec4f(1.0, 1.0, 1.0, 1.0)
expected_result3 = gmtl.Vec4f(0.35, 0.35, 0.35, 0.35)
expected_result4 = gmtl.Vec4f(0.69, 0.69, 0.69, 0.69)
res3 = gmtl.Vec4f()
res4 = gmtl.Vec4f()
gmtl.lerp(res3, 0.35, q3, q4)
gmtl.lerp(res4, 0.69, q3, q4)
assert gmtl.isEqual(expected_result3, res3, eps)
assert gmtl.isEqual(expected_result4, res4, eps)
class VecMetricTest(unittest.TestCase):
def testTimingCreation(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec2 = gmtl.Vec2f()
test_vec2[0] = 1.0
test_vec3 = gmtl.Vec3f()
test_vec3[0] = 2.0
test_vec4 = gmtl.Vec4f()
test_vec4[0] = 3.0
use_value += test_vec2[0] + test_vec3[0] + test_vec4[0]
assert use_value > 0.0
def testTimingCopyConstruct(self):
test_vec2 = gmtl.Vec2f()
test_vec2[0] = 2.0
test_vec3 = gmtl.Vec3f()
test_vec3[0] = 2.0
test_vec4 = gmtl.Vec4f()
test_vec4[0] = 2.0
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec2_copy = gmtl.Vec2f(test_vec2)
use_value += test_vec2_copy[0]
test_vec3_copy = gmtl.Vec3f(test_vec3)
use_value += test_vec3_copy[0]
test_vec4_copy = gmtl.Vec4f(test_vec4)
use_value += test_vec4_copy[0]
def testTimingConstructors(self):
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec4 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
test_vec3 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec2f(1.0, 2.0)
use_value += test_vec4[3] + test_vec3[2] + test_vec2[1]
def testTimingSet(self):
test_vec4 = gmtl.Vec4f()
test_vec3 = gmtl.Vec3f()
test_vec2 = gmtl.Vec2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
test_vec4.set(iters + 0, iters + 1, iters + 2, iters + 3)
test_vec3.set(iters + 0, iters + 1, iters + 2)
test_vec2.set(iters + 0, iters + 1)
use_value += test_vec4[3] + test_vec3[2] + test_vec2[1]
assert use_value > 0.0
def testTimingSetPtr(self):
data = [1.0, 2.0, 3.0, 4.0]
test_vec4 = gmtl.Vec4f()
test_vec3 = gmtl.Vec3f()
test_vec2 = gmtl.Vec2f()
iters = 400000
use_value = 0.0
for iter in xrange(iters):
data[0] += 1.0
data[1] += 2.0
data[2] += 3.0
data[3] += 4.0
test_vec4.set(data)
test_vec3.set(data)
test_vec2.set(data)
use_value += test_vec4[3] + test_vec3[2] + test_vec2[1]
assert use_value > 0.0
def testTimingEqualityCompare(self):
test_vec1 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
test_vec2 = gmtl.Vec4f(test_vec1)
iters = 400000
true_count = 0
false_count = 0
test_vec1.set(0.0, 0.0, 0.0, 2000.0)
test_vec2.set(0.0, 0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_vec1[3] += 1.0
test_vec2[3] += 2.0
if test_vec1 == test_vec2:
true_count += 1
test_vec1.set(0.0, 0.0, 0.0, 2000.0)
test_vec2.set(0.0, 0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_vec1[3] += 1.0
test_vec2[3] += 2.0
if test_vec1 != test_vec2:
false_count += 1
def testTimingIsEqual(self):
test_vec1 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
test_vec2 = gmtl.Vec4f(test_vec1)
iters = 400000
true_count = 0
false_count = 0
test_vec1.set(0.0, 0.0, 0.0, 2000.0)
test_vec2.set(0.0, 0.0, 0.0, 1000.0)
for iter in xrange(iters):
test_vec1[3] += 1.0
test_vec2[3] += 2.0
if gmtl.isEqual(test_vec1, test_vec2, 1.0):
true_count += 1
if gmtl.isEqual(test_vec1, test_vec2, 0.1):
true_count += 1
if gmtl.isEqual(test_vec1, test_vec2, 100000.0):
true_count += 1
def testTimingOpNegate(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
for iter in xrange(iters):
test_vec3.set(iter, iter + 1, iter + 2)
test_vec1 = -test_vec3
def testTimingOpPlusEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
for iter in xrange(iters):
test_vec3.set(iter, iter + 1, iter + 2)
test_vec1 += test_vec3
test_vec2 = gmtl.Vec3f(test_vec1)
def testTimingOpPlus(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
for iter in xrange(iters):
test_vec3.set(iter, iter + 1, iter + 2)
test_vec1 = (test_vec3 + test_vec2)
test_vec2 = gmtl.Vec3f(test_vec1)
def testTimingOpMinusEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
for iter in xrange(iters):
test_vec3.set(iter, iter + 1, iter + 2)
test_vec1 -= test_vec3
test_vec2 = gmtl.Vec3f(test_vec1)
def testTimingOpPlus(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(2.0, 2.0, 2.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
for iter in xrange(iters):
test_vec3.set(iter, iter + 1, iter + 2)
test_vec1 = (test_vec3 - test_vec2)
test_vec2 = gmtl.Vec3f(test_vec1)
def testTimingOpMultScalarEq(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
iters = 400000
for iter in xrange(iters):
test_vec1 *= 1.05
def testTimingOpMultScalar(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(1.0, 2.0, 3.0)
iters = 400000
test_vec3 = gmtl.Vec3f()
test_vec3.set(5.0, 7.0, 9.0)
for iter in xrange(iters):
test_vec1 = test_vec3 * 1.05
test_vec3 = gmtl.Vec3f(test_vec1)
def testTimingOpScalarVecMult(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec3 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
bogus_value = 0.0
for iter in xrange(iters):
test_vec1 = 1.05 * test_vec3
test_vec3 = gmtl.Vec3f(test_vec1)
bogus_value += test_vec1[0]
assert bogus_value > 5.0
def testTimingOpDivScalarEq(self):
test_vec1 = gmtl.Vec3f(12.0, 8.0, 4.0)
iters = 400000
for iter in xrange(iters):
test_vec1 /= 0.95
def testTimingOpDivScalar(self):
test_vec1 = gmtl.Vec3f(1.0, 2.0, 3.0)
test_vec2 = gmtl.Vec3f(5.0, 7.0, 9.0)
iters = 400000
test_vec3 = gmtl.Vec3f()
test_vec3.set(5.0, 7.0, 9.0)
for iter in xrange(iters):
test_vec1 = test_vec3 / 0.95
test_vec3 = gmtl.Vec3f(test_vec1)
def testTimingGroupedOps(self):
const_vec1 = gmtl.Vec4f(4.0, 5.0, 6.0, 7.0)
const_vec2 = gmtl.Vec4f(1.0, 2.0, 3.0, 4.0)
const_vec3 = gmtl.Vec4f(7.0, 11.0, 12.0, 24.0)
iters = 10000
vec1 = gmtl.Vec4f()
vec2 = gmtl.Vec4f()
vec3 = gmtl.Vec4f()
total_vec = gmtl.Vec4f()
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
vec1.set(iter, iter + 1, iter + 2, iter + 3)
vec2 *= 0.00125
vec3 *= -0.000345
# Do the actual operation of interest.
res_vec = vec1 + vec2 + vec3
total_vec += res_vec
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
vec1.set(iter, iter + 1, iter + 2, iter + 3)
vec2 *= 0.00125
vec3 *= -0.0000345
# Do the actual operation of interest.
res_rev = vec1 - vec2 - vec3
total_vec += res_vec
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
res_rev = const_vec1 + const_vec2 + const_vec3
total_vec += res_vec
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
res_rev = const_vec1 - const_vec2 - const_vec3
total_vec += res_vec
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
vec1.set(iter, iter + 1, iter + 2, iter + 3)
vec2 *= 0.00125
# Do the actual operation of interest.
res_vec = (vec1 - const_vec1) + (vec2 + const_vec2) - (const_vec3 * 7.6)
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
vec1.set(iter, iter + 1, iter + 2, iter + 3)
vec2 *= 0.00125
# Do the actual operation of interest.
res_vec = (vec1 * 7.0) + (vec2 * -1.0)
total_vec += res_vec
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
res_vec = (const_vec1 * 3.0)
total_vec += res_vec
vec1.set(1.0, 2.0, 3.0, 4.0)
vec2.set(3.0, 3.0, 3.0, 3.0)
vec3.set(12.0, 21.0, 75.0, 2.0)
total_vec.set(0.0, 0.0, 0.0, 0.0)
for iter in xrange(iters):
# Do some wotk to make the vectors change a little.
vec1.set(iter, iter + 1, iter + 2, iter + 3)
vec2 *= 0.00125
# Do the actual operation of interest.
res_vec = (vec1 * gmtl.dot(const_vec1, vec2))
total_vec += res_vec
vec5 = gmtl.Vec3f(3.0, 3.0, 3.0)
vec6 = gmtl.Vec3f(12.0, 21.0, 75.0)
total_vec2 = gmtl.Vec3f()
for iter in xrange(iters):
# Do some work to make the vectors change a little.
vec5.set(iter + 1, iter + 2, iter + 3)
vec6 *= 0.00125
# Do the actual operation of interest.
res_vec2 = gmtl.makeCross(vec5, vec6) * 21.0
total_vec2 += res_vec2
def testTimingDot(self):
v1 = gmtl.Vec3f(1.0, 0.0, 0.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
iters = 100000
val = 0.0
for iter in xrange(iters):
val += gmtl.dot(v1, v2)
v1 *= 1.0025
def testTimingLength(self):
v1 = gmtl.Vec3f(2.0, 4.0, 5.0)
iters = 100000
val = 0.0
for iter in xrange(iters):
val += gmtl.length(v1)
v1 *= 1.0025
val = 0.0
v1.set(1.0, 2.0, 3.0)
for iter in xrange(iters):
val += gmtl.lengthSquared(v1)
v1 *= 1.0025
def testTimingNormalize(self):
v1 = gmtl.Vec3f(12.0, 21.0, 75.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
iters = 100000
val = 0.0
for iter in xrange(iters):
v1 *= 1.0025
v2 = gmtl.Vec3f(v1)
val += gmtl.normalize(v2)
def testTimingIsNormalized(self):
v4 = gmtl.Vec3f(0.5, 0.5, 0.5)
iters = 100000
true_count = 0
for iter in xrange(iters):
v4 *= 1.0025
if gmtl.isNormalized(v4):
true_count += 1
def testTimingIsNormalizedEps(self):
v2 = gmtl.Vec3f(0.5, 0.5, 0.5)
iters = 100000
true_count = 0
tol = 0.25
for iter in xrange(iters):
v2 *= 1.0025
if gmtl.isNormalized(v2, tol):
true_count += 1
def testTimingCross(self):
v1 = gmtl.Vec3f(12.0, 21.0, 75.0)
v2 = gmtl.Vec3f(0.0, 1.0, 0.0)
v3 = gmtl.Vec3f(0.0, 0.0, 1.0)
cross = gmtl.Vec3f()
iters = 100000
for iter in xrange(iters):
gmtl.cross(cross, v2, v1)
v1 *= 1.0025
v3 += cross
def testTimingLerp(self):
fromv = gmtl.Vec4f()
result = gmtl.Vec4f()
iters = 10000
for iter in xrange(iters):
gmtl.lerp(result, float(iter) / float(iters), fromv, result)
assert result[2] != 1234.5
class XformTest(unittest.TestCase):
def testQuatVecXform(self):
eps = 0.0001
q1 = gmtl.Quatf()
q2 = gmtl.Quatf()
q3 = gmtl.Quatf()
vec = gmtl.Vec3f(0.0, 0.0, 1.0)
vec2 = gmtl.Vec3f(2.0, 5.0, 10.0)
gmtl.setRot(q1, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 0.0, 1.0, 0.0))
gmtl.setRot(q2, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
gmtl.setRot(q3, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(35.0),
1.0, 1.0, 0.0)))
ex1 = gmtl.Vec3f(1.0, 0.0, 0.0)
ex2 = gmtl.Vec3f(0.0, -1.0, 0.0)
ex3 = gmtl.Vec3f(0.40558, -0.40558, 0.819152)
ex4 = gmtl.Vec3f(6.32707, 0.67293, 9.40826)
res1 = gmtl.Vec3f()
res2 = gmtl.Vec3f()
res3 = gmtl.Vec3f()
res4 = gmtl.Vec3f()
resi = gmtl.Vec3f()
qident = gmtl.Quatf()
gmtl.xform(res1, q1, vec)
gmtl.xform(res2, q2, vec)
gmtl.xform(res3, q3, vec)
gmtl.xform(res4, q3, vec2)
gmtl.xform(resi, qident, vec)
assert gmtl.isEqual(vec, resi, eps)
assert gmtl.isEqual(ex1, res1, eps)
assert gmtl.isEqual(ex2, res2, eps)
assert gmtl.isEqual(ex3, res3, eps)
assert gmtl.isEqual(ex4, res4, eps)
res5 = q1 * vec
res6 = q2 * vec
res7 = q3 * vec
res8 = q3 * vec2
resi = qident * vec
assert gmtl.isEqual(vec, resi, eps)
assert gmtl.isEqual(ex1, res5, eps)
assert gmtl.isEqual(ex2, res6, eps)
assert gmtl.isEqual(ex3, res7, eps)
assert gmtl.isEqual(ex4, res8, eps)
mat = gmtl.Matrix44f()
gmtl.setRot(mat, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(35.0),
1.0, 1.0, 0.0)))
res8 = mat * vec2
assert gmtl.isEqual(ex4, res8, eps)
eps = 0.001
vec = gmtl.Vec3f(10.0, 100.0, 200.0)
expected = gmtl.Vec3f(10.0, -200.0, 100.0)
rot = gmtl.Quatf()
gmtl.setRot(rot, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
result = gmtl.Vec3f()
gmtl.xform(result, rot, vec)
assert gmtl.isEqual(expected, result, eps)
def testWeird_XformQuatVec_InvConj_SanityCheck(self):
# Just for sanity check, inv and conj should both work for the
# implementation of quat * vec (but conj is actually faster so we
# usually choose that).
# They both will work only in the case where quat is already normalized
# (a rotation quat).
eps = 0.001
vec = gmtl.Vec3f(10.0, -100.0, -2000.0)
expected = gmtl.Vec3f(10.0, 2000.0, -100.0)
rot = gmtl.Quatf()
gmtl.setRot(rot, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0), 1.0, 0.0, 0.0))
result1 = gmtl.makeVec(rot * gmtl.makePure(vec) * gmtl.makeConj(rot))
assert gmtl.isEqual(expected, result1, eps)
result2 = gmtl.makeVec(rot * gmtl.makePure(vec) * gmtl.makeInvert(rot))
assert gmtl.isEqual(expected, result2, eps)
assert gmtl.isEqual(result1, result2, eps)
# Should be equal because the rotation is normalized.
assert gmtl.isEqual(gmtl.makeConj(rot), gmtl.makeInvert(rot), eps)
# Same, but without the expected value (just check that the two are
# equal).
eps = 0.001
vec = gmtl.Vec3f(123.0, -4.56, 78.910)
rot = gmtl.Quatf()
gmtl.setRot(rot, gmtl.AxisAnglef(gmtl.Math.deg2Rad(123.4556),
gmtl.makeNormal(gmtl.Vec3f(-79.0,
1000.0,
234.0))))
result1 = gmtl.makeVec(rot * gmtl.makePure(vec) * gmtl.makeConj(rot))
result2 = gmtl.makeVec(rot * gmtl.makePure(vec) * gmtl.makeInvert(rot))
assert gmtl.isEqual(result1, result2, eps)
# Should be equal because the rotation is normalized.
assert gmtl.isEqual(gmtl.makeConj(rot), gmtl.makeInvert(rot), eps)
def __testMatRayXform(self, rayType):
seg = rayType()
seg.setOrigin(gmtl.Point3f(1.0, 2.0, 3.0))
seg.setDir(gmtl.Vec3f(3.0, 95.0, 1.0))
matrix = gmtl.Matrix44f()
gmtl.setTrans(matrix, gmtl.Vec3f(9.0, 8.0, 7.0))
gmtl.setRot(matrix, gmtl.AxisAnglef(gmtl.Math.deg2Rad(90.0),
gmtl.Vec3f(0.0, 1.0, 0.0)))
expected = gmtl.LineSegf(gmtl.Point3f(12, 10, 6), gmtl.Vec3f(1, 95, -3))
# Test xform
result = rayType()
gmtl.xform(result, matrix, seg)
assert gmtl.isEqual(expected, result, 0.0001)
# Test operator*
result = matrix * seg
assert gmtl.isEqual(expected, result, 0.0001)
# Test operator*=
result = rayType(seg)
result *= matrix
assert gmtl.isEqual(expected, result, 0.0001)
def testMatLineSegXform(self):
self.__testMatRayXform(gmtl.LineSegf)
def testMatRayXform(self):
self.__testMatRayXform(gmtl.Rayf)
def testMatVecXform(self):
# Really simple mat44 * vec4 rotatiosn (hard coded matrix rotation)
# Transform a vector by a matrix. Verify that the rotation worked.
eps = 0.0001
q1 = gmtl.Matrix44f()
q1.set(0.0, -1.0, 0.0, 0.0, # twist 90 about Z
1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0)
q2 = gmtl.Matrix44f()
q2.set(0.0, 0.0, 1.0, 0.0, # twist 90 about Y
0.0, 1.0, 0.0, 0.0,
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0)
q3 = gmtl.Matrix44f()
q3.set(1.0, 0.0, 0.0, 0.0, # twist -90 about X
0.0, 0.0, 1.0, 0.0,
0.0, -1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0)
qident = gmtl.Matrix44f()
vec = gmtl.Vec4f(0.0, 0.0, 1.0, 0.0)
vec2 = gmtl.Vec4f(1.0, 1.0, -10.0, 0.0)
ex1 = gmtl.Vec4f(0.0, 0.0, 1.0, 0.0)
ex2 = gmtl.Vec4f(1.0, 0.0, 0.0, 0.0)
ex3 = gmtl.Vec4f(0.0, 1.0, 0.0, 0.0)
ex4 = gmtl.Vec4f(1.0, -10.0, -1.0, 0.0)
resi = gmtl.Vec4f()
res1 = gmtl.Vec4f()
res2 = gmtl.Vec4f()
res3 = gmtl.Vec4f()
res4 = gmtl.Vec4f()
gmtl.xform(resi, qident, vec)
gmtl.xform(res1, q1, vec)
gmtl.xform(res2, q2, vec)
gmtl.xform(res3, q3, vec)
gmtl.xform(res4, q3, vec2)
assert gmtl.isEqual(vec, resi, eps)
assert gmtl.isEqual(ex1, res1, eps)
assert gmtl.isEqual(ex2, res2, eps)
assert gmtl.isEqual(ex3, res3, eps)
assert gmtl.isEqual(ex4, res4, eps)
resi = qident * vec
res1 = q1 * vec
res2 = q2 * vec
res3 = q3 * vec
res4 = q3 * vec2
assert gmtl.isEqual(vec, resi, eps)
assert gmtl.isEqual(ex1, res1, eps)
assert gmtl.isEqual(ex2, res2, eps)
assert gmtl.isEqual(ex3, res3, eps)
assert gmtl.isEqual(ex4, res4, eps)
# More "interesting" rotations.
eps = 0.0001
vec = gmtl.Vec3f(2.0, 5.0, 10.0)
expected = gmtl.Vec3f(6.32707, 0.67293, 9.40826)
mat = gmtl.Matrix44f()
gmtl.setRot(mat, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(35.0),
1.0, 1.0, 0.0)))
# Transform a vectory by a matrix. Verify the rotation worked.
result1 = gmtl.Vec3f()
gmtl.xform(result1, mat, vec)
assert gmtl.isEqual(expected, result1, eps)
# operator* should be the same.
result2 = mat * vec
assert gmtl.isEqual(expected, result2, eps)
# Make sure that transofmation by a quaternion yields the same result
# as transformation by a matrix.
quat = gmtl.Quatf()
gmtl.setRot(quat, gmtl.makeNormal(gmtl.AxisAnglef(gmtl.Math.deg2Rad(35.0),
1.0, 1.0, 0.0)))
result3 = gmtl.Vec3f()
gmtl.xform(result3, quat, vec)
assert gmtl.isEqual(expected, result3, eps)
result4 = quat * vec
assert gmtl.isEqual(expected, result4, eps)
# 4x4 matrix: test out complete transformations with a weird vector.
eps = 0.0001
vec = gmtl.Vec4f(-100.0, 334.0, 455.0, -568.0)
expected = gmtl.Vec4f(-339.0, 145.0, 629.0, 1113.0)
mat = gmtl.Matrix44f()
mat.set(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0,
13.0, 14.0, 15.0, 16.0)
# Transform a vector by a matrix. Verify that the transformation worked.
result1 = gmtl.Vec4f()
gmtl.xform(result1, mat, vec)
assert gmtl.isEqual(expected, result1, eps)
# operator* should be the same.
result2 = mat * vec
assert gmtl.isEqual(expected, result2, eps)
# 3x3 matrix: test out complete transformations with a weird vector.
eps = 0.0001
vec = gmtl.Vec3f(-100.0, 334.0, 455.0)
expected = gmtl.Vec3f(1933.0, 4689.0, 7445.0)
mat = gmtl.Matrix33f()
mat.set(1.0, 2.0, 3.0,
5.0, 6.0, 7.0,
9.0, 10.0, 11.0)
# Transform a vector by a matrix. Verify that the transformation worked.
result1 = gmtl.Vec3f()
gmtl.xform(result1, mat, vec)
assert gmtl.isEqual(expected, result1, eps)
# operator* should be the same.
result2 = mat * vec
assert gmtl.isEqual(expected, result2, eps)
# 4x4 matrix: test out complete transformations with a weird vector.
eps = 0.0001
vec = gmtl.Vec4f(-100.0, 334.0, 455.0, 0.0)
expected = gmtl.Vec4f(1933.0, 4689.0, 7445.0, 10201.0)
partial_vec = gmtl.Vec3f(-100.0, 334.0, 455.0)
expected2 = gmtl.Vec3f(1933.0 / 10201.0, 4689.0 / 10201.0,
7445.0 / 10201.0)
mat = gmtl.Matrix44f()
mat.set(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0,
13.0, 14.0, 15.0, 16.0)
# Transform a vector by a matrix. Verify that the transformation worked.
result1 = gmtl.Vec4f()
gmtl.xform(result1, mat, vec)
assert gmtl.isEqual(expected, result1, eps)
# operator* should be the same.
result2 = mat * vec
assert gmtl.isEqual(expected, result2, eps)
# Transform a partially specified vector by a matrix. Verify the
# transformation worked.
result3 = gmtl.Vec3f()
gmtl.xform(result3, mat, partial_vec)
assert gmtl.isEqual(expected2, result3, eps)
# operator* should be the same.
result4 = mat * partial_vec
assert gmtl.isEqual(expected2, result4, eps)
# 3x3 matrix: test out complete transformations with a weird vector.
eps = 0.0001
vec = gmtl.Vec3f(-100.0, 334.0, 0.0)
expected = gmtl.Vec3f(568.0, 1504.0, 2440.0)
partial_vec = gmtl.Vec2f(-100.0, 334.0)
expected2 = gmtl.Vec2f(568.0 / 2440.0, 1504.0 / 2440.0)
mat = gmtl.Matrix33f()
mat.set(1.0, 2.0, 3.0,
5.0, 6.0, 7.0,
9.0, 10.0, 11.0)
# Transform a vector by a matrix. Verify that the transformation worked.
result1 = gmtl.Vec3f()
gmtl.xform(result1, mat, vec)
assert gmtl.isEqual(expected, result1, eps)
# operator* should be the same.
result2 = mat * vec
assert gmtl.isEqual(expected, result2, eps)
# Transform a partially specified vector by a matrix. Verify that the
# transformation worked.
result3 = gmtl.Vec2f()
gmtl.xform(result3, mat, partial_vec)
assert gmtl.isEqual(expected2, result3, eps)
# operator* should be the same.
result4 = mat * partial_vec
assert gmtl.isEqual(expected2, result4, eps)
class XformMetricTest(unittest.TestCase):
def __xformQuatVec3(self, quatType, vecType):
q1 = gmtl.makeNormal(quatType(1, 2, 3, 4))
v2 = vecType()
v2[0] = 1
iters = 25000
for iter in xrange(iters):
v2 = vecType(q1 * v2)
for iter in xrange(iters):
gmtl.xform(v2, q1, v2)
assert v2[0] != 13.045
def __xformMatByVecType(self, matType, vecType):
q1 = matType()
iters = 25000
v2 = vecType()
for iter in xrange(iters):
v2 = vecType(q1 * v2)
for iter in xrange(iters):
gmtl.xform(v2, q1, v2)
assert v2[0] != 1.0
def testTimingXformQuatVec3(self):
self.__xformQuatVec3(gmtl.Quatf, gmtl.Vec3f)
self.__xformQuatVec3(gmtl.Quatd, gmtl.Vec3d)
def testTimingXformMatVecComplete(self):
self.__xformMatByVecType(gmtl.Matrix33f, gmtl.Vec3f)
self.__xformMatByVecType(gmtl.Matrix44f, gmtl.Vec4f)
def testTimingXformMatVecPartial(self):
self.__xformMatByVecType(gmtl.Matrix33f, gmtl.Vec2f)
self.__xformMatByVecType(gmtl.Matrix44f, gmtl.Vec3f)
def testTimingXformMatVecComplete(self):
self.__xformMatByVecType(gmtl.Matrix33f, gmtl.Point3f)
# self.__xformMatByVecType(gmtl.Matrix44f, gmtl.Point4f)
def testTimingXformMatPointPartial(self):
self.__xformMatByVecType(gmtl.Matrix33f, gmtl.Point2f)
self.__xformMatByVecType(gmtl.Matrix44f, gmtl.Point3f)
def isEqual(v0, v1, tolerance = 0.001):
return math.fabs(v0 - v1) <= tolerance
def isNear(v0, v1, tolerance = 0.001):
return math.fabs(v0 - v1) < tolerance
def getTests(testCase):
return [m for m in testCase.__dict__.keys() if m.startswith('test')]
if __name__ == '__main__':
random.seed()
# NOTE: This isn't exactly how PyUnit is supposed to be used, but I don't
# yet see how to keep it from pulling in every test case defined in this
# module without splitting this module into N pieces for N classes of
# test cases.
suite = unittest.TestSuite()
metric_suite = unittest.TestSuite()
for k in locals().keys():
v = locals()[k]
# This bit with types.TypeType is to accomodate Python on Windows.
# For some reasson, class objects get identified being of type 'type'.
if type(v) is types.ClassType or type(v) is types.TypeType:
if k.find('Metric') != -1:
metric_suite.addTests(map(v, getTests(v)))
else:
suite.addTests(map(v, getTests(v)))
runner = unittest.TextTestRunner()
if len(sys.argv) == 1 or 'noninteractive' in sys.argv:
runner.run(suite)
if 'metric' in sys.argv:
runner.run(metric_suite)
| 32.30522
| 113
| 0.560327
| 43,572
| 299,534
| 3.770747
| 0.036698
| 0.03322
| 0.02832
| 0.022593
| 0.803206
| 0.764472
| 0.729846
| 0.691246
| 0.651258
| 0.619006
| 0
| 0.126962
| 0.305588
| 299,534
| 9,271
| 114
| 32.308705
| 0.662938
| 0.067515
| 0
| 0.644082
| 0
| 0
| 0.000136
| 0
| 0
| 0
| 0
| 0
| 0.197348
| 1
| 0.064005
| false
| 0.000288
| 0.000865
| 0.000577
| 0.073807
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3816507b187de3ccc3072e9433ed48ff5cac9fd9
| 70
|
py
|
Python
|
netron_dbb.py
|
Wulingtian/DiverseBranchBlock_TensorRT_int8
|
b47b51c3b53df652d1a96d0e4b15ef281699baaa
|
[
"Apache-2.0"
] | null | null | null |
netron_dbb.py
|
Wulingtian/DiverseBranchBlock_TensorRT_int8
|
b47b51c3b53df652d1a96d0e4b15ef281699baaa
|
[
"Apache-2.0"
] | null | null | null |
netron_dbb.py
|
Wulingtian/DiverseBranchBlock_TensorRT_int8
|
b47b51c3b53df652d1a96d0e4b15ef281699baaa
|
[
"Apache-2.0"
] | 1
|
2021-04-20T02:01:08.000Z
|
2021-04-20T02:01:08.000Z
|
import netron
netron.start('./ResNet-18_DBB_simple.onnx', port=3344)
| 17.5
| 54
| 0.771429
| 11
| 70
| 4.727273
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092308
| 0.071429
| 70
| 3
| 55
| 23.333333
| 0.707692
| 0
| 0
| 0
| 0
| 0
| 0.391304
| 0.391304
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
38427f1dde01882ed198ed140eeb352817068942
| 120
|
py
|
Python
|
Part_3_advanced/m19_concurrency_II/threading_queue/homework_1_solution/book_book/rental_request.py
|
Mikma03/InfoShareacademy_Python_Courses
|
3df1008c8c92831bebf1625f960f25b39d6987e6
|
[
"MIT"
] | null | null | null |
Part_3_advanced/m19_concurrency_II/threading_queue/homework_1_solution/book_book/rental_request.py
|
Mikma03/InfoShareacademy_Python_Courses
|
3df1008c8c92831bebf1625f960f25b39d6987e6
|
[
"MIT"
] | null | null | null |
Part_3_advanced/m19_concurrency_II/threading_queue/homework_1_solution/book_book/rental_request.py
|
Mikma03/InfoShareacademy_Python_Courses
|
3df1008c8c92831bebf1625f960f25b39d6987e6
|
[
"MIT"
] | null | null | null |
from dataclasses import dataclass
@dataclass
class RentalRequest:
author: str
title: str
renter_name: str
| 13.333333
| 33
| 0.733333
| 14
| 120
| 6.214286
| 0.785714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.225
| 120
| 8
| 34
| 15
| 0.935484
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
38440a41f58036c599b03e0d85e9a22c2bd913e5
| 53
|
py
|
Python
|
src/joseki/data/rfm/__init__.py
|
nollety/joseki
|
dffc837cff185b0a1c931de7076bbefda7742405
|
[
"MIT"
] | 3
|
2021-12-15T10:48:24.000Z
|
2022-01-11T10:06:49.000Z
|
src/joseki/data/rfm/__init__.py
|
nollety/joseki
|
dffc837cff185b0a1c931de7076bbefda7742405
|
[
"MIT"
] | 120
|
2021-05-28T06:46:23.000Z
|
2022-03-31T07:15:21.000Z
|
src/joseki/data/rfm/__init__.py
|
nollety/joseki
|
dffc837cff185b0a1c931de7076bbefda7742405
|
[
"MIT"
] | null | null | null |
"""Data files from Reference Forward Model (RFM)."""
| 26.5
| 52
| 0.698113
| 7
| 53
| 5.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132075
| 53
| 1
| 53
| 53
| 0.804348
| 0.867925
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
69aed763976890ea7643421ad84c57b0f64c0895
| 186
|
py
|
Python
|
app/app/serializers.py
|
iam-hitesh/fampay-coding-assessment
|
94b810a53b736495f0889c291aecbfc7d70a665f
|
[
"MIT"
] | null | null | null |
app/app/serializers.py
|
iam-hitesh/fampay-coding-assessment
|
94b810a53b736495f0889c291aecbfc7d70a665f
|
[
"MIT"
] | null | null | null |
app/app/serializers.py
|
iam-hitesh/fampay-coding-assessment
|
94b810a53b736495f0889c291aecbfc7d70a665f
|
[
"MIT"
] | null | null | null |
from rest_framework import serializers
from app import models
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = models.Video
exclude = ['id']
| 20.666667
| 51
| 0.72043
| 20
| 186
| 6.65
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.215054
| 186
| 8
| 52
| 23.25
| 0.910959
| 0
| 0
| 0
| 0
| 0
| 0.010753
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
69ce365c919bf838b90bcd70f8cad77885594b1e
| 123
|
py
|
Python
|
configure/bDNN/mfcc/config.py
|
MeitalRann/Feature-and-Arcitecture-Study-for-Speech-Activity-Detection
|
1f37d2090c41081ccedc0dd1fa0d1721b026b396
|
[
"MIT"
] | 1
|
2021-01-13T00:09:02.000Z
|
2021-01-13T00:09:02.000Z
|
configure/bDNN/mfcc/config.py
|
MeitalRann/Feature-and-Arcitecture-Study-for-Speech-Activity-Detection
|
1f37d2090c41081ccedc0dd1fa0d1721b026b396
|
[
"MIT"
] | null | null | null |
configure/bDNN/mfcc/config.py
|
MeitalRann/Feature-and-Arcitecture-Study-for-Speech-Activity-Detection
|
1f37d2090c41081ccedc0dd1fa0d1721b026b396
|
[
"MIT"
] | null | null | null |
lr = 0.0001
dropout_rate = 0.5
max_epoch = 3136 #3317
batch_size = 4096
w = 19
u = 9
num_hidden_1 = 512
num_hidden_2 = 512
| 13.666667
| 22
| 0.707317
| 26
| 123
| 3.076923
| 0.846154
| 0.225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.306122
| 0.203252
| 123
| 8
| 23
| 15.375
| 0.510204
| 0.03252
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
69d090699187c849dbfd7a6ede0c7fbaccafb44b
| 112
|
py
|
Python
|
pytd_entry.py
|
perfect-less/Python-YouTube-Downloader
|
2a4d2eeebfda42339614938e5c65fd86615e87f7
|
[
"Unlicense"
] | 2
|
2022-03-07T06:46:32.000Z
|
2022-03-07T15:22:02.000Z
|
pytd_entry.py
|
perfect-less/Python-YouTube-Downloader
|
2a4d2eeebfda42339614938e5c65fd86615e87f7
|
[
"Unlicense"
] | null | null | null |
pytd_entry.py
|
perfect-less/Python-YouTube-Downloader
|
2a4d2eeebfda42339614938e5c65fd86615e87f7
|
[
"Unlicense"
] | null | null | null |
#!/usr/bin/env python
import sys
from pytd.cli import main
if __name__ == "__main__":
sys.exit(main())
| 16
| 26
| 0.660714
| 17
| 112
| 3.882353
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.196429
| 112
| 7
| 27
| 16
| 0.733333
| 0.178571
| 0
| 0
| 0
| 0
| 0.086957
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
69dede691765eb50d0539cd2486ccef272712a4f
| 186
|
py
|
Python
|
virtualenv/Scripts/django-admin.py
|
Garabed96/mywebsite
|
af13f299782d4cda2a17896e37981b38ae0fa61d
|
[
"MIT"
] | null | null | null |
virtualenv/Scripts/django-admin.py
|
Garabed96/mywebsite
|
af13f299782d4cda2a17896e37981b38ae0fa61d
|
[
"MIT"
] | 7
|
2020-08-02T21:49:06.000Z
|
2021-09-22T19:19:11.000Z
|
virtualenv/Scripts/django-admin.py
|
Garabed96/mywebsite
|
af13f299782d4cda2a17896e37981b38ae0fa61d
|
[
"MIT"
] | null | null | null |
#!c:\users\garo5\onedrive\desktop\myweb\mywebsite\virtualenv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 31
| 79
| 0.801075
| 24
| 186
| 5.75
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005848
| 0.080645
| 186
| 5
| 80
| 37.2
| 0.80117
| 0.419355
| 0
| 0
| 0
| 0
| 0.074766
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
69e7a331ca59f3ea5c13362f12814c9053464e80
| 2,061
|
py
|
Python
|
src/schoology-extractor/edfi_schoology_extractor/mapping/section_update_comments.py
|
stephenfuqua/Ed-Fi-X-Fizz
|
94597eda585d4f62f69c12e2a58fa8e8846db11b
|
[
"Apache-2.0"
] | 3
|
2020-10-15T10:29:59.000Z
|
2020-12-01T21:40:55.000Z
|
src/schoology-extractor/edfi_schoology_extractor/mapping/section_update_comments.py
|
stephenfuqua/Ed-Fi-X-Fizz
|
94597eda585d4f62f69c12e2a58fa8e8846db11b
|
[
"Apache-2.0"
] | 40
|
2020-08-17T21:08:33.000Z
|
2021-02-02T19:56:09.000Z
|
src/schoology-extractor/edfi_schoology_extractor/mapping/section_update_comments.py
|
stephenfuqua/Ed-Fi-X-Fizz
|
94597eda585d4f62f69c12e2a58fa8e8846db11b
|
[
"Apache-2.0"
] | 10
|
2021-06-10T16:27:27.000Z
|
2021-12-27T12:31:57.000Z
|
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
import pandas as pd
DISCUSSION_REPLIES_TYPE = "discussion-reply"
def map_to_udm(section_updates_df: pd.DataFrame, section_id: int) -> pd.DataFrame:
"""
Maps a DataFrame containing Schoology section update comments
into the Ed-Fi LMS Unified Data Model (UDM) format.
Parameters
----------
section_updates_df: DataFrame
Pandas DataFrame containing Schoology section update comments for a section
Returns
-------
DataFrame
A LMSSectionActivities-formatted DataFrame
Notes
-----
DataFrame columns are:
SourceSystemIdentifier: A unique number or alphanumeric code assigned to a the update-comment by
the source system
SourceSystem: The system code or name providing the user data
LMSUserSourceSystemIdentifier: A unique number or alphanumeric code assigned to a user by the source
system
LMSSectionSourceSystemIdentifier: A unique number or alphanumeric code assigned to a section by the
source system
ActivityDateTime: The date/time the replied was created.
ActivityStatus: The status for the reply
ActivityType: The type of activity: `Discussion reply`
Content: The comment text.
AssignmentIdentifier: A unique numeric identifier assigned to the assignment.
ActivityTimeInMinutes: The total activity time in minutes.
CreateDate: Date/time at which the record was first retrieved
LastModifiedDate: Date/time when the record was modified, or when first retrieved
SourceCreateDate: Date this record was created in the LMS
SourceLastModifiedDate: Date this record was last updated in the LMS
"""
# TODO: complete the mapping under ticket LMS-170
return section_updates_df
| 42.061224
| 108
| 0.72295
| 263
| 2,061
| 5.623574
| 0.460076
| 0.018932
| 0.014199
| 0.030426
| 0.151454
| 0.151454
| 0.085193
| 0.085193
| 0.085193
| 0
| 0
| 0.004419
| 0.231441
| 2,061
| 48
| 109
| 42.9375
| 0.929293
| 0.838913
| 0
| 0
| 0
| 0
| 0.081633
| 0
| 0
| 0
| 0
| 0.020833
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
69f320e128715c3fe15d81fafcf81a507b22f30c
| 905
|
py
|
Python
|
mysite/views.py
|
uadson/django_hello_word
|
ac47468d64799db95e759034f96969ecf0f81cfd
|
[
"MIT"
] | null | null | null |
mysite/views.py
|
uadson/django_hello_word
|
ac47468d64799db95e759034f96969ecf0f81cfd
|
[
"MIT"
] | null | null | null |
mysite/views.py
|
uadson/django_hello_word
|
ac47468d64799db95e759034f96969ecf0f81cfd
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render, HttpResponse
# Create your views here.
def index(request):
return HttpResponse('<h1>Olá Dev</h1>')
def nome(request, nome):
return HttpResponse('<h1>Olá {}</h1>'.format(nome))
def soma(request, num1, num2):
soma = num1 + num2
return HttpResponse('<h1>A soma entre {} e {} é igual a {}</h1>'.format(
num1, num2, soma
))
def sub(request, num1, num2):
subt = num1 - num2
return HttpResponse('<h1>A subtração entre {} e {} é igual a {}</h1>'.format(
num1, num2, subt
))
def mult(request, num1, num2):
mult = num1 * num2
return HttpResponse('<h1>A multiplicação entre {} e {} é igual a {}</h1>'.format(
num1, num2, mult
))
def dividir(request, num1, num2):
divisao = num1 / num2
return HttpResponse('<h1>A divisão entre {} e {} é igual a {}</h1>'.format(
num1, num2, divisao
))
| 26.617647
| 85
| 0.60884
| 122
| 905
| 4.516393
| 0.286885
| 0.174229
| 0.217786
| 0.188748
| 0.421053
| 0.421053
| 0.210526
| 0.210526
| 0.210526
| 0
| 0
| 0.051948
| 0.234254
| 905
| 34
| 86
| 26.617647
| 0.743146
| 0.025414
| 0
| 0.16
| 0
| 0
| 0.245176
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.24
| false
| 0
| 0.04
| 0.08
| 0.52
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
384f01422ab29c554c80a07764b6e29341a686a9
| 127
|
py
|
Python
|
src/scratch.py
|
Omkar-Ranadive/Fine-Tuning-BERT
|
b046092ec4007a4a59e1a478576cca7557c18d76
|
[
"Apache-2.0"
] | 1
|
2020-05-24T03:21:25.000Z
|
2020-05-24T03:21:25.000Z
|
src/scratch.py
|
Omkar-Ranadive/Fine-Tuning-BERT
|
b046092ec4007a4a59e1a478576cca7557c18d76
|
[
"Apache-2.0"
] | null | null | null |
src/scratch.py
|
Omkar-Ranadive/Fine-Tuning-BERT
|
b046092ec4007a4a59e1a478576cca7557c18d76
|
[
"Apache-2.0"
] | null | null | null |
import torch
arr = torch.ones((2, 3))
print(arr.shape)
arr2 = torch.arange(20).unsqueeze(1)
print(arr2.shape)
print(arr.shape)
| 18.142857
| 36
| 0.724409
| 22
| 127
| 4.181818
| 0.590909
| 0.173913
| 0.282609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06087
| 0.094488
| 127
| 7
| 37
| 18.142857
| 0.73913
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 0.166667
| 0.5
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
3858a36ffaeb90db82901e734d3cf3c97df8da05
| 632
|
py
|
Python
|
src/bots/__init__.py
|
hyper-neutrino/bot-suite
|
b417647430ee8aba3ca710788b2867d4708dbc48
|
[
"MIT"
] | null | null | null |
src/bots/__init__.py
|
hyper-neutrino/bot-suite
|
b417647430ee8aba3ca710788b2867d4708dbc48
|
[
"MIT"
] | null | null | null |
src/bots/__init__.py
|
hyper-neutrino/bot-suite
|
b417647430ee8aba3ca710788b2867d4708dbc48
|
[
"MIT"
] | null | null | null |
def start(name):
if name == "toplane":
from .toplane import client
elif name == "jungler":
from .jungler import client
elif name == "midlane":
from .midlane import client
elif name == "botlane":
from .botlane import client
elif name == "support":
from .support import client
elif name == "summoner":
from .summoner import start
start()
return
elif name == "timer":
from .timer import client
elif name == "neutrino":
from .neutrino import client
elif name == "testing":
from .testing import client
else:
print(f"bot {name} => ?")
return
client.main()
| 25.28
| 32
| 0.625
| 76
| 632
| 5.197368
| 0.302632
| 0.243038
| 0.283544
| 0.35443
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.261076
| 632
| 25
| 33
| 25.28
| 0.845824
| 0
| 0
| 0.08
| 0
| 0
| 0.123223
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04
| false
| 0
| 0.36
| 0
| 0.48
| 0.04
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
388daef924d7cd99c11f29b892e2ee6c51651127
| 818
|
py
|
Python
|
type_converter/icon_type_converter/actions/__init__.py
|
killstrelok/insightconnect-plugins
|
911358925f4233ab273dbd8172e8b7b9188ebc01
|
[
"MIT"
] | null | null | null |
type_converter/icon_type_converter/actions/__init__.py
|
killstrelok/insightconnect-plugins
|
911358925f4233ab273dbd8172e8b7b9188ebc01
|
[
"MIT"
] | null | null | null |
type_converter/icon_type_converter/actions/__init__.py
|
killstrelok/insightconnect-plugins
|
911358925f4233ab273dbd8172e8b7b9188ebc01
|
[
"MIT"
] | null | null | null |
# GENERATED BY KOMAND SDK - DO NOT EDIT
from .array_diff.action import ArrayDiff
from .array_to_string.action import ArrayToString
from .boolean_to_integer.action import BooleanToInteger
from .boolean_to_string.action import BooleanToString
from .combine_arrays.action import CombineArrays
from .integer_to_boolean.action import IntegerToBoolean
from .integer_to_number.action import IntegerToNumber
from .integer_to_string.action import IntegerToString
from .number_to_integer.action import NumberToInteger
from .object_to_string.action import ObjectToString
from .string_to_boolean.action import StringToBoolean
from .string_to_float.action import StringToFloat
from .string_to_integer.action import StringToInteger
from .string_to_list.action import StringToList
from .string_to_object.action import StringToObject
| 48.117647
| 55
| 0.876528
| 110
| 818
| 6.263636
| 0.336364
| 0.261248
| 0.087083
| 0.11611
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.084352
| 818
| 16
| 56
| 51.125
| 0.919893
| 0.045232
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
388ed67e7334e03752e59d1f3864adb0e3ae70c7
| 518
|
py
|
Python
|
src/agent/agent.py
|
Lukeeeeee/AlphaDriver
|
93635f5c22f8d1c9d1fca41328565f2c1e2f98ab
|
[
"MIT"
] | null | null | null |
src/agent/agent.py
|
Lukeeeeee/AlphaDriver
|
93635f5c22f8d1c9d1fca41328565f2c1e2f98ab
|
[
"MIT"
] | null | null | null |
src/agent/agent.py
|
Lukeeeeee/AlphaDriver
|
93635f5c22f8d1c9d1fca41328565f2c1e2f98ab
|
[
"MIT"
] | null | null | null |
class Agent(object):
standard_key_list = []
def __init__(self, env, config, model=None):
self.env = env
self.config = config
self.model = model
self.state = None
self.action = None
self.reward = None
self.reward_list = None
pass
def observe(self, *args, **kwargs):
pass
def predict(self, *args, **kwargs):
pass
def update(self, *args, **kwargs):
pass
def play(self, *args, **kwargs):
pass
| 17.862069
| 48
| 0.53668
| 60
| 518
| 4.516667
| 0.383333
| 0.118081
| 0.206642
| 0.265683
| 0.232472
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.349421
| 518
| 28
| 49
| 18.5
| 0.804154
| 0
| 0
| 0.263158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.263158
| false
| 0.263158
| 0
| 0
| 0.368421
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
3894e481104851f0846ae4c5a8c0730622839522
| 28
|
py
|
Python
|
raskolnikov/controllers/__init__.py
|
eivind88/raskolnikov-browser
|
32c62b53ca370f6fda0b25f473d5f2cd5b39ff3c
|
[
"BSD-3-Clause"
] | null | null | null |
raskolnikov/controllers/__init__.py
|
eivind88/raskolnikov-browser
|
32c62b53ca370f6fda0b25f473d5f2cd5b39ff3c
|
[
"BSD-3-Clause"
] | null | null | null |
raskolnikov/controllers/__init__.py
|
eivind88/raskolnikov-browser
|
32c62b53ca370f6fda0b25f473d5f2cd5b39ff3c
|
[
"BSD-3-Clause"
] | null | null | null |
"""
Controller classes.
"""
| 7
| 19
| 0.607143
| 2
| 28
| 8.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 28
| 3
| 20
| 9.333333
| 0.708333
| 0.678571
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
38996ef60648eda9fe7ebb056c3cf3c69b992307
| 162
|
py
|
Python
|
Task/Literals-Integer/Python/literals-integer-2.py
|
LaudateCorpus1/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 5
|
2021-01-29T20:08:05.000Z
|
2022-03-22T06:16:05.000Z
|
Task/Literals-Integer/Python/literals-integer-2.py
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | null | null | null |
Task/Literals-Integer/Python/literals-integer-2.py
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 1
|
2021-04-13T04:19:31.000Z
|
2021-04-13T04:19:31.000Z
|
>>> # Bin(leading 0b or 0B), Oct(leading 0o or 0O, or just 0), Dec, Hex(leading 0x or 0X), in order:
>>> 0b1011010111 == 0o1327 == 01327 == 727 == 0x2d7
True
>>>
| 32.4
| 100
| 0.617284
| 27
| 162
| 3.703704
| 0.703704
| 0.08
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.261538
| 0.197531
| 162
| 4
| 101
| 40.5
| 0.507692
| 0.580247
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075758
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
38c89bbc956ec5c0f49a4c620fe23355f3231635
| 215
|
py
|
Python
|
source/58-Conta_ocorrências_de_a.py
|
FelixLuciano/DesSoft-2020.2
|
a44063d63778329f1e1266881f20f7954ecb528b
|
[
"MIT"
] | null | null | null |
source/58-Conta_ocorrências_de_a.py
|
FelixLuciano/DesSoft-2020.2
|
a44063d63778329f1e1266881f20f7954ecb528b
|
[
"MIT"
] | null | null | null |
source/58-Conta_ocorrências_de_a.py
|
FelixLuciano/DesSoft-2020.2
|
a44063d63778329f1e1266881f20f7954ecb528b
|
[
"MIT"
] | null | null | null |
# Conta ocorrências de a
# Faça uma função que recebe uma string e retorna o número de vezes em que a letra 'a' aparece nela.
# O nome da sua função deve ser conta_a.
def conta_a (text):
return text.count("a")
| 30.714286
| 100
| 0.72093
| 41
| 215
| 3.731707
| 0.682927
| 0.078431
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.209302
| 215
| 6
| 101
| 35.833333
| 0.9
| 0.744186
| 0
| 0
| 0
| 0
| 0.019608
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
38d380a398e7eedb13c0ca38c28b76cb493caa92
| 9,407
|
py
|
Python
|
FEV_KEGG/Experiments/13.py
|
ryhaberecht/FEV-KEGG
|
f55f294aae07b76954ed823f0c2e6d189fb2b1bb
|
[
"MIT"
] | null | null | null |
FEV_KEGG/Experiments/13.py
|
ryhaberecht/FEV-KEGG
|
f55f294aae07b76954ed823f0c2e6d189fb2b1bb
|
[
"MIT"
] | 2
|
2019-05-30T06:42:08.000Z
|
2021-05-06T10:37:40.000Z
|
FEV_KEGG/Experiments/13.py
|
ryhaberecht/FEV-KEGG
|
f55f294aae07b76954ed823f0c2e6d189fb2b1bb
|
[
"MIT"
] | null | null | null |
"""
Question
--------
Which EC numbers are present in all Escherichia coli K-12 organisms?
Method
------
- Get all metabolic pathways of all E. coli organisms from KEGG.
- For each organisms, combine all pathways to the metabolic network, by UNION operation.
- Convert this metabolic network into a substance-ecNumber graph.
- Combine all organisms' networks to a consensus network, by INTERSECT operation, leaving only substances and EC numbers that occur in all organisms.
- Print all EC numbers that occur in all organisms.
Result
------
::
560 results
1.-.-.-
1.1.-.-
1.1.1.-
1.1.1.1
1.1.1.100
1.1.1.103
1.1.1.127
1.1.1.130
1.1.1.140
1.1.1.169
1.1.1.17
1.1.1.205
1.1.1.22
1.1.1.23
1.1.1.25
1.1.1.262
1.1.1.267
1.1.1.282
1.1.1.290
1.1.1.336
1.1.1.350
1.1.1.37
1.1.1.38
1.1.1.380
1.1.1.40
1.1.1.42
1.1.1.6
1.1.1.60
1.1.1.77
1.1.1.86
1.1.1.94
1.1.2.3
1.1.5.12
1.1.5.2
1.1.5.3
1.1.5.4
1.1.98.6
1.1.99.1
1.11.1.21
1.11.1.6
1.11.1.9
1.12.99.6
1.13.11.16
1.14.12.19
1.14.13.127
1.14.14.5
1.14.99.46
1.17.1.4
1.17.1.8
1.17.4.1
1.17.7.4
1.18.1.3
1.2.1.-
1.2.1.11
1.2.1.12
1.2.1.19
1.2.1.38
1.2.1.41
1.2.1.70
1.2.1.71
1.2.1.72
1.2.1.8
1.2.1.99
1.2.4.1
1.2.4.2
1.2.5.1
1.3.1.-
1.3.1.1
1.3.1.28
1.3.1.87
1.3.1.98
1.3.3.3
1.3.5.2
1.3.5.3
1.3.5.4
1.3.98.3
1.3.99.-
1.4.1.4
1.4.3.-
1.4.3.16
1.4.3.5
1.4.4.2
1.4.5.1
1.5.1.-
1.5.1.2
1.5.1.20
1.5.1.3
1.5.1.38
1.6.1.1
1.6.1.2
1.6.5.2
1.7.1.13
1.7.1.15
1.7.1.7
1.7.2.2
1.7.99.-
1.7.99.1
1.8.1.2
1.8.1.4
1.8.1.7
1.8.1.9
1.8.4.14
1.8.5.3
1.97.1.9
2.1.1.13
2.1.1.14
2.1.1.197
2.1.1.37
2.1.1.45
2.1.2.1
2.1.2.11
2.1.2.2
2.1.2.9
2.1.3.2
2.1.3.3
2.10.1.1
2.2.1.1
2.2.1.2
2.2.1.6
2.2.1.7
2.2.1.9
2.3.1.-
2.3.1.1
2.3.1.109
2.3.1.117
2.3.1.12
2.3.1.129
2.3.1.15
2.3.1.16
2.3.1.179
2.3.1.180
2.3.1.181
2.3.1.183
2.3.1.191
2.3.1.241
2.3.1.243
2.3.1.29
2.3.1.30
2.3.1.39
2.3.1.41
2.3.1.46
2.3.1.47
2.3.1.51
2.3.1.54
2.3.1.57
2.3.1.61
2.3.1.8
2.3.1.9
2.3.3.1
2.3.3.9
2.4.1.1
2.4.1.12
2.4.1.15
2.4.1.18
2.4.1.182
2.4.1.21
2.4.1.227
2.4.1.25
2.4.1.7
2.4.2.-
2.4.2.1
2.4.2.10
2.4.2.14
2.4.2.17
2.4.2.19
2.4.2.21
2.4.2.22
2.4.2.3
2.4.2.4
2.4.2.53
2.4.2.7
2.4.2.8
2.4.2.9
2.5.1.-
2.5.1.129
2.5.1.15
2.5.1.16
2.5.1.17
2.5.1.18
2.5.1.19
2.5.1.3
2.5.1.31
2.5.1.47
2.5.1.48
2.5.1.54
2.5.1.55
2.5.1.6
2.5.1.61
2.5.1.72
2.5.1.78
2.5.1.9
2.5.1.90
2.6.1.1
2.6.1.19
2.6.1.42
2.6.1.52
2.6.1.57
2.6.1.62
2.6.1.66
2.6.1.81
2.6.1.82
2.6.1.85
2.6.1.87
2.6.1.9
2.6.99.2
2.7.1.-
2.7.1.107
2.7.1.11
2.7.1.12
2.7.1.130
2.7.1.148
2.7.1.15
2.7.1.165
2.7.1.17
2.7.1.191
2.7.1.192
2.7.1.193
2.7.1.194
2.7.1.197
2.7.1.198
2.7.1.199
2.7.1.2
2.7.1.201
2.7.1.202
2.7.1.21
2.7.1.23
2.7.1.24
2.7.1.25
2.7.1.30
2.7.1.33
2.7.1.35
2.7.1.39
2.7.1.4
2.7.1.40
2.7.1.45
2.7.1.48
2.7.1.5
2.7.1.50
2.7.1.51
2.7.1.53
2.7.1.55
2.7.1.56
2.7.1.58
2.7.1.59
2.7.1.60
2.7.1.71
2.7.1.73
2.7.1.83
2.7.1.89
2.7.2.1
2.7.2.11
2.7.2.15
2.7.2.2
2.7.2.3
2.7.2.4
2.7.2.8
2.7.4.16
2.7.4.22
2.7.4.23
2.7.4.25
2.7.4.3
2.7.4.6
2.7.4.8
2.7.4.9
2.7.6.1
2.7.6.3
2.7.7.12
2.7.7.18
2.7.7.24
2.7.7.27
2.7.7.3
2.7.7.38
2.7.7.4
2.7.7.41
2.7.7.6
2.7.7.60
2.7.7.7
2.7.7.73
2.7.7.75
2.7.7.76
2.7.7.77
2.7.7.8
2.7.7.9
2.7.8.-
2.7.8.13
2.7.8.26
2.7.8.37
2.7.8.5
2.7.8.8
2.7.9.2
2.7.9.3
2.8.1.1
2.8.1.10
2.8.1.12
2.8.1.4
2.8.1.6
2.8.1.7
2.8.1.8
3.1.1.-
3.1.1.11
3.1.1.31
3.1.1.45
3.1.1.5
3.1.1.85
3.1.2.-
3.1.2.12
3.1.2.28
3.1.2.6
3.1.3.1
3.1.3.10
3.1.3.11
3.1.3.12
3.1.3.18
3.1.3.2
3.1.3.25
3.1.3.27
3.1.3.3
3.1.3.45
3.1.3.5
3.1.3.70
3.1.3.73
3.1.3.89
3.1.4.14
3.1.4.46
3.1.4.53
3.1.4.55
3.1.5.1
3.1.6.1
3.2.1.1
3.2.1.196
3.2.1.20
3.2.1.21
3.2.1.22
3.2.1.23
3.2.1.28
3.2.1.31
3.2.1.52
3.2.1.86
3.2.1.93
3.2.2.4
3.2.2.8
3.2.2.9
3.4.11.1
3.4.11.2
3.4.11.23
3.4.13.-
3.5.1.-
3.5.1.1
3.5.1.10
3.5.1.108
3.5.1.110
3.5.1.16
3.5.1.18
3.5.1.2
3.5.1.25
3.5.1.42
3.5.1.94
3.5.1.96
3.5.2.17
3.5.2.2
3.5.2.3
3.5.2.5
3.5.3.11
3.5.3.23
3.5.3.26
3.5.3.9
3.5.4.13
3.5.4.16
3.5.4.2
3.5.4.25
3.5.4.3
3.5.4.4
3.5.4.5
3.5.99.6
3.6.1.-
3.6.1.13
3.6.1.22
3.6.1.23
3.6.1.26
3.6.1.27
3.6.1.41
3.6.1.54
3.6.1.63
3.6.1.66
3.6.1.67
3.6.1.7
3.6.1.9
3.7.1.14
4.1.1.11
4.1.1.15
4.1.1.17
4.1.1.18
4.1.1.19
4.1.1.20
4.1.1.23
4.1.1.31
4.1.1.37
4.1.1.41
4.1.1.47
4.1.1.49
4.1.1.50
4.1.1.65
4.1.1.8
4.1.1.85
4.1.2.13
4.1.2.17
4.1.2.19
4.1.2.20
4.1.2.21
4.1.2.4
4.1.2.40
4.1.2.48
4.1.2.53
4.1.3.-
4.1.3.1
4.1.3.27
4.1.3.3
4.1.3.36
4.1.3.38
4.1.3.40
4.1.99.1
4.1.99.12
4.1.99.17
4.1.99.19
4.1.99.22
4.2.1.1
4.2.1.10
4.2.1.104
4.2.1.11
4.2.1.113
4.2.1.12
4.2.1.126
4.2.1.2
4.2.1.20
4.2.1.24
4.2.1.3
4.2.1.32
4.2.1.40
4.2.1.42
4.2.1.46
4.2.1.59
4.2.1.6
4.2.1.7
4.2.1.70
4.2.1.75
4.2.1.8
4.2.1.90
4.2.3.1
4.2.3.3
4.2.3.4
4.2.3.5
4.2.99.20
4.3.1.1
4.3.1.17
4.3.1.18
4.3.1.19
4.3.1.7
4.3.2.1
4.3.2.2
4.3.2.3
4.3.3.7
4.3.99.3
4.4.1.21
4.4.1.5
4.4.1.8
4.6.1.12
4.6.1.17
4.7.1.1
5.1.1.1
5.1.1.3
5.1.1.7
5.1.3.-
5.1.3.1
5.1.3.14
5.1.3.15
5.1.3.2
5.1.3.20
5.1.3.22
5.1.3.3
5.1.3.4
5.1.3.9
5.1.99.7
5.3.1.-
5.3.1.1
5.3.1.12
5.3.1.13
5.3.1.14
5.3.1.16
5.3.1.17
5.3.1.22
5.3.1.28
5.3.1.5
5.3.1.6
5.3.1.8
5.3.1.9
5.3.3.2
5.4.2.10
5.4.2.11
5.4.2.12
5.4.2.2
5.4.2.6
5.4.2.7
5.4.3.8
5.4.4.2
5.4.99.18
6.1.1.1
6.1.1.10
6.1.1.11
6.1.1.12
6.1.1.14
6.1.1.15
6.1.1.16
6.1.1.17
6.1.1.18
6.1.1.19
6.1.1.2
6.1.1.20
6.1.1.21
6.1.1.22
6.1.1.3
6.1.1.4
6.1.1.5
6.1.1.6
6.1.1.7
6.1.1.9
6.2.1.1
6.2.1.26
6.2.1.3
6.2.1.5
6.3.1.1
6.3.1.11
6.3.1.2
6.3.1.20
6.3.1.5
6.3.2.1
6.3.2.10
6.3.2.13
6.3.2.14
6.3.2.2
6.3.2.3
6.3.2.4
6.3.2.6
6.3.2.8
6.3.2.9
6.3.3.1
6.3.3.2
6.3.3.3
6.3.4.13
6.3.4.15
6.3.4.18
6.3.4.2
6.3.4.20
6.3.4.21
6.3.4.4
6.3.4.5
6.3.5.2
6.3.5.3
6.3.5.4
6.3.5.5
6.4.1.2
Conclusion
----------
Alls organisms of E. coli K-12 share a high number of EC numbers.
"""
from FEV_KEGG.Graph.SubstanceGraphs import SubstanceReactionGraph, SubstanceGeneGraph, SubstanceEcGraph
import FEV_KEGG.KEGG.Organism
if __name__ == '__main__':
#- Get all metabolic pathways of all E. coli organisms from KEGG.
eColiOrganisms = FEV_KEGG.KEGG.Organism.Group(searchString = 'Escherichia coli K-12').organisms
#- For each organism, combine all pathways to the metabolic network, by UNION operation.
organismEcGraphs = []
for organism in eColiOrganisms:
organismPathways = organism.getMetabolicPathways()
organismSubstanceReactionGraph = SubstanceReactionGraph.fromPathway(organismPathways)
#- Convert this metabolic network into a substance-ecNumber graph.
organismSubstanceGeneGraph = SubstanceGeneGraph.fromSubstanceReactionGraph(organismSubstanceReactionGraph)
organismSubstanceEcGraph = SubstanceEcGraph.fromSubstanceGeneGraph(organismSubstanceGeneGraph)
organismEcGraphs.append(organismSubstanceEcGraph)
firstGraph = organismEcGraphs.pop(0)
#- Combine all organisms' networks to a consensus network, by INTERSECT operation, leaving only substances and EC numbers that occur in all organisms.
intersectedEcGraph = firstGraph
intersectedEcGraph = intersectedEcGraph.intersection(organismEcGraphs)
#- Print all EC numbers that occur in all organisms.
output = []
for ecNumber in intersectedEcGraph.getECs():
output.append(ecNumber.__str__())
output.sort()
print(str(len(output)) + ' results')
for line in output:
print(line)
| 15.172581
| 154
| 0.459339
| 2,460
| 9,407
| 1.750407
| 0.087805
| 0.06967
| 0.030655
| 0.009289
| 0.243381
| 0.195077
| 0.152113
| 0.152113
| 0.152113
| 0.108453
| 0
| 0.427464
| 0.341979
| 9,407
| 620
| 155
| 15.172581
| 0.268174
| 0.872329
| 0
| 0
| 0
| 0
| 0.031092
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.095238
| 0
| 0.095238
| 0.095238
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2a079a9a2af8f23d8a48e488f5b4518b3ba317fe
| 263
|
py
|
Python
|
techtest/social_media/admin.py
|
vittoriozamboni/techtest-backend
|
783a55a8ea18738c92445ace3e218402b1731fa0
|
[
"MIT"
] | null | null | null |
techtest/social_media/admin.py
|
vittoriozamboni/techtest-backend
|
783a55a8ea18738c92445ace3e218402b1731fa0
|
[
"MIT"
] | null | null | null |
techtest/social_media/admin.py
|
vittoriozamboni/techtest-backend
|
783a55a8ea18738c92445ace3e218402b1731fa0
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# Register your models here.
import models
admin.site.register(models.Category)
admin.site.register(models.ContentType)
admin.site.register(models.Owner)
admin.site.register(models.Post)
admin.site.register(models.SocialMedia)
| 21.916667
| 39
| 0.821293
| 36
| 263
| 6
| 0.416667
| 0.208333
| 0.393519
| 0.532407
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.072243
| 263
| 11
| 40
| 23.909091
| 0.885246
| 0.098859
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.285714
| 0
| 0.285714
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2a2227ebf21ce44bef0e0d9fd1bf0c28150b2cbf
| 645
|
py
|
Python
|
Laberinto.py
|
Rauulito/PracticaAmpliacionT3
|
6858a9607d56885bc55da2bb9547eb76be6cb9a0
|
[
"Apache-2.0"
] | null | null | null |
Laberinto.py
|
Rauulito/PracticaAmpliacionT3
|
6858a9607d56885bc55da2bb9547eb76be6cb9a0
|
[
"Apache-2.0"
] | null | null | null |
Laberinto.py
|
Rauulito/PracticaAmpliacionT3
|
6858a9607d56885bc55da2bb9547eb76be6cb9a0
|
[
"Apache-2.0"
] | null | null | null |
import math
import os
import random
import re
import sys
if __name__ == '__main__':
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
k = int(first_multiple_input[2])
for n_itr in range(n):
row = input()
# Write your code here
for k_itr in range(k):
second_multiple_input = input().rstrip().split()
i1 = int(second_multiple_input[0])
j1 = int(second_multiple_input[1])
i2 = int(second_multiple_input[2])
j2 = int(second_multiple_input[3])
# Write your code here
# Write your code here
| 29.318182
| 56
| 0.63876
| 93
| 645
| 4.129032
| 0.387097
| 0.304688
| 0.247396
| 0.229167
| 0.151042
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022822
| 0.252713
| 645
| 22
| 57
| 29.318182
| 0.773859
| 0.096124
| 0
| 0
| 0
| 0
| 0.013793
| 0
| 0
| 0
| 0
| 0.045455
| 0
| 1
| 0
| false
| 0
| 0.277778
| 0
| 0.277778
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2a3c5aafa89cb42c3875c155ec7c4a2d0bcf72cf
| 88
|
py
|
Python
|
Project Euler #3: Largest prime factor/problem_3.py
|
gitvy/Project-Euler
|
b80f14bcd5b4b3bf4a9b98a8021a7abc714f89d9
|
[
"MIT"
] | null | null | null |
Project Euler #3: Largest prime factor/problem_3.py
|
gitvy/Project-Euler
|
b80f14bcd5b4b3bf4a9b98a8021a7abc714f89d9
|
[
"MIT"
] | 2
|
2018-10-06T10:46:04.000Z
|
2018-10-06T12:00:20.000Z
|
Project Euler #3: Largest prime factor/problem_3.py
|
gitvy/Project-Euler
|
b80f14bcd5b4b3bf4a9b98a8021a7abc714f89d9
|
[
"MIT"
] | 9
|
2018-10-03T17:33:54.000Z
|
2018-10-31T11:45:26.000Z
|
n = 600851475143
i=2
while(i*i<=n):
while(n%i==0):
n=n/i
i=i+1
print(n)
| 11
| 18
| 0.488636
| 20
| 88
| 2.15
| 0.4
| 0.139535
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238095
| 0.284091
| 88
| 7
| 19
| 12.571429
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.142857
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2a43103a930d49619f12a9606c1bd4e62d75bc00
| 280
|
py
|
Python
|
src/pylox/parser/expressions/literal.py
|
sarbor/lox_python
|
31149d9847995c353cfb9cd57bece8686b1d1cd8
|
[
"MIT"
] | null | null | null |
src/pylox/parser/expressions/literal.py
|
sarbor/lox_python
|
31149d9847995c353cfb9cd57bece8686b1d1cd8
|
[
"MIT"
] | null | null | null |
src/pylox/parser/expressions/literal.py
|
sarbor/lox_python
|
31149d9847995c353cfb9cd57bece8686b1d1cd8
|
[
"MIT"
] | null | null | null |
from pylox.parser.expressions.expression import Expression
from pylox.parser.visitors.visitor import Visitor
class Literal(Expression):
def __init__(self, value: str) -> None:
self.value = value
def accept(self, v: Visitor):
return v.visit_literal(self)
| 31.111111
| 58
| 0.725
| 36
| 280
| 5.5
| 0.555556
| 0.090909
| 0.151515
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.182143
| 280
| 9
| 59
| 31.111111
| 0.864629
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.285714
| 0.142857
| 0.857143
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
2a69ed8a6bb00f59cb2ec870c232ae8445f9cce0
| 1,183
|
py
|
Python
|
tests/__init__.py
|
COVID-19-Causal-Reasoning/BEL2SCM
|
8bc92c6016fdd0cbccd6c3c96ae3c9106b01446f
|
[
"MIT"
] | 3
|
2020-05-06T22:26:43.000Z
|
2020-05-19T06:23:06.000Z
|
tests/__init__.py
|
COVID-19-Causal-Reasoning/BEL2SCM
|
8bc92c6016fdd0cbccd6c3c96ae3c9106b01446f
|
[
"MIT"
] | 8
|
2020-08-19T17:23:07.000Z
|
2021-01-11T20:08:51.000Z
|
tests/__init__.py
|
COVID-19-Causal-Reasoning/BEL2SCM
|
8bc92c6016fdd0cbccd6c3c96ae3c9106b01446f
|
[
"MIT"
] | 2
|
2021-11-03T19:32:39.000Z
|
2021-12-14T06:03:30.000Z
|
"""Tests for BEL2SCM
test_bel2scm.py
---------------
This file contains all the test functions we used to generate sample data, testing and debugging
code for bel2scm algorithm.
Input files:
- BELSourceFiles contains bel graphs for all our test cases
- Data folder contains all the input and output data files
- Neuirps_BEL2SCM contains all python scripts for bel2scm algorithm
test_plots_bel2scm.py
---------------------
This is the test file which stores experiments to generate data
for plots in the paper that were generated using bel2scm algorithm.
Input files:
- BELSourceFiles contains bel graphs for all our test cases
- Data folder contains all the input and output data files
- Neuirps_BEL2SCM contains all python scripts for bel2scm algorithm
test_plots_known_parameters_scm.py
----------------------------------
This is the test file which stores experiments to generate data
for plots in the paper that were generated using DataGeneration SCM for covid-19 graph.
Input files:
- DataGenerationSCM folder contains code for generating
observational data for covid-19 graph using known parameters which
were hardcoded in the scripts using domain knowledge.
"""
| 36.96875
| 96
| 0.766695
| 170
| 1,183
| 5.282353
| 0.341176
| 0.061247
| 0.046771
| 0.057906
| 0.63029
| 0.63029
| 0.63029
| 0.63029
| 0.63029
| 0.63029
| 0
| 0.012961
| 0.152156
| 1,183
| 31
| 97
| 38.16129
| 0.882353
| 0.993238
| 0
| null | 1
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2a81aaba54527d302fad0f0d8b0df390baa56883
| 87
|
py
|
Python
|
polyaxon/tracker/manager.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
polyaxon/tracker/manager.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
polyaxon/tracker/manager.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
from event_manager.event_manager import EventManager
default_manager = EventManager()
| 21.75
| 52
| 0.862069
| 10
| 87
| 7.2
| 0.6
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 87
| 3
| 53
| 29
| 0.911392
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
2a82e1453690e402e7fa778ffba83616f08370ae
| 97
|
py
|
Python
|
src/app/service/apps.py
|
serious-notreally/cappa
|
993a8df35ca6c3b22f3ca811937fd29c07fc71aa
|
[
"MIT"
] | 9
|
2020-04-05T07:35:55.000Z
|
2021-08-03T05:50:05.000Z
|
src/app/service/apps.py
|
serious-notreally/cappa
|
993a8df35ca6c3b22f3ca811937fd29c07fc71aa
|
[
"MIT"
] | 89
|
2020-01-26T11:50:06.000Z
|
2022-03-31T07:14:18.000Z
|
src/app/service/apps.py
|
serious-notreally/cappa
|
993a8df35ca6c3b22f3ca811937fd29c07fc71aa
|
[
"MIT"
] | 13
|
2020-03-10T14:45:07.000Z
|
2021-07-31T02:43:40.000Z
|
from django.apps import AppConfig
class ServiceAppConfig(AppConfig):
name = 'app.service'
| 13.857143
| 34
| 0.752577
| 11
| 97
| 6.636364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164948
| 97
| 6
| 35
| 16.166667
| 0.901235
| 0
| 0
| 0
| 0
| 0
| 0.113402
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2a96d019b02b68db455b53a35291f6735fd11b58
| 474
|
py
|
Python
|
examtool/examtool/cli/kdf.py
|
akshitdewan/cs61a-apps
|
155f2afe98b238fb4b1c4ca1c79610ec55e826e6
|
[
"MIT"
] | 5
|
2020-09-10T01:45:09.000Z
|
2022-01-10T23:24:03.000Z
|
examtool/examtool/cli/kdf.py
|
akshitdewan/cs61a-apps
|
155f2afe98b238fb4b1c4ca1c79610ec55e826e6
|
[
"MIT"
] | 424
|
2020-08-24T06:22:59.000Z
|
2021-10-10T02:36:11.000Z
|
examtool/examtool/cli/kdf.py
|
akshitdewan/cs61a-apps
|
155f2afe98b238fb4b1c4ca1c79610ec55e826e6
|
[
"MIT"
] | 7
|
2020-08-28T22:05:10.000Z
|
2022-03-04T12:47:05.000Z
|
import base64
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
password = input("Password? ").encode("ascii")
salt = os.urandom(16)
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=100000,
backend=default_backend(),
)
key = base64.urlsafe_b64encode(kdf.derive(password))
print("Key: ", key)
| 26.333333
| 64
| 0.761603
| 58
| 474
| 6.172414
| 0.551724
| 0.134078
| 0.184358
| 0.178771
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.053012
| 0.124473
| 474
| 17
| 65
| 27.882353
| 0.809639
| 0
| 0
| 0
| 0
| 0
| 0.042194
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.125
| 0.3125
| 0
| 0.3125
| 0.0625
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
aa53806af074315c307e101cb7a1cee90103fcaa
| 236
|
py
|
Python
|
timm/__init__.py
|
smallzzy/pytorch-image-models
|
ba1745d1a11692bb50259a67ef2d676586d9f64c
|
[
"Apache-2.0"
] | null | null | null |
timm/__init__.py
|
smallzzy/pytorch-image-models
|
ba1745d1a11692bb50259a67ef2d676586d9f64c
|
[
"Apache-2.0"
] | null | null | null |
timm/__init__.py
|
smallzzy/pytorch-image-models
|
ba1745d1a11692bb50259a67ef2d676586d9f64c
|
[
"Apache-2.0"
] | null | null | null |
from .version import __version__
from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
is_scriptable, is_exportable, set_scriptable, set_exportable
from .optim import *
from .scheduler import *
| 33.714286
| 90
| 0.809322
| 31
| 236
| 5.741935
| 0.483871
| 0.101124
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127119
| 236
| 6
| 91
| 39.333333
| 0.864078
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
aa639e6ddc8c3f0029a94b354d84dc21b1b6bdd5
| 498
|
py
|
Python
|
Python3/181.py
|
rakhi2001/ecom7
|
73790d44605fbd51e8f7e804b9808e364fcfc680
|
[
"MIT"
] | 854
|
2018-11-09T08:06:16.000Z
|
2022-03-31T06:05:53.000Z
|
Python3/181.py
|
rakhi2001/ecom7
|
73790d44605fbd51e8f7e804b9808e364fcfc680
|
[
"MIT"
] | 29
|
2019-06-02T05:02:25.000Z
|
2021-11-15T04:09:37.000Z
|
Python3/181.py
|
rakhi2001/ecom7
|
73790d44605fbd51e8f7e804b9808e364fcfc680
|
[
"MIT"
] | 347
|
2018-12-23T01:57:37.000Z
|
2022-03-12T14:51:21.000Z
|
__________________________________________________________________________________________________
SELECT e1.Name FROM Employee e1
JOIN Employee e2 ON e1.ManagerId = e2.Id
WHERE e1.Salary > e2.Salary;
__________________________________________________________________________________________________
SELECT e1.Name FROM Employee e1, Employee e2
WHERE e1.ManagerId = e2.Id AND e1.Salary > e2.Salary;
__________________________________________________________________________________________________
| 55.333333
| 98
| 0.89759
| 37
| 498
| 4.135135
| 0.351351
| 0.104575
| 0.156863
| 0.20915
| 0.339869
| 0.339869
| 0
| 0
| 0
| 0
| 0
| 0.030172
| 0.068273
| 498
| 9
| 99
| 55.333333
| 0.299569
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
aa76226044e0cba62a04f025e69a290519eed2ee
| 27
|
py
|
Python
|
axiom/validation/__init__.py
|
AusClimateService/axiom
|
24678093065a4626549831086e4903e38f60fa81
|
[
"MIT"
] | null | null | null |
axiom/validation/__init__.py
|
AusClimateService/axiom
|
24678093065a4626549831086e4903e38f60fa81
|
[
"MIT"
] | 8
|
2022-03-16T12:08:12.000Z
|
2022-03-29T03:17:47.000Z
|
axiom/validation/__init__.py
|
AusClimateService/axiom
|
24678093065a4626549831086e4903e38f60fa81
|
[
"MIT"
] | null | null | null |
"""Validation functions."""
| 27
| 27
| 0.703704
| 2
| 27
| 9.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037037
| 27
| 1
| 27
| 27
| 0.730769
| 0.777778
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
aa88e0995b6708292d60ad3f3420220c98930a38
| 189
|
py
|
Python
|
gamelogic/roles/civilian.py
|
mobynickkk/mafia-bot
|
02eaa331ba5a98c67645d5ee9b8fec7dcfa75313
|
[
"Apache-2.0"
] | null | null | null |
gamelogic/roles/civilian.py
|
mobynickkk/mafia-bot
|
02eaa331ba5a98c67645d5ee9b8fec7dcfa75313
|
[
"Apache-2.0"
] | 4
|
2021-07-17T20:35:23.000Z
|
2021-07-18T08:37:37.000Z
|
gamelogic/roles/civilian.py
|
mobynickkk/mafia-bot
|
02eaa331ba5a98c67645d5ee9b8fec7dcfa75313
|
[
"Apache-2.0"
] | null | null | null |
from gamelogic.roles.abstractRole import AbstractRole
class Civilian(AbstractRole):
literal = 'Мирный житель'
def do_step(self):
return 'Ночью вы можете только спать :('
| 21
| 53
| 0.719577
| 22
| 189
| 6.136364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.201058
| 189
| 8
| 54
| 23.625
| 0.89404
| 0
| 0
| 0
| 0
| 0
| 0.232804
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
aa8cff4c7c04ab75c157257b6d28a4dbc936919a
| 189
|
py
|
Python
|
daskperiment/tests/core/metric/test_redis.py
|
sinhrks/daskperiment
|
63f5a18a0a0dc447698fb90947653b86a3c6160c
|
[
"BSD-3-Clause"
] | 27
|
2019-01-25T01:44:20.000Z
|
2019-11-13T14:26:56.000Z
|
daskperiment/tests/core/metric/test_redis.py
|
nikkkkhil/dask_task
|
1802efacd43e68e5e7dd8eb82e27b3cbf09d74ae
|
[
"BSD-3-Clause"
] | 64
|
2019-01-29T03:52:31.000Z
|
2019-04-25T07:55:09.000Z
|
daskperiment/tests/core/metric/test_redis.py
|
nikkkkhil/dask_task
|
1802efacd43e68e5e7dd8eb82e27b3cbf09d74ae
|
[
"BSD-3-Clause"
] | 5
|
2019-02-04T20:58:39.000Z
|
2019-04-14T11:45:48.000Z
|
from daskperiment.testing import CleanupMixin
from .base import MetricManagerBase
class TestRedisMetricManager(MetricManagerBase, CleanupMixin):
backend = 'redis://localhost:6379/0'
| 23.625
| 62
| 0.814815
| 18
| 189
| 8.555556
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029762
| 0.111111
| 189
| 7
| 63
| 27
| 0.886905
| 0
| 0
| 0
| 0
| 0
| 0.126984
| 0.126984
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
aacc9a8164a12ea2966b969158f1d7412a886fa8
| 198
|
py
|
Python
|
test/tests/test_benchmark.py
|
HansBug/treevalue
|
6f2f5b2de00b04a06201a87ccee678ade9deff57
|
[
"Apache-2.0"
] | null | null | null |
test/tests/test_benchmark.py
|
HansBug/treevalue
|
6f2f5b2de00b04a06201a87ccee678ade9deff57
|
[
"Apache-2.0"
] | 1
|
2021-07-24T13:30:14.000Z
|
2021-07-24T13:30:14.000Z
|
test/tests/test_benchmark.py
|
HansBug/treevalue
|
6f2f5b2de00b04a06201a87ccee678ade9deff57
|
[
"Apache-2.0"
] | null | null | null |
import pytest
@pytest.mark.benchmark(group="system")
class TestSystemBenchmark:
def test_empty_func(self, benchmark):
def empty_func():
pass
benchmark(empty_func)
| 18
| 41
| 0.671717
| 22
| 198
| 5.863636
| 0.636364
| 0.209302
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.237374
| 198
| 10
| 42
| 19.8
| 0.854305
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.142857
| 0.142857
| 0
| 0.571429
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
aacd74fbc2b251418bfb9c8cb6d120676ed468c4
| 310
|
py
|
Python
|
yt/recipe/relativeworkaround_tests.py
|
toumorokoshi/yt.recipe.relativeworkaround
|
f5f68e129f6e02bb3eb4c9ea4960fc4ee982dde4
|
[
"MIT"
] | null | null | null |
yt/recipe/relativeworkaround_tests.py
|
toumorokoshi/yt.recipe.relativeworkaround
|
f5f68e129f6e02bb3eb4c9ea4960fc4ee982dde4
|
[
"MIT"
] | null | null | null |
yt/recipe/relativeworkaround_tests.py
|
toumorokoshi/yt.recipe.relativeworkaround
|
f5f68e129f6e02bb3eb4c9ea4960fc4ee982dde4
|
[
"MIT"
] | null | null | null |
import unittest
import zc.buildout.testing
class TestShellBuildout(unittest.TestCase):
def setUp(self):
zc.buildout.testing.buildoutSetup(self)
zc.buildout.install.develop('yt.recipe.relativeworkaround', self)
def tearDown(self):
zc.buildout.testing.buildoutTearDown(self)
| 22.142857
| 73
| 0.732258
| 34
| 310
| 6.676471
| 0.558824
| 0.176211
| 0.22467
| 0.185022
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164516
| 310
| 13
| 74
| 23.846154
| 0.876448
| 0
| 0
| 0
| 0
| 0
| 0.090323
| 0.090323
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
2a9a7185f9e00cdc9280d8ba31988cc9b01f7e93
| 462
|
py
|
Python
|
xmarievm/runtime/streams/input_stream.py
|
eryktr/xmarie-vm
|
736b7fa0ad04322b37938027c63859aee888fbbb
|
[
"MIT"
] | null | null | null |
xmarievm/runtime/streams/input_stream.py
|
eryktr/xmarie-vm
|
736b7fa0ad04322b37938027c63859aee888fbbb
|
[
"MIT"
] | null | null | null |
xmarievm/runtime/streams/input_stream.py
|
eryktr/xmarie-vm
|
736b7fa0ad04322b37938027c63859aee888fbbb
|
[
"MIT"
] | null | null | null |
import abc
from typing import Generator
class InputStream(abc.ABC):
@abc.abstractmethod
def read(self) -> str:
pass
class StandardInputStream(InputStream):
def read(self) -> str:
return input()
class BufferedInputStream(InputStream):
stream: Generator[str, None, None]
def __init__(self, txt: str):
self.stream = (l for l in txt.strip().split('\n'))
def read(self) -> str:
return next(self.stream)
| 19.25
| 58
| 0.645022
| 57
| 462
| 5.157895
| 0.491228
| 0.071429
| 0.112245
| 0.142857
| 0.136054
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.235931
| 462
| 23
| 59
| 20.086957
| 0.832861
| 0
| 0
| 0.2
| 0
| 0
| 0.004329
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.266667
| false
| 0.066667
| 0.133333
| 0.133333
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
2a9b9cb685181f3432eff1f05195707b06a99db1
| 95
|
py
|
Python
|
InventoryManager/withdrawal/apps.py
|
FuryAndRage/InventoryManager
|
bbb7318dae6bf40da81ed02a0f547019f031778f
|
[
"MIT"
] | null | null | null |
InventoryManager/withdrawal/apps.py
|
FuryAndRage/InventoryManager
|
bbb7318dae6bf40da81ed02a0f547019f031778f
|
[
"MIT"
] | null | null | null |
InventoryManager/withdrawal/apps.py
|
FuryAndRage/InventoryManager
|
bbb7318dae6bf40da81ed02a0f547019f031778f
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class WithdrawalConfig(AppConfig):
name = 'withdrawal'
| 15.833333
| 34
| 0.768421
| 10
| 95
| 7.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 95
| 5
| 35
| 19
| 0.9125
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2abd4ccf85597a825f81333bfb630272a9881a90
| 1,562
|
py
|
Python
|
speedometer/Observer.py
|
15minutOdmora/Speedometer
|
546f9fcc9dfe70f9b05224bd233fa2f917ba3695
|
[
"MIT"
] | 5
|
2022-01-04T11:07:40.000Z
|
2022-02-18T09:45:11.000Z
|
speedometer/Observer.py
|
15minutOdmora/Speedometer
|
546f9fcc9dfe70f9b05224bd233fa2f917ba3695
|
[
"MIT"
] | null | null | null |
speedometer/Observer.py
|
15minutOdmora/Speedometer
|
546f9fcc9dfe70f9b05224bd233fa2f917ba3695
|
[
"MIT"
] | null | null | null |
from __future__ import annotations
from abc import ABC, abstractmethod
class Subject(ABC):
"""
Declares set of methods for managing subscribers
"""
@abstractmethod
def attach(self, observer: Observer) -> None:
"""
Attach an observer to the subject
"""
pass
@abstractmethod
def detach(self, observer: Observer) -> None:
"""
Detach observer from subject
"""
pass
@abstractmethod
def notify(self) -> None:
"""
Notify all observers, at beginning of video
"""
pass
class Observer(ABC):
"""
Observer interface declares the update method that gets called by subjects.
"""
@abstractmethod
def update(self) -> None:
"""
Receive update from subject
"""
pass
class Mediator(ABC):
"""
Mediator acts as an observer and a subject at the same time, hence the name.
Has same methods as both above classes.
"""
@abstractmethod
def attach(self, observer: Observer) -> None:
"""
Attach an observer to the subject
"""
pass
@abstractmethod
def detach(self, observer: Observer) -> None:
"""
Detach observer from subject
"""
pass
@abstractmethod
def notify(self) -> None:
"""
Notify all observers, at beginning of video
"""
pass
@abstractmethod
def update(self) -> None:
"""
Receive update from subject
"""
pass
| 20.285714
| 80
| 0.560819
| 156
| 1,562
| 5.589744
| 0.339744
| 0.155963
| 0.120413
| 0.110092
| 0.65367
| 0.65367
| 0.65367
| 0.65367
| 0.65367
| 0.65367
| 0
| 0
| 0.350832
| 1,562
| 77
| 81
| 20.285714
| 0.859961
| 0.327145
| 0
| 0.827586
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.275862
| false
| 0.275862
| 0.068966
| 0
| 0.448276
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
2ad740c1114cef9e8372196c42be6f9c3406e1e8
| 54
|
py
|
Python
|
gemini/metadata.py
|
PacketFire/geo
|
928e34dc4a466b269edcf2b062219c7c6b91f50c
|
[
"Apache-2.0"
] | null | null | null |
gemini/metadata.py
|
PacketFire/geo
|
928e34dc4a466b269edcf2b062219c7c6b91f50c
|
[
"Apache-2.0"
] | 52
|
2018-10-30T01:04:32.000Z
|
2021-05-06T08:02:42.000Z
|
gemini/metadata.py
|
PacketFire/geo
|
928e34dc4a466b269edcf2b062219c7c6b91f50c
|
[
"Apache-2.0"
] | 4
|
2018-10-30T15:40:14.000Z
|
2018-11-14T12:48:26.000Z
|
VERSION = "v0.0.1"
def version():
return VERSION
| 10.8
| 18
| 0.62963
| 8
| 54
| 4.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 0.222222
| 54
| 4
| 19
| 13.5
| 0.738095
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
2af77d5062f941d8ca2ed697812b454a66047d93
| 3,451
|
py
|
Python
|
models/Contrast.py
|
KuangHaofei/video-contrastive-learning
|
5b51507912a07e821e266da3a152de83177bab1d
|
[
"Apache-2.0"
] | null | null | null |
models/Contrast.py
|
KuangHaofei/video-contrastive-learning
|
5b51507912a07e821e266da3a152de83177bab1d
|
[
"Apache-2.0"
] | null | null | null |
models/Contrast.py
|
KuangHaofei/video-contrastive-learning
|
5b51507912a07e821e266da3a152de83177bab1d
|
[
"Apache-2.0"
] | null | null | null |
import torch
import torch.nn as nn
import math
class NCESoftmaxLoss(nn.Module):
"""Softmax cross-entropy loss (a.k.a., info-NCE loss in CPC paper)"""
def __init__(self):
super(NCESoftmaxLoss, self).__init__()
self.criterion = nn.CrossEntropyLoss()
def forward(self, x):
label = torch.zeros([x.shape[0]]).long().to(x.device)
return self.criterion(x, label)
class MemorySeCo(nn.Module):
"""Fixed-size queue with momentum encoder"""
def __init__(self, feature_dim, queue_size, temperature=0.10, temperature_intra=0.10):
super(MemorySeCo, self).__init__()
self.queue_size = queue_size
self.temperature = temperature
self.temperature_intra = temperature_intra
self.index = 0
# noinspection PyCallingNonCallable
self.register_buffer('params', torch.tensor([-1]))
stdv = 1. / math.sqrt(feature_dim / 3)
memory = torch.rand(self.queue_size, feature_dim, requires_grad=False).mul_(2 * stdv).add_(-stdv)
self.register_buffer('memory', memory)
def forward(self, q, k_sf, k_df1, k_df2, k_all, inter=True):
l_pos_sf = (q * k_sf.detach()).sum(dim=-1, keepdim=True) # shape: (batchSize, 1)
l_pos_df1 = (q * k_df1.detach()).sum(dim=-1, keepdim=True) # shape: (batchSize, 1)
l_pos_df2 = (q * k_df2.detach()).sum(dim=-1, keepdim=True) # shape: (batchSize, 1)
if inter:
l_neg = torch.mm(q, self.memory.clone().detach().t())
out = torch.cat((torch.cat((l_pos_sf, l_pos_df1, l_pos_df2), dim=0), l_neg.repeat(3, 1)), dim=1)
out = torch.div(out, self.temperature).contiguous()
with torch.no_grad():
all_size = k_all.shape[0]
out_ids = torch.fmod(torch.arange(all_size, dtype=torch.long).cuda() + self.index, self.queue_size)
self.memory.index_copy_(0, out_ids, k_all)
self.index = (self.index + all_size) % self.queue_size
else:
# out intra-frame similarity
out = torch.div(torch.cat((l_pos_sf.repeat(2, 1), torch.cat((l_pos_df1, l_pos_df2), dim=0)), dim=-1),
self.temperature_intra).contiguous()
return out
class MemoryVCLR(nn.Module):
"""Fixed-size queue with momentum encoder"""
def __init__(self, feature_dim, queue_size, temperature=0.10):
super(MemoryVCLR, self).__init__()
self.queue_size = queue_size
self.temperature = temperature
self.index = 0
# noinspection PyCallingNonCallable
self.register_buffer('params', torch.tensor([-1]))
stdv = 1. / math.sqrt(feature_dim / 3)
memory = torch.rand(self.queue_size, feature_dim, requires_grad=False).mul_(2 * stdv).add_(-stdv)
self.register_buffer('memory', memory)
def forward(self, q, k, k_all):
l_pos = (q * k.detach()).sum(dim=-1, keepdim=True) # shape: (batchSize, 1)
l_neg = torch.mm(q, self.memory.clone().detach().t())
out = torch.cat((l_pos, l_neg), dim=1)
out = torch.div(out, self.temperature).contiguous()
with torch.no_grad():
all_size = k_all.shape[0]
out_ids = torch.fmod(torch.arange(all_size, dtype=torch.long).cuda() + self.index, self.queue_size)
self.memory.index_copy_(0, out_ids, k_all)
self.index = (self.index + all_size) % self.queue_size
return out
| 42.604938
| 115
| 0.61982
| 482
| 3,451
| 4.213693
| 0.207469
| 0.053176
| 0.051206
| 0.025603
| 0.724766
| 0.71098
| 0.71098
| 0.71098
| 0.693255
| 0.674052
| 0
| 0.019392
| 0.237902
| 3,451
| 80
| 116
| 43.1375
| 0.752852
| 0.094176
| 0
| 0.508475
| 0
| 0
| 0.007732
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.101695
| false
| 0
| 0.050847
| 0
| 0.254237
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
630614b0c54e62e98fba20872493af53e942b0d6
| 187
|
py
|
Python
|
djexperience/product/views.py
|
rg3915/django-experience-2016
|
76adaa55c537f3b9fa48b601d4a97fd6e04371c0
|
[
"MIT"
] | 1
|
2022-01-01T22:19:49.000Z
|
2022-01-01T22:19:49.000Z
|
djexperience/product/views.py
|
rg3915/django-experience-2016
|
76adaa55c537f3b9fa48b601d4a97fd6e04371c0
|
[
"MIT"
] | null | null | null |
djexperience/product/views.py
|
rg3915/django-experience-2016
|
76adaa55c537f3b9fa48b601d4a97fd6e04371c0
|
[
"MIT"
] | null | null | null |
from django.views.generic import CreateView
from .models import Product
from .forms import ProductForm
class ProductCreate(CreateView):
model = Product
form_class = ProductForm
| 20.777778
| 43
| 0.791444
| 22
| 187
| 6.681818
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160428
| 187
| 8
| 44
| 23.375
| 0.936306
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2d568fb93a34d0e39f2fd50b9be834d03e6836ed
| 132
|
py
|
Python
|
todos/cli.py
|
e-k-m/todos
|
b017a74dd22e42beaf4838cfdb9ed14d349e41e9
|
[
"MIT"
] | null | null | null |
todos/cli.py
|
e-k-m/todos
|
b017a74dd22e42beaf4838cfdb9ed14d349e41e9
|
[
"MIT"
] | null | null | null |
todos/cli.py
|
e-k-m/todos
|
b017a74dd22e42beaf4838cfdb9ed14d349e41e9
|
[
"MIT"
] | null | null | null |
"""
FIXME
"""
import sys
from todos import todos
def main():
todos.main()
if __name__ == "__main__":
sys.exit(main())
| 8.25
| 26
| 0.598485
| 17
| 132
| 4.176471
| 0.588235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.234848
| 132
| 15
| 27
| 8.8
| 0.70297
| 0.037879
| 0
| 0
| 0
| 0
| 0.067227
| 0
| 0
| 0
| 0
| 0.066667
| 0
| 1
| 0.166667
| true
| 0
| 0.333333
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
2d81a8a6fa5c570f864dd21c57e2d26d6d70e668
| 284
|
py
|
Python
|
akeydo/plugins/gpu/drivers/nouveau.py
|
dangle/vfio-kvm
|
13ed6f6b2ebbc2e23afe267866e321a2fd51a337
|
[
"MIT"
] | 30
|
2021-01-15T18:22:26.000Z
|
2021-06-02T14:10:40.000Z
|
akeydo/plugins/gpu/drivers/nouveau.py
|
dangle/vfio-kvm
|
13ed6f6b2ebbc2e23afe267866e321a2fd51a337
|
[
"MIT"
] | 11
|
2021-01-23T05:37:06.000Z
|
2021-04-21T21:50:37.000Z
|
akeydo/plugins/gpu/drivers/nouveau.py
|
dangle/vfio-kvm
|
13ed6f6b2ebbc2e23afe267866e321a2fd51a337
|
[
"MIT"
] | null | null | null |
import logging
from .base import BaseDriver
class Driver(BaseDriver):
def bind_framebuffer(self):
logging.debug("nouveau driver does not rebind the framebuffer")
def unbind_framebuffer(self):
logging.debug("nouveau driver does not unbind the framebuffer")
| 23.666667
| 71
| 0.739437
| 35
| 284
| 5.942857
| 0.514286
| 0.144231
| 0.211538
| 0.259615
| 0.451923
| 0.451923
| 0.451923
| 0.451923
| 0
| 0
| 0
| 0
| 0.190141
| 284
| 11
| 72
| 25.818182
| 0.904348
| 0
| 0
| 0
| 0
| 0
| 0.323944
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.285714
| 0
| 0.714286
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
2d8e6387327b02974c4f4d8079841015224c1651
| 863
|
py
|
Python
|
waves_gateway/model/mapping_entry.py
|
NeolithEra/WavesGatewayFramework
|
e7ba892427e1d0444f2bfdc2922c45ff5f4c4add
|
[
"MIT"
] | 25
|
2018-03-04T07:49:21.000Z
|
2022-03-28T05:20:50.000Z
|
waves_gateway/model/mapping_entry.py
|
NeolithEra/WavesGatewayFramework
|
e7ba892427e1d0444f2bfdc2922c45ff5f4c4add
|
[
"MIT"
] | 22
|
2018-03-25T13:19:45.000Z
|
2020-11-28T17:21:08.000Z
|
waves_gateway/model/mapping_entry.py
|
NeolithEra/WavesGatewayFramework
|
e7ba892427e1d0444f2bfdc2922c45ff5f4c4add
|
[
"MIT"
] | 31
|
2018-03-25T09:45:13.000Z
|
2022-03-24T05:32:18.000Z
|
"""
MappingEntry
"""
class MappingEntry(object):
"""
Defines what will be saved in the MapStorage.
A MappingEntry represents a connection between a custom currency address and a Waves address.
"""
DICT_COIN_KEY = 'coin'
DICT_WAVES_KEY = 'waves'
def __init__(self, waves_address: str, coin_address: str) -> None:
self._waves_address = waves_address
self._coin_address = coin_address
@property
def waves_address(self) -> str:
return self._waves_address
@property
def coin_address(self) -> str:
return self._coin_address
def __str__(self):
return "Coin(" + str(self._coin_address) + ")" + " -> " + "Waves(" + str(self._waves_address) + ")"
def __eq__(self, other):
return self.waves_address == other.waves_address and self.coin_address == other.coin_address
| 26.96875
| 107
| 0.660487
| 106
| 863
| 5.018868
| 0.301887
| 0.203008
| 0.150376
| 0.075188
| 0.090226
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.23175
| 863
| 31
| 108
| 27.83871
| 0.802413
| 0.17613
| 0
| 0.125
| 0
| 0
| 0.038012
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3125
| false
| 0
| 0
| 0.25
| 0.75
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
2d901a1feff05dbd45396afe8ec74856dc71998b
| 30,061
|
py
|
Python
|
tests/test_views.py
|
ozgurgunes/django-manifest
|
6b0a16cae67fe7d874cfde82495e402e59b0c29d
|
[
"MIT"
] | null | null | null |
tests/test_views.py
|
ozgurgunes/django-manifest
|
6b0a16cae67fe7d874cfde82495e402e59b0c29d
|
[
"MIT"
] | null | null | null |
tests/test_views.py
|
ozgurgunes/django-manifest
|
6b0a16cae67fe7d874cfde82495e402e59b0c29d
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
""" Manifest View Tests
"""
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import (
PasswordChangeForm,
PasswordResetForm,
SetPasswordForm,
)
from django.core import mail
from django.test import override_settings
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from manifest import defaults, forms
from tests import data_dicts
from tests.base import (
TEMPFILE_MEDIA_ROOT,
ManifestTestCase,
ManifestUploadTestCase,
)
from tests.urls import TEST_REGISTER_FORM_CLASS, TEST_SUCCESS_URL
class AuthLoginViewTests(ManifestTestCase):
"""Tests for :class:`AuthLoginView <manifest.views.AuthLoginView>`.
"""
user_data = ["john", "pass"]
form_data = data_dicts.LOGIN_FORM["valid"][0]
def test_auth_login_view(self):
"""A ``GET`` to the view should render the correct form.
"""
response = self.client.get(reverse("auth_login"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_login.html")
def test_auth_login_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
response = self.client.post(reverse("auth_login"), data={})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_login.html")
self.assertEqual(
response.context["form"].errors["identification"][0],
_("Please enter your username or email address."),
)
def test_auth_login_inactive(self):
"""A ``POST`` with an inactive user should
redirect to ``auth_disabled``.
"""
user = get_user_model().objects.get(username=self.user_data[0])
user.is_active = False
user.save()
response = self.client.post(reverse("auth_login"), data=self.form_data)
self.assertRedirects(response, reverse("auth_disabled"))
def test_auth_login_success(self):
"""A ``POST`` with a valid form should redirect to
``profile_settings`` if no ``next`` is supplied.
Else, it should redirect to ``next``.
"""
response = self.client.post(reverse("auth_login"), data=self.form_data)
self.assertRedirects(response, defaults.MANIFEST_LOGIN_REDIRECT_URL)
# Redirect to ``next``.
response = self.client.post(
reverse("auth_login"), data={**self.form_data, "next": "/test/"}
)
self.assertRedirects(response, "/test/")
def test_auth_login_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
response = self.client.post(
reverse("test_auth_login_success_url"), data=self.form_data
)
self.assertRedirects(response, TEST_SUCCESS_URL)
class AuthLogoutViewTests(ManifestTestCase):
"""Tests for :class:`AuthLogoutView <manifest.views.AuthLogoutView>`.
"""
def test_auth_logout_view(self):
"""A ``GET`` to the view should render the correct template.
"""
response = self.client.get(reverse("auth_logout"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_logout.html")
class AuthRegisterViewTests(ManifestTestCase):
"""Tests for :class:`AuthRegisterView <manifest.views.AuthRegisterView>`.
"""
user_data = ["john", "pass"]
form_data = data_dicts.REGISTER_FORM["valid"][0]
def test_auth_register_view(self):
"""A ``GET`` to the view should render the correct form.
"""
response = self.client.get(reverse("auth_register"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_register.html")
self.assertTrue(
isinstance(response.context["form"], forms.RegisterForm)
)
def test_auth_register_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
response = self.client.post(reverse("auth_register"), data={})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_register.html")
self.assertEqual(
response.context["form"].errors["email"][0],
_("This field is required."),
)
def test_auth_register_authenticated(self):
"""Any ``REQUEST`` from an authenticated user should
redirect to ``profile_settings``.
"""
# Authenticate user
self.assertTrue(
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
)
# A ``GET`` from and authenticated user.
response = self.client.get(reverse("auth_register"))
self.assertRedirects(response, reverse("profile_settings"))
# A ``POST`` from and authenticated user.
response = self.client.post(
reverse("auth_register"), data=self.form_data
)
self.assertRedirects(response, reverse("profile_settings"))
def test_auth_register_success(self):
"""A ``POST`` with a valid form should create a new user acount
and redirect to ``auth_register_complete``.
"""
response = self.client.post(
reverse("auth_register"), data=self.form_data
)
# Check for redirect.
self.assertRedirects(response, reverse("auth_register_complete"))
# Check for new user.
self.assertEqual(
get_user_model().objects.filter(username="alice").count(), 1
)
def test_auth_register_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
response = self.client.post(
reverse("test_auth_register_success_url"), data=self.form_data
)
self.assertRedirects(response, TEST_SUCCESS_URL)
def test_auth_register_form_class(self):
"""A ``POST`` with a valid form should create a new user acount
and redirect to ``success_url``.
"""
response = self.client.get(reverse("test_auth_register_form_class"))
self.assertTrue(
isinstance(response.context["form"], TEST_REGISTER_FORM_CLASS)
)
class AuthActivateViewTests(ManifestTestCase):
"""Tests for :class:`AuthActivateView <manifest.views.AuthActivateView>`.
"""
user_data = ["alice", "wonderland"]
form_data = data_dicts.REGISTER_FORM["valid"][0]
def test_auth_activation_success(self):
"""A ``GET`` with a valid token should acticate the user
and redirect to ``profile_settings``.
"""
self.client.post(reverse("auth_register"), data=self.form_data)
user = get_user_model().objects.get(username=self.user_data[0])
response = self.client.get(
reverse(
"auth_activate",
kwargs={
"username": user.username,
"token": user.activation_key,
},
)
)
self.assertRedirects(response, reverse("profile_settings"))
user = get_user_model().objects.get(username=self.user_data[0])
self.assertTrue(user.is_active)
def test_auth_activation_invalid(self):
"""A ``GET`` with an invalid token should render the correct template.
"""
response = self.client.get(
reverse(
"auth_activate", kwargs={"username": "alice", "token": "fake"}
)
)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/auth_activate.html")
def test_auth_activate_success_url(self):
"""A ``GET`` with a valid token should redirect to ``success_url``.
"""
response = self.client.post(
reverse("auth_register"), data=self.form_data
)
user = get_user_model().objects.get(username=self.user_data[0])
response = self.client.get(
reverse(
"test_auth_activate_success_url",
kwargs={
"username": user.username,
"token": user.activation_key,
},
)
)
self.assertRedirects(response, TEST_SUCCESS_URL)
class PasswordResetTests(ManifestTestCase):
"""Tests for :class:`PasswordResetView
<manifest.views.PasswordResetView>`.
"""
def test_password_reset_view(self):
"""A ``GET`` to the view should render the correct form.
"""
response = self.client.get(reverse("password_reset"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/password_reset_form.html")
self.assertTrue(
isinstance(response.context["form"], PasswordResetForm)
)
def test_password_reset_success(self):
"""A ``POST`` with a valid email should send password reset mail.
"""
response = self.client.post(
reverse("password_reset"), data={"email": "john@example.com"}
)
self.assertRedirects(response, reverse("password_reset_done"))
self.assertEqual(len(mail.outbox), 1)
def test_password_reset_invalid(self):
"""A ``POST`` with an invalid email should render
the template with ``ValidationError``.
"""
response = self.client.post(
reverse("password_reset"), data={"email": "dummy"}
)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/password_reset_form.html")
self.assertEqual(
response.context["form"].errors["email"][0],
_("Enter a valid email address."),
)
def test_password_reset_fail(self):
"""A ``POST`` with a non-existed email should fail silently.
"""
response = self.client.post(
reverse("password_reset"), data={"email": "john@dummy.com"}
)
self.assertRedirects(response, reverse("password_reset_done"))
self.assertEqual(len(mail.outbox), 0)
class PasswordResetConfirmViewTests(ManifestTestCase):
"""Tests for :class:`PasswordResetConfirmView
<manifest.views.PasswordResetConfirmView>`.
"""
def test_password_reset_confirm_success(self):
"""A ``POST`` with a valid token should return success.
"""
response = self.client.post(
reverse("password_reset"), data={"email": "john@example.com"}
)
uid = response.context["uid"]
token = response.context["token"]
response = self.client.post(
reverse(
"password_reset_confirm",
kwargs={"uidb64": uid, "token": token},
)
)
self.assertEqual(response.status_code, 302)
response = self.client.get(
reverse(
"password_reset_confirm",
kwargs={"uidb64": uid, "token": "set-password"},
)
)
self.assertTrue(isinstance(response.context["form"], SetPasswordForm))
response = self.client.post(
reverse(
"password_reset_confirm",
kwargs={"uidb64": uid, "token": "set-password"},
),
data={
"old_password": "pass",
"new_password1": "new_pass",
"new_password2": "new_pass",
},
)
self.assertRedirects(response, reverse("password_reset_complete"))
def test_password_reset_confirm_invalid(self):
"""A ``POST`` with an invalid token should render
the template with ``ValidationError``.
"""
response = self.client.post(
reverse("password_reset"), data={"email": "john@example.com"}
)
uid = response.context["uid"]
token = response.context["token"]
response = self.client.post(
reverse(
"password_reset_confirm",
kwargs={"uidb64": "uidb64", "token": token},
)
)
self.assertEqual(response.status_code, 200)
self.assertFalse(response.context.get("form", None))
self.assertContains(response, "Something went wrong!")
response = self.client.post(
reverse(
"password_reset_confirm",
kwargs={"uidb64": uid, "token": "token"},
)
)
self.assertEqual(response.status_code, 200)
self.assertFalse(response.context.get("form", None))
self.assertContains(response, "Something went wrong!")
class AuthProfileViewTests(ManifestTestCase):
"""Tests for :class:`AuthProfileView <manifest.views.AuthProfileView>`.
"""
user_data = ["john", "pass"]
def test_auth_profile_view(self):
"""A ``GET`` to the view should render the correct template.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("user_profile"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/user_detail.html")
def test_profile_settings_view(self):
"""A ``GET`` to the view should render the correct template.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("profile_settings"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/profile_settings.html")
class ProfileUpdateViewTests(ManifestTestCase):
"""Tests for :class:`ProfileUpdateView
<manifest.views.ProfileUpdateView>`.
"""
user_data = ["john", "pass"]
form_data = data_dicts.PROFILE_UPDATE_FORM["valid"][0]
def test_profile_update_view(self):
"""A ``GET`` to the view should render the correct template.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("profile_update"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/profile_update.html")
self.assertTrue(response.context["form"], forms.ProfileUpdateForm)
def test_profile_update_success(self):
"""A ``POST`` with a valid form should save data
and redirect to ``profile_settings``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("profile_update"), data=self.form_data
)
# Check for redirect.
self.assertRedirects(response, reverse("profile_settings"))
# Check for saved data.
user = get_user_model().objects.get(username=self.user_data[0])
self.assertEqual(user.gender, "M")
def test_profile_update_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(reverse("profile_update"), data={})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/profile_update.html")
self.assertEqual(
response.context["form"].errors["first_name"][0],
_("This field is required."),
)
def test_profile_update_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("test_profile_update_success_url"), data=self.form_data
)
self.assertRedirects(response, TEST_SUCCESS_URL)
def test_region_update_view(self):
"""A ``GET`` to the view should render the correct template.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("region_update"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/region_update.html")
self.assertTrue(response.context["form"], forms.RegionUpdateForm)
def test_region_update_success(self):
"""A ``POST`` with a valid form should save data
and redirect to ``profile_settings``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("region_update"),
data=data_dicts.REGION_UPDATE_FORM["valid"][0],
)
# Check for redirect.
self.assertRedirects(response, reverse("profile_settings"))
# Check for saved data.
user = get_user_model().objects.get(username=self.user_data[0])
self.assertEqual(user.timezone, "Europe/Istanbul")
def test_region_update_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(reverse("region_update"), data={})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/region_update.html")
self.assertEqual(
response.context["form"].errors["timezone"][0],
_("This field is required."),
)
@override_settings(MEDIA_ROOT=TEMPFILE_MEDIA_ROOT)
class PictureUploadViewTests(ManifestUploadTestCase):
"""Tests for :class:`PictureUploadView <manifest.views.PictureUploadView>`.
"""
user_data = ["john", "pass"]
def test_picture_upload_view(self):
"""A ``GET`` to the view should render the correct template.
"""
response = self.client.get(reverse("picture_upload"))
# Anonymous user should not be able to view the profile pages.
self.assertEqual(response.status_code, 302)
# Authenticate user.
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("picture_upload"))
self.assertEqual(response.status_code, 200)
# Check that the correct form is used.
self.assertTrue(
isinstance(response.context["form"], forms.PictureUploadForm)
)
self.assertTemplateUsed(response, "manifest/picture_upload.html")
def test_picture_upload_success(self):
"""A ``POST`` with a valid form should update profile picture.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
# Post a valid form.
response = self.client.post(
reverse("picture_upload"), data={"picture": self.image_file}
)
self.assertRedirects(response, reverse("profile_settings"))
def test_picture_upload_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(reverse("picture_upload"), data={})
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.context["form"].errors["picture"][0],
_("This field is required."),
)
def test_picture_clear(self):
"""A ``POST`` with a ``picture-clear`` should
delete existing profile picture.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
self.client.post(
reverse("picture_upload"), data={"picture": self.image_file}
)
user = get_user_model().objects.get(username=self.user_data[0])
# Check for a profile picture exists.
self.assertTrue(user.picture)
response = self.client.post(
reverse("picture_upload"), data={"picture-clear": 1}
)
self.assertRedirects(response, reverse("profile_settings"))
user = get_user_model().objects.get(username=self.user_data[0])
# Check for profile picture deleted.
self.assertFalse(user.picture)
class EmailChangeViewTests(ManifestTestCase):
"""Tests for :class:`EmailChangeView <manifest.views.EmailChangeView>`.
"""
user_data = ["john", "pass"]
form_data = data_dicts.EMAIL_CHANGE_FORM["valid"][0]
def test_email_change_view(self):
"""A ``GET`` to the view should render the correct template.
"""
response = self.client.get(reverse("email_change"))
# Anonymous user should not be able to view the profile pages.
self.assertEqual(response.status_code, 302)
# Authenticate user.
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("email_change"))
self.assertEqual(response.status_code, 200)
# Check that the correct form is used.
self.assertTrue(
isinstance(response.context["form"], forms.EmailChangeForm)
)
self.assertTemplateUsed(response, "manifest/email_change.html")
def test_email_change_success(self):
"""A ``POST`` with a valid form should save new email
and redirect to ``email_change_done``.
"""
# Login
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("email_change"), data=self.form_data
)
self.assertRedirects(response, reverse("email_change_done"))
def test_email_change_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(reverse("email_change"), data={})
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.context["form"].errors["email"][0],
_("This field is required."),
)
def test_email_change_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
# Login
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("test_email_change_success_url"), data=self.form_data
)
self.assertRedirects(response, TEST_SUCCESS_URL)
class EmailChangeConfirmViewTests(ManifestTestCase):
"""Tests for :class:`EmailChangeConfirmView
<manifest.views.EmailChangeConfirmView>`.
"""
user_data = ["john", "pass"]
def test_valid_confirmation(self):
"""A ``GET`` with a valid token should change the email
and redirect to ``email_change_complete``.
"""
user = get_user_model().objects.get(username=self.user_data[0])
user.change_email("john.smith@example.com")
self.assertEqual(user.email_unconfirmed, "john.smith@example.com")
self.assertNotEqual(user.email, "john.smith@example.com")
response = self.client.get(
reverse(
"email_change_confirm",
kwargs={
"username": user.username,
"token": user.email_confirmation_key,
},
)
)
self.assertRedirects(response, reverse("email_change_complete"))
user = get_user_model().objects.get(username=self.user_data[0])
# Check for email changed.
self.assertEqual(user.email, "john.smith@example.com")
def test_invalid_confirmation(self):
"""A ``GET`` with an invalid token should render
the correct template with ``Error``.
"""
response = self.client.get(
reverse(
"email_change_confirm",
kwargs={"username": "john", "token": "WRONG"},
)
)
self.assertTemplateUsed(response, "manifest/email_change_confirm.html")
def test_email_change_confirm_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
user = get_user_model().objects.get(username=self.user_data[0])
user.change_email("john.smith@example.com")
response = self.client.get(
reverse(
"test_email_change_confirm_success_url",
kwargs={
"username": user.username,
"token": user.email_confirmation_key,
},
)
)
self.assertRedirects(response, TEST_SUCCESS_URL)
class PasswordChangeViewTests(ManifestTestCase):
"""Tests for :class:`PasswordChangeView
<manifest.views.PasswordChangeView>`.
"""
user_data = ["john", "pass"]
form_data = data_dicts.PASSWORD_CHANGE_FORM["valid"][0]
def test_password_change_view(self):
"""A ``GET`` to the view should render the correct form.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.get(reverse("password_change"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/password_change.html")
self.assertTrue(response.context["form"], PasswordChangeForm)
def test_password_change_success(self):
"""A ``POST`` with a valid form should change user password
and redirect to ``password_change_done``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("password_change"), data=self.form_data
)
self.assertRedirects(response, reverse("password_change_done"))
# Check that the new password is set.
john = get_user_model().objects.get(username=self.user_data[0])
self.assertTrue(john.check_password(self.form_data["new_password1"]))
def test_password_change_invalid(self):
"""A ``POST`` with an invalid form should render
the template with ``ValidationError``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("password_change"),
data={
"new_password1": "newpass1",
"new_password2": "newpass2",
"old_password": "pass",
},
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.context["form"].errors["new_password2"][0],
_("The two password fields didn’t match."),
)
def test_password_change_success_url(self):
"""A ``POST`` with a valid form should redirect to ``success_url``.
"""
self.client.login(
username=self.user_data[0], password=self.user_data[1]
)
response = self.client.post(
reverse("test_password_change_success_url"), data=self.form_data
)
self.assertRedirects(response, TEST_SUCCESS_URL)
class UserListViewTests(ManifestTestCase):
"""Tests for :class:`UserListView <manifest.views.UserListView>`.
"""
def test_user_list_view(self):
"""A ``GET`` to the view should return list of users if
``MANIFEST_DISABLE_PROFILE_LIST`` setting is ``False`` (default).
"""
with self.defaults(MANIFEST_DISABLE_PROFILE_LIST=False):
response = self.client.get(reverse("user_list"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/user_list.html")
response = self.client.get(
reverse("user_list_paginated", kwargs={"page": 1})
)
self.assertEqual(response.status_code, 200)
response = self.client.get(
reverse("user_list_paginated", kwargs={"page": 2})
)
self.assertEqual(response.status_code, 200)
def test_user_list_disabled(self):
"""A ``GET`` to the view should return ``404`` if
``MANIFEST_DISABLE_PROFILE_LIST`` setting is ``True``.
"""
with self.defaults(MANIFEST_DISABLE_PROFILE_LIST=True):
response = self.client.get(reverse("user_list"))
self.assertEqual(response.status_code, 404)
class UserDetailViewTests(ManifestTestCase):
"""Tests for :class:`UserDetailView <manifest.views.UserDetailView>`.
"""
def test_user_detail_view(self):
"""A ``GET`` to the view should render the correct template.
"""
with self.defaults(MANIFEST_DISABLE_PROFILE_LIST=False):
response = self.client.get(
reverse("user_detail", kwargs={"username": "john"})
)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "manifest/user_detail.html")
def test_user_detail_disabled(self):
"""A ``GET`` to the view should return ``404`` if
``MANIFEST_DISABLE_PROFILE_LIST`` setting is ``True``.
"""
with self.defaults(MANIFEST_DISABLE_PROFILE_LIST=True):
response = self.client.get(
reverse("user_detail", kwargs={"username": "john"})
)
self.assertEqual(response.status_code, 404)
| 37.529338
| 79
| 0.61821
| 3,260
| 30,061
| 5.525153
| 0.07362
| 0.047191
| 0.060959
| 0.040806
| 0.77887
| 0.752276
| 0.712025
| 0.681657
| 0.645903
| 0.629913
| 0
| 0.008857
| 0.260071
| 30,061
| 800
| 80
| 37.57625
| 0.800926
| 0.188583
| 0
| 0.481905
| 0
| 0
| 0.126825
| 0.045867
| 0
| 0
| 0
| 0
| 0.207619
| 1
| 0.093333
| false
| 0.158095
| 0.019048
| 0
| 0.167619
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
2da73253a6bc4c7e273ffb550569408b1521d1c6
| 138
|
py
|
Python
|
VerifyOS/Windows/WindowsApp.py
|
hbisneto/Python
|
fbbd11b2725cd8b866c267a99b1d7566b444fc38
|
[
"MIT"
] | 6
|
2019-12-08T03:37:33.000Z
|
2021-11-28T14:30:11.000Z
|
VerifyOS/Windows/WindowsApp.py
|
hbisneto/Python
|
fbbd11b2725cd8b866c267a99b1d7566b444fc38
|
[
"MIT"
] | null | null | null |
VerifyOS/Windows/WindowsApp.py
|
hbisneto/Python
|
fbbd11b2725cd8b866c267a99b1d7566b444fc38
|
[
"MIT"
] | 1
|
2020-11-27T17:33:10.000Z
|
2020-11-27T17:33:10.000Z
|
# Main App
def MyFunc():
print()
print('='*80)
print(f'[VerifyOS for Windows] - Em execução...')
print('='*80)
MyFunc()
| 13.8
| 53
| 0.543478
| 17
| 138
| 4.411765
| 0.705882
| 0.186667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038095
| 0.23913
| 138
| 9
| 54
| 15.333333
| 0.67619
| 0.057971
| 0
| 0.333333
| 0
| 0
| 0.320313
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| true
| 0
| 0
| 0
| 0.166667
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
2db63df71b4d83806d73ca5a93d3968262b774de
| 628
|
py
|
Python
|
testcube/core/models/issue.py
|
tobyqin/testcube
|
0a3e9a4ad61bd97ae46f878e188936f4725e1e49
|
[
"MIT"
] | 28
|
2017-06-28T08:39:01.000Z
|
2022-01-24T11:47:41.000Z
|
testcube/core/models/issue.py
|
gunesmes/testcube
|
008740c278ad82e8b33cad7c069e3e8e086b389c
|
[
"MIT"
] | 60
|
2017-06-06T04:06:46.000Z
|
2019-06-21T08:53:14.000Z
|
testcube/core/models/issue.py
|
gunesmes/testcube
|
008740c278ad82e8b33cad7c069e3e8e086b389c
|
[
"MIT"
] | 10
|
2017-06-06T02:14:08.000Z
|
2022-02-07T14:43:28.000Z
|
from django.db import models
class Issue(models.Model):
name = models.CharField(max_length=100) # issue id in system, e.g. ECS-1234
summary = models.CharField(max_length=500)
created_by = models.CharField(max_length=50, blank=True)
assigned_to = models.CharField(max_length=50, blank=True)
created_on = models.DateTimeField(blank=True, null=True)
status = models.CharField(max_length=50, blank=True)
link = models.CharField(max_length=300, blank=True)
is_synced = models.BooleanField(default=False)
class Meta:
ordering = ['name']
def __str__(self):
return self.name
| 33.052632
| 80
| 0.710191
| 87
| 628
| 4.965517
| 0.528736
| 0.208333
| 0.25
| 0.333333
| 0.243056
| 0.243056
| 0.243056
| 0
| 0
| 0
| 0
| 0.036822
| 0.178344
| 628
| 18
| 81
| 34.888889
| 0.800388
| 0.052548
| 0
| 0
| 0
| 0
| 0.006745
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.071429
| false
| 0
| 0.071429
| 0.071429
| 0.928571
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
2db8445ff9860ac315fc6b7bc03694f7885820c6
| 105
|
py
|
Python
|
publish.py
|
thecheebo/CS498IoT_Final_Project
|
88db782ae3ac8229d1413e01849b721b712d15e3
|
[
"MIT"
] | 3
|
2021-09-01T19:15:06.000Z
|
2021-09-01T23:58:46.000Z
|
publish.py
|
thecheebo/Smart-Cat-Feeder
|
88db782ae3ac8229d1413e01849b721b712d15e3
|
[
"MIT"
] | null | null | null |
publish.py
|
thecheebo/Smart-Cat-Feeder
|
88db782ae3ac8229d1413e01849b721b712d15e3
|
[
"MIT"
] | null | null | null |
import motion as motion
motion.detect()
#publish.single("Food", "hungry", hostname = "192.168.0.53")
| 13.125
| 60
| 0.685714
| 15
| 105
| 4.8
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098901
| 0.133333
| 105
| 7
| 61
| 15
| 0.692308
| 0.561905
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
2dd7bbd34da7242bcd067db431348f356a1016ab
| 213
|
py
|
Python
|
pymatgen/apps/borg/__init__.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 1
|
2021-11-02T21:10:11.000Z
|
2021-11-02T21:10:11.000Z
|
pymatgen/apps/borg/__init__.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 5
|
2018-08-07T23:00:23.000Z
|
2021-01-05T22:46:23.000Z
|
pymatgen/apps/borg/__init__.py
|
exenGT/pymatgen
|
a8ffb820ab8fc3f60251099e38c8888f45eae618
|
[
"MIT"
] | 6
|
2019-04-26T18:50:41.000Z
|
2020-03-29T17:58:34.000Z
|
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
The borg package contains modules that assimilate large quantities of data into
pymatgen objects for analysis.
"""
| 26.625
| 79
| 0.779343
| 29
| 213
| 5.724138
| 0.862069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159624
| 213
| 7
| 80
| 30.428571
| 0.927374
| 0.938967
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
2de8a517534c6aa8756f50eb7945318e98b41e44
| 665
|
py
|
Python
|
lib/exabgp/bgp/message/update/nlri/evpn/__init__.py
|
cloudscale-ch/exabgp
|
55ee496dfbc3fce75c5107fae7a7d38567154d46
|
[
"BSD-3-Clause"
] | 1,560
|
2015-01-01T08:53:05.000Z
|
2022-03-29T20:22:43.000Z
|
lib/exabgp/bgp/message/update/nlri/evpn/__init__.py
|
nembery/exabgp
|
53cfff843ddde33bf1c437a1c4ce99de20c6bade
|
[
"BSD-3-Clause"
] | 818
|
2015-01-01T17:38:40.000Z
|
2022-03-30T07:29:24.000Z
|
lib/exabgp/bgp/message/update/nlri/evpn/__init__.py
|
nembery/exabgp
|
53cfff843ddde33bf1c437a1c4ce99de20c6bade
|
[
"BSD-3-Clause"
] | 439
|
2015-01-06T21:20:41.000Z
|
2022-03-19T23:24:25.000Z
|
"""
evpn/__init__.py
Created by Thomas Mangin on 2014-06-27.
Copyright (c) 2014-2017 Orange. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
# Every EVPN should be imported from this file
# as it makes sure that all the registering decorator are run
from exabgp.bgp.message.update.nlri.evpn.nlri import EVPN
from exabgp.bgp.message.update.nlri.evpn.ethernetad import EthernetAD
from exabgp.bgp.message.update.nlri.evpn.mac import MAC
from exabgp.bgp.message.update.nlri.evpn.multicast import Multicast
from exabgp.bgp.message.update.nlri.evpn.segment import EthernetSegment
from exabgp.bgp.message.update.nlri.evpn.prefix import Prefix
| 35
| 71
| 0.803008
| 106
| 665
| 5
| 0.490566
| 0.113208
| 0.14717
| 0.226415
| 0.384906
| 0.384906
| 0.384906
| 0
| 0
| 0
| 0
| 0.028668
| 0.108271
| 665
| 18
| 72
| 36.944444
| 0.865093
| 0.396992
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2defa7f9d6d61b3f10c9c48c72aa0b59002bdbf7
| 140
|
py
|
Python
|
ctrlutils/__init__.py
|
tmigimatsu/control-utils
|
f0f8a50e6aa2e53593eeffee094519fbc8b70b5c
|
[
"MIT"
] | null | null | null |
ctrlutils/__init__.py
|
tmigimatsu/control-utils
|
f0f8a50e6aa2e53593eeffee094519fbc8b70b5c
|
[
"MIT"
] | null | null | null |
ctrlutils/__init__.py
|
tmigimatsu/control-utils
|
f0f8a50e6aa2e53593eeffee094519fbc8b70b5c
|
[
"MIT"
] | null | null | null |
from .timer import Timer
from .redis import RedisClient, decode_matlab
from .ctrlutils import *
from . import eigen
__version__ = "1.4.1"
| 17.5
| 45
| 0.764286
| 20
| 140
| 5.1
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025424
| 0.157143
| 140
| 7
| 46
| 20
| 0.838983
| 0
| 0
| 0
| 0
| 0
| 0.035714
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
2df5c85b12288ef43e549aba37c7a9710e0dad09
| 108
|
py
|
Python
|
Aplicacao/teste.py
|
JuniorB5/App-desktop-caderno-de-contas
|
7f57656012e70a8641945d9b4caeb81adf6d25b2
|
[
"MIT"
] | null | null | null |
Aplicacao/teste.py
|
JuniorB5/App-desktop-caderno-de-contas
|
7f57656012e70a8641945d9b4caeb81adf6d25b2
|
[
"MIT"
] | null | null | null |
Aplicacao/teste.py
|
JuniorB5/App-desktop-caderno-de-contas
|
7f57656012e70a8641945d9b4caeb81adf6d25b2
|
[
"MIT"
] | null | null | null |
import os
diretorio_atual = os.getcwd()
print(os.path.join(diretorio_atual, 'img\cliente_cadastro.png'))
| 15.428571
| 64
| 0.768519
| 16
| 108
| 5
| 0.75
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092593
| 108
| 6
| 65
| 18
| 0.816327
| 0
| 0
| 0
| 0
| 0
| 0.224299
| 0.224299
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
930a08d7429bd894bc291515af09504a9eb75310
| 2,895
|
py
|
Python
|
diffusion/sampling.py
|
Hrumka7/v-diffusion-jax
|
883247bab45d28c54ac1461ff72fb6070fb366c5
|
[
"MIT"
] | 99
|
2021-11-08T23:32:13.000Z
|
2022-03-26T09:38:38.000Z
|
diffusion/sampling.py
|
Hrumka7/v-diffusion-jax
|
883247bab45d28c54ac1461ff72fb6070fb366c5
|
[
"MIT"
] | 1
|
2021-11-22T18:51:32.000Z
|
2021-11-26T20:48:25.000Z
|
diffusion/sampling.py
|
Hrumka7/v-diffusion-jax
|
883247bab45d28c54ac1461ff72fb6070fb366c5
|
[
"MIT"
] | 10
|
2021-11-09T01:09:01.000Z
|
2022-03-28T03:42:37.000Z
|
from einops import repeat
import jax
import jax.numpy as jnp
from tqdm import trange
from . import utils
def sample_step(model, params, key, x, t, t_next, eta, extra_args):
dummy_key = jax.random.PRNGKey(0)
v = model.apply(params, dummy_key, x, repeat(t, '-> n', n=x.shape[0]), extra_args)
alpha, sigma = utils.t_to_alpha_sigma(t)
key, subkey = jax.random.split(key)
pred = x * alpha - v * sigma
eps = x * sigma + v * alpha
alpha_next, sigma_next = utils.t_to_alpha_sigma(t_next)
ddim_sigma = eta * jnp.sqrt(sigma_next**2 / sigma**2) * \
jnp.sqrt(1 - alpha**2 / alpha_next**2)
adjusted_sigma = jnp.sqrt(sigma_next**2 - ddim_sigma**2)
x = pred * alpha_next + eps * adjusted_sigma
x = x + jax.random.normal(key, x.shape) * ddim_sigma
return x, pred
jit_sample_step = jax.jit(sample_step, static_argnums=0)
def cond_sample_step(model, params, key, x, t, t_next, eta, extra_args, cond_fn, cond_params):
dummy_key = jax.random.PRNGKey(0)
v = model.apply(params, dummy_key, x, repeat(t, '-> n', n=x.shape[0]), extra_args)
alpha, sigma = utils.t_to_alpha_sigma(t)
key, subkey = jax.random.split(key)
cond_grad = cond_fn(x, subkey, t, extra_args, **cond_params)
v = v - cond_grad * (sigma / alpha)
pred = x * alpha - v * sigma
eps = x * sigma + v * alpha
alpha_next, sigma_next = utils.t_to_alpha_sigma(t_next)
ddim_sigma = eta * jnp.sqrt(sigma_next**2 / sigma**2) * \
jnp.sqrt(1 - alpha**2 / alpha_next**2)
adjusted_sigma = jnp.sqrt(sigma_next**2 - ddim_sigma**2)
x = pred * alpha_next + eps * adjusted_sigma
x = x + jax.random.normal(key, x.shape) * ddim_sigma
return x, pred
jit_cond_sample_step = jax.jit(cond_sample_step, static_argnums=(0, 8))
def sample_loop(model, params, key, x, steps, eta, sample_step):
for i in trange(len(steps)):
key, subkey = jax.random.split(key)
if i < len(steps) - 1:
x, _ = sample_step(model, params, subkey, x, steps[i], steps[i + 1], eta)
else:
_, pred = sample_step(model, params, subkey, x, steps[i], steps[i], eta)
return pred
def reverse_sample_step(model, params, key, x, t, t_next, extra_args):
dummy_key = jax.random.PRNGKey(0)
v = model.apply(params, dummy_key, x, repeat(t, '-> n', n=x.shape[0]), extra_args)
alpha, sigma = utils.t_to_alpha_sigma(t)
pred = x * alpha - v * sigma
eps = x * sigma + v * alpha
alpha_next, sigma_next = utils.t_to_alpha_sigma(t_next)
x = pred * alpha_next + eps * sigma_next
return x, pred
jit_reverse_sample_step = jax.jit(reverse_sample_step, static_argnums=0)
def reverse_sample_loop(model, params, key, x, steps, sample_step):
for i in trange(len(steps) - 1):
key, subkey = jax.random.split(key)
x, _ = sample_step(model, params, subkey, x, steps[i], steps[i + 1])
return x
| 37.115385
| 94
| 0.651813
| 479
| 2,895
| 3.728601
| 0.127349
| 0.078387
| 0.050392
| 0.070549
| 0.81523
| 0.792273
| 0.732923
| 0.699328
| 0.665733
| 0.648376
| 0
| 0.012286
| 0.212781
| 2,895
| 77
| 95
| 37.597403
| 0.771391
| 0
| 0
| 0.583333
| 0
| 0
| 0.004145
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.083333
| false
| 0
| 0.083333
| 0
| 0.25
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
931090199f95410bca1a13fa872fb7bf5cc78dae
| 191,227
|
py
|
Python
|
api/api_autogen/output_export.py
|
bje-/SAM
|
a52536b211c90a8e5fb15e4998212f313abcbfbe
|
[
"BSD-3-Clause"
] | 219
|
2017-07-28T17:25:14.000Z
|
2022-03-17T23:03:17.000Z
|
api/api_autogen/output_export.py
|
bje-/SAM
|
a52536b211c90a8e5fb15e4998212f313abcbfbe
|
[
"BSD-3-Clause"
] | 729
|
2017-08-10T14:42:30.000Z
|
2022-03-31T23:14:09.000Z
|
api/api_autogen/output_export.py
|
bje-/SAM
|
a52536b211c90a8e5fb15e4998212f313abcbfbe
|
[
"BSD-3-Clause"
] | 109
|
2017-09-16T00:52:54.000Z
|
2022-03-31T18:05:05.000Z
|
"""
File generated by export_config.cpp. Do not edit directly.
Exports maps for:
config_to_input_pages
config_to_modules
config_to_eqn_variables
config_to_cb_cmods
SSC Version: 205
Date: Sat Feb 23 13:57:48 2019
"""
# List of Variables that are used in equations #
ui_form_to_eqn_var_map = {
'Electric Building Load Calculator': {
('load_1', 'load_2', 'load_3', 'load_4', 'load_5', 'load_6', 'load_7', 'load_8', 'load_9', 'load_10', 'load_11', 'load_12'):
('Monthly_util', 'monthly_load'),
('load_model'):
('en_belpe'),
('escal_input_belpe'):
('escal_belpe') },
'Thermal Load': {
('thermal_load_user_data', 'normalize_to_thermal_bill', 'thermal_bill_data', 'thermal_scale_factor'):
('thermal_1', 'thermal_peak_1', 'thermal_2', 'thermal_peak_2', 'thermal_3', 'thermal_peak_3', 'thermal_4', 'thermal_peak_4', 'thermal_5', 'thermal_peak_5', 'thermal_6', 'thermal_peak_6', 'thermal_7', 'thermal_peak_7', 'thermal_8', 'thermal_peak_8', 'thermal_9', 'thermal_peak_9', 'thermal_10', 'thermal_peak_10', 'thermal_11', 'thermal_peak_11', 'thermal_12', 'thermal_peak_12', 'thermal_load', 'thermal_load_annual_total', 'thermal_annual_peak') },
'ISCC Parasitics': {
():
('bop_array'),
('bop_par', 'bop_par_f', 'bop_par_0', 'bop_par_1', 'bop_par_2', 'W_dot_solar_des'):
('csp.pt.par.calc.bop'),
('pb_fixed_par', 'fossil_output', 'W_dot_solar_des'):
('pb_fixed_par_mwe') },
'ISCC Receiver and Powerblock': {
('ngcc_model', 'q_pb_design', 'pinch_point_coldside', 'pinch_point_hotside', 'elev', 'rec_htf', 'field_fl_props'):
('W_dot_solar_des', 'T_htf_cold_des', 'fossil_output', 'max_solar_design', 'T_steam_sh_out_des'),
():
('ngcc_model'),
('nameplate'):
('system_capacity'),
('T_steam_sh_out_des', 'pinch_point_hotside'):
('T_htf_hot_des'),
('W_dot_solar_des'):
('nameplate') },
'PV Losses': {
('subarray3_soiling'):
('subarray3_soiling_annual_average'),
('subarray2_soiling'):
('subarray2_soiling_annual_average'),
('subarray4_mismatch_loss', 'subarray4_diodeconn_loss', 'subarray4_dcwiring_loss', 'subarray4_tracking_loss', 'subarray4_nameplate_loss', 'dcoptimizer_loss'):
('subarray4_dcloss'),
('subarray1_soiling'):
('subarray1_soiling_annual_average'),
('subarray4_soiling'):
('subarray4_soiling_annual_average'),
('subarray3_mismatch_loss', 'subarray3_diodeconn_loss', 'subarray3_dcwiring_loss', 'subarray3_tracking_loss', 'subarray3_nameplate_loss', 'dcoptimizer_loss'):
('subarray3_dcloss'),
('subarray2_mismatch_loss', 'subarray2_diodeconn_loss', 'subarray2_dcwiring_loss', 'subarray2_tracking_loss', 'subarray2_nameplate_loss', 'dcoptimizer_loss'):
('subarray2_dcloss'),
('subarray1_mismatch_loss', 'subarray1_diodeconn_loss', 'subarray1_dcwiring_loss', 'subarray1_tracking_loss', 'subarray1_nameplate_loss', 'dcoptimizer_loss'):
('subarray1_dcloss') },
'Inverter CEC Coefficient Generator': {
('inv_cec_cg_vdco', 'inv_cec_cg_pdco', 'inv_cec_cg_psco', 'inv_cec_cg_paco', 'inv_cec_cg_c0', 'inv_cec_cg_c1', 'inv_cec_cg_c2', 'inv_cec_cg_c3'):
('inv_cec_cg_eff_cec', 'inv_cec_cg_eff_euro') },
'CEC Performance Model with User Entered Specifications': {
('6par_bvoc_units', '6par_bvoc_display', '6par_voc'):
('6par_bvoc'),
('6par_aisc_units', '6par_aisc_display', '6par_isc'):
('6par_aisc'),
('6par_vmp', '6par_imp'):
('6par_pmp'),
('6par_vmp', '6par_imp', '6par_area'):
('6par_mpeff') },
'Simple Efficiency Module Model': {
('spe_reference', 'spe_eff0', 'spe_rad0', 'spe_eff1', 'spe_rad1', 'spe_eff2', 'spe_rad2', 'spe_eff3', 'spe_rad3', 'spe_eff4', 'spe_rad4', 'spe_area'):
('spe_power') },
'Financial Debt Residential': {
('real_discount_rate', 'inflation_rate', 'debt_fraction', 'federal_tax_rate', 'state_tax_rate', 'loan_rate'):
('ui_wacc'),
():
('market'),
('ui_net_capital_cost', 'debt_fraction'):
('loan_amount'),
('total_installed_cost', 'ibi_fed_amount', 'ibi_sta_amount', 'ibi_uti_amount', 'ibi_oth_amount', 'ibi_fed_percent', 'ibi_fed_percent_maxvalue', 'ibi_sta_percent', 'ibi_sta_percent_maxvalue', 'ibi_uti_percent', 'ibi_uti_percent_maxvalue', 'ibi_oth_percent', 'ibi_oth_percent_maxvalue', 'system_capacity', 'cbi_fed_amount', 'cbi_fed_maxvalue', 'cbi_sta_amount', 'cbi_sta_maxvalue', 'cbi_uti_amount', 'cbi_uti_maxvalue', 'cbi_oth_amount', 'cbi_oth_maxvalue'):
('ui_net_capital_cost') },
'Phys Trough Solar Field': {
('T_loop_out'):
('SF_COPY_T_loop_out_des'),
('specified_q_dot_rec_des'):
('SF_COPY_specified_q_dot_rec_des'),
('trough_loop_control'):
('SCAInfoArray'),
('fixed_land_area', 'non_solar_field_land_area_multiplier'):
('total_land_area'),
('q_pb_design', 'I_bn_des', 'total_loop_conversion_efficiency'):
('total_required_aperture_for_SM1'),
('nSCA', 'nLoops', 'SCA_drives_elec'):
('total_tracking_power'),
('total_aperture', 'Row_Distance', 'max_collector_width'):
('fixed_land_area'),
('combo_htf_type'):
('Fluid'),
('I_bn_des', 'total_loop_conversion_efficiency', 'total_aperture'):
('field_thermal_output'),
('trough_loop_control', 'csp_dtr_sca_calc_sca_eff_1', 'csp_dtr_sca_calc_sca_eff_2', 'csp_dtr_sca_calc_sca_eff_3', 'csp_dtr_sca_calc_sca_eff_4', 'csp_dtr_sca_length_1', 'csp_dtr_sca_length_2', 'csp_dtr_sca_length_3', 'csp_dtr_sca_length_4', 'csp_dtr_hce_optical_eff_1', 'csp_dtr_hce_optical_eff_2', 'csp_dtr_hce_optical_eff_3', 'csp_dtr_hce_optical_eff_4'):
('loop_optical_efficiency'),
('total_required_aperture_for_SM1', 'single_loop_aperature'):
('required_number_of_loops_for_SM1'),
('m_dot_htfmax', 'fluid_dens_outlet_temp', 'min_inner_diameter'):
('max_field_flow_velocity'),
('trough_loop_control'):
('SCADefocusArray'),
('T_loop_in_des'):
('SF_COPY_T_loop_in_des'),
('single_loop_aperature', 'nLoops'):
('total_aperture'),
('trough_loop_control', 'csp_dtr_hce_diam_absorber_inner_1', 'csp_dtr_hce_diam_absorber_inner_2', 'csp_dtr_hce_diam_absorber_inner_3', 'csp_dtr_hce_diam_absorber_inner_4'):
('min_inner_diameter'),
('I_bn_des'):
('SF_COPY_I_bn_des'),
('m_dot_htfmin', 'fluid_dens_inlet_temp', 'min_inner_diameter'):
('min_field_flow_velocity'),
('combo_FieldConfig'):
('FieldConfig'),
('specified_solar_multiple', 'total_required_aperture_for_SM1', 'single_loop_aperature'):
('nLoops'),
('trough_loop_control', 'I_bn_des', 'csp_dtr_hce_design_heat_loss_1', 'csp_dtr_hce_design_heat_loss_2', 'csp_dtr_hce_design_heat_loss_3', 'csp_dtr_hce_design_heat_loss_4', 'csp_dtr_sca_length_1', 'csp_dtr_sca_length_2', 'csp_dtr_sca_length_3', 'csp_dtr_sca_length_4', 'csp_dtr_sca_aperture_1', 'csp_dtr_sca_aperture_2', 'csp_dtr_sca_aperture_3', 'csp_dtr_sca_aperture_4'):
('cspdtr_loop_hce_heat_loss'),
('trough_loop_control', 'csp_dtr_sca_aperture_1', 'csp_dtr_sca_aperture_2', 'csp_dtr_sca_aperture_3', 'csp_dtr_sca_aperture_4'):
('single_loop_aperature'),
('specified_solar_multiple'):
('SF_COPY_specified_solar_multiple'),
('combo_htf_type', 'Fluid', 'T_loop_in_des', 'T_loop_out', 'field_fl_props'):
('field_htf_cp_avg'),
('field_thermal_output', 'q_pb_design'):
('solar_mult'),
('loop_optical_efficiency', 'cspdtr_loop_hce_heat_loss'):
('total_loop_conversion_efficiency'),
():
('defocus') },
'Phys Trough System Design': {
('field_thermal_output'):
('SD_COPY_field_thermal_output'),
('solar_mult'):
('SD_COPY_solar_mult'),
('specified_solar_multiple', 'q_pb_design'):
('specified_q_dot_rec_des'),
('nLoops'):
('SD_COPY_nLoops'),
('total_aperture'):
('SD_COPY_total_aperture'),
('specified_q_dot_rec_des'):
('system_capacity') },
'Financial Analysis Host Developer Parameters': {
('host_real_discount_rate', 'inflation_rate'):
('host_nominal_discount_rate'),
('real_discount_rate', 'inflation_rate'):
('nominal_discount_rate') },
'PV Capital Costs': {
('battery_energy', 'battery_per_kWh', 'battery_power', 'battery_per_kW'):
('battery_total'),
('en_batt', 'batt_power_discharge_max', 'batt_simple_enable', 'batt_simple_kw'):
('battery_power'),
('system_use_lifetime_output'):
('system_use_recapitalization'),
('module_total', 'inverter_total', 'battery_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total'):
('subtotal_direct'),
('total_installed_cost', 'modulearray_power'):
('installed_per_capacity'),
('inverter_costunits', 'inverter_num_units', 'inverter_power', 'module_num_units', 'module_power', 'per_inverter'):
('inverter_total'),
('bos_equip_fixed', 'modulearray_power', 'bos_equip_perwatt', 'modulearray_area', 'bos_equip_perarea'):
('bos_equip_total'),
('grid_percent', 'total_direct_cost', 'modulearray_power', 'grid_per_watt', 'grid_fixed'):
('grid_total'),
('install_labor_fixed', 'modulearray_power', 'install_labor_perwatt', 'modulearray_area', 'install_labor_perarea'):
('install_labor_total'),
('total_land_area'):
('modulearray_area'),
('inverter_power', 'inverter_num_units'):
('inverterarray_power'),
('inverter_count'):
('inverter_num_units'),
('landprep_per_acre', 'land_area_value', 'landprep_percent', 'total_direct_cost', 'modulearray_power', 'landprep_per_watt', 'landprep_fixed'):
('landprep_total'),
('total_modules'):
('module_num_units'),
('sales_tax_value', 'total_direct_cost', 'sales_tax_percent'):
('sales_tax_total'),
('land_per_acre', 'land_area_value', 'land_percent', 'total_direct_cost', 'modulearray_power', 'land_per_watt', 'land_fixed'):
('land_total'),
('permitting_total', 'engr_total', 'grid_total', 'land_total', 'landprep_total', 'sales_tax_total'):
('total_indirect_cost'),
('module_power', 'module_num_units'):
('modulearray_power'),
('install_margin_fixed', 'modulearray_power', 'install_margin_perwatt', 'modulearray_area', 'install_margin_perarea'):
('install_margin_total'),
('permitting_percent', 'total_direct_cost', 'modulearray_power', 'permitting_per_watt', 'permitting_fixed'):
('permitting_total'),
('system_capacity', 'dc_ac_ratio', 'inverter_model', 'inv_snl_paco', 'inv_ds_paco', 'inv_pd_paco', 'inv_cec_cg_paco'):
('inverter_power'),
('module_total', 'inverter_total', 'battery_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total', 'contingency'):
('total_direct_cost'),
('contingency_percent', 'module_total', 'inverter_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total', 'battery_total'):
('contingency'),
('en_batt', 'batt_computed_bank_capacity', 'batt_simple_enable', 'batt_simple_kwh'):
('battery_energy'),
('sales_tax_rate'):
('sales_tax_value'),
('system_capacity', 'module_model', 'spe_power', 'cec_p_mp_ref', '6par_pmp', 'snl_ref_pmp', 'sd11par_Pmp0'):
('module_power'),
('module_costunits', 'module_num_units', 'module_power', 'per_module'):
('module_total'),
('total_land_area'):
('land_area_value'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('engr_percent', 'total_direct_cost', 'modulearray_power', 'engr_per_watt', 'engr_fixed'):
('engr_total') },
'Thermal Rate': {
('thermal_buy_rate_option', 'thermal_buy_rate_flat', 'thermal_timestep_buy_rate', 'thermal_sell_rate_option', 'thermal_sell_rate_flat', 'thermal_timestep_sell_rate'):
('thermal_buy_rate', 'thermal_sell_rate') },
'Fuel Cell O and M Costs': {
('batt_computed_bank_capacity'):
('om_capacity1_nameplate'),
():
('add_om_num_types'),
('fuelcell_power_nameplate'):
('om_capacity2_nameplate'),
('fc_fuel_cost', 'om_fuel_price_units'):
('om_fuel_cost') },
'Fuel Cell Costs': {
('fuelcell_power_total', 'fuelcell_per_kW'):
('fuelcell_total'),
('battery_energy', 'battery_per_kWh', 'battery_power', 'battery_per_kW'):
('battery_total'),
('en_batt', 'batt_power_discharge_max', 'batt_simple_enable', 'batt_simple_kw'):
('battery_power'),
('system_use_lifetime_output'):
('system_use_recapitalization'),
('module_total', 'inverter_total', 'battery_total', 'fuelcell_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total'):
('subtotal_direct'),
('total_installed_cost', 'modulearray_power'):
('installed_per_capacity'),
('inverter_costunits', 'inverter_num_units', 'inverter_power', 'module_num_units', 'module_power', 'per_inverter'):
('inverter_total'),
('bos_equip_fixed', 'modulearray_power', 'bos_equip_perwatt', 'battery_power', 'bos_equip_battperkw', 'fuelcell_power_nameplate', 'bos_equip_fcperkw', 'modulearray_area', 'bos_equip_perarea'):
('bos_equip_total'),
('grid_percent', 'total_direct_cost', 'modulearray_power', 'grid_per_watt', 'battery_power', 'grid_per_battkw', 'fuelcell_power_nameplate', 'grid_per_fckw', 'grid_fixed'):
('grid_total'),
('install_labor_fixed', 'modulearray_power', 'install_labor_perwatt', 'battery_power', 'install_labor_battperkw', 'fuelcell_power_nameplate', 'install_labor_fcperkw', 'modulearray_area', 'install_labor_perarea'):
('install_labor_total'),
('total_land_area'):
('modulearray_area'),
('inverter_power', 'inverter_num_units'):
('inverterarray_power'),
('inverter_count'):
('inverter_num_units'),
('landprep_per_acre', 'land_area_value', 'landprep_percent', 'total_direct_cost', 'modulearray_power', 'landprep_per_watt', 'battery_power', 'landprep_per_battkw', 'fuelcell_power_nameplate', 'landprep_per_fckw', 'landprep_fixed'):
('landprep_total'),
('total_modules'):
('module_num_units'),
('sales_tax_value', 'total_direct_cost', 'sales_tax_percent'):
('sales_tax_total'),
('land_per_acre', 'land_area_value', 'land_percent', 'total_direct_cost', 'modulearray_power', 'land_per_watt', 'battery_power', 'land_per_battkw', 'fuelcell_power_nameplate', 'land_per_fckw', 'land_fixed'):
('land_total'),
('permitting_total', 'engr_total', 'grid_total', 'land_total', 'landprep_total', 'sales_tax_total'):
('total_indirect_cost'),
('module_power', 'module_num_units'):
('modulearray_power'),
('install_margin_fixed', 'modulearray_power', 'install_margin_perwatt', 'battery_power', 'install_margin_battperkw', 'fuelcell_power_nameplate', 'install_margin_fcperkw', 'modulearray_area', 'install_margin_perarea'):
('install_margin_total'),
('permitting_percent', 'total_direct_cost', 'modulearray_power', 'permitting_per_watt', 'battery_power', 'permitting_per_battkw', 'fuelcell_power_nameplate', 'permitting_per_fckw', 'permitting_fixed'):
('permitting_total'),
('system_capacity', 'dc_ac_ratio', 'inverter_model', 'inv_snl_paco', 'inv_ds_paco', 'inv_pd_paco', 'inv_cec_cg_paco'):
('inverter_power'),
('module_total', 'inverter_total', 'battery_total', 'fuelcell_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total', 'contingency'):
('total_direct_cost'),
('contingency_percent', 'module_total', 'inverter_total', 'bos_equip_total', 'install_labor_total', 'install_margin_total'):
('contingency'),
('fuelcell_power_nameplate'):
('fuelcell_power_total'),
('en_batt', 'batt_computed_bank_capacity', 'batt_simple_enable', 'batt_simple_kwh'):
('battery_energy'),
('sales_tax_rate'):
('sales_tax_value'),
('system_capacity', 'module_model', 'spe_power', 'cec_p_mp_ref', '6par_pmp', 'snl_ref_pmp', 'sd11par_Pmp0'):
('module_power'),
('module_costunits', 'module_num_units', 'module_power', 'per_module'):
('module_total'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('engr_percent', 'total_direct_cost', 'modulearray_power', 'engr_per_watt', 'battery_power', 'engr_per_battkw', 'fuelcell_power_nameplate', 'engr_per_fckw', 'engr_fixed'):
('engr_total') },
'Fuel Cell Dispatch Manual': {
('dispatch_manual_fuelcelldischarge', 'fc_discharge_units_1', 'fc_discharge_units_2', 'fc_discharge_units_3', 'fc_discharge_units_4', 'fc_discharge_units_5', 'fc_discharge_units_6'):
('dispatch_manual_units_fc_discharge'),
('dispatch_manual_fuelcelldischarge', 'fc_discharge_percent_1', 'fc_discharge_percent_2', 'fc_discharge_percent_3', 'fc_discharge_percent_4', 'fc_discharge_percent_5', 'fc_discharge_percent_6'):
('dispatch_manual_percent_fc_discharge'),
('dispatch_manual_gridcharge', 'batt_gridcharge_percent_1', 'batt_gridcharge_percent_2', 'batt_gridcharge_percent_3', 'batt_gridcharge_percent_4', 'batt_gridcharge_percent_5', 'batt_gridcharge_percent_6'):
('dispatch_manual_percent_gridcharge'),
('fc.storage.p1.charge', 'fc.storage.p2.charge', 'fc.storage.p3.charge', 'fc.storage.p4.charge', 'fc.storage.p5.charge', 'fc.storage.p6.charge'):
('dispatch_manual_fuelcellcharge'),
('dispatch_manual_discharge', 'batt_discharge_percent_1', 'batt_discharge_percent_2', 'batt_discharge_percent_3', 'batt_discharge_percent_4', 'batt_discharge_percent_5', 'batt_discharge_percent_6'):
('dispatch_manual_percent_discharge'),
('pv.storage.p1.gridcharge', 'pv.storage.p2.gridcharge', 'pv.storage.p3.gridcharge', 'pv.storage.p4.gridcharge', 'pv.storage.p5.gridcharge', 'pv.storage.p6.gridcharge'):
('dispatch_manual_gridcharge'),
('fc.p1.discharge', 'fc.p2.discharge', 'fc.p3.discharge', 'fc.p4.discharge', 'fc.p5.discharge', 'fc.p6.discharge'):
('dispatch_manual_fuelcelldischarge'),
('pv.storage.p1.discharge', 'pv.storage.p2.discharge', 'pv.storage.p3.discharge', 'pv.storage.p4.discharge', 'pv.storage.p5.discharge', 'pv.storage.p6.discharge'):
('dispatch_manual_discharge'),
('pv.storage.p1.charge', 'pv.storage.p2.charge', 'pv.storage.p3.charge', 'pv.storage.p4.charge', 'pv.storage.p5.charge', 'pv.storage.p6.charge'):
('dispatch_manual_charge') },
'Fuel Cell Dispatch': {
('fuelcell_dispatch_input', 'fuelcell_dispatch_input_units', 'fuelcell_unit_max_power'):
('fuelcell_dispatch') },
'PVWatts': {
('en_user_spec_losses', 'losses_user', 'loss_soiling', 'loss_shading', 'loss_snow', 'loss_mismatch', 'loss_wiring', 'loss_conn', 'loss_lid', 'loss_nameplate', 'loss_age', 'loss_avail'):
('losses'),
('system_capacity', 'dc_ac_ratio'):
('ac_nameplate') },
'Solar Water Heating': {
('draw', 'use_draw_scaling', 'daily_draw'):
('scaled_draw', 'annual_draw'),
('coll_mode', 'user_test_fluid', 'srcc_test_fluid'):
('test_fluid'),
('area_coll', 'ncoll', 'FRta', 'FRUL'):
('system_capacity'),
('coll_mode', 'user_FRUL', 'srcc_FRUL'):
('FRUL'),
('coll_mode', 'user_FRta', 'srcc_FRta'):
('FRta'),
('coll_mode', 'user_iam', 'srcc_iam'):
('iam'),
('coll_mode', 'user_area_coll', 'srcc_area'):
('area_coll'),
('coll_mode', 'user_test_flow', 'srcc_test_flow'):
('test_flow'),
('area_coll', 'ncoll'):
('total_area') },
'Geothermal Power Block': {
():
('HTF'),
():
('degradation'),
('analysis_period'):
('geothermal_analysis_period'),
('geopowerblock.pwrb.condenser_type'):
('CT'),
('design_temp'):
('T_htf_hot_ref') },
'Geothermal Plant and Equipment': {
('gross_output'):
('system_capacity'),
('nameplate', 'resource_type', 'resource_temp', 'resource_depth', 'geothermal_analysis_period', 'model_choice', 'analysis_type', 'num_wells', 'conversion_type', 'plant_efficiency_input', 'conversion_subtype', 'decline_type', 'temp_decline_rate', 'temp_decline_max', 'wet_bulb_temp', 'ambient_pressure', 'well_flow_rate', 'pump_efficiency', 'delta_pressure_equip', 'excess_pressure_pump', 'well_diameter', 'casing_size', 'inj_well_diam', 'design_temp', 'specify_pump_work', 'specified_pump_work_amount', 'rock_thermal_conductivity', 'rock_specific_heat', 'rock_density', 'reservoir_pressure_change_type', 'reservoir_pressure_change', 'reservoir_width', 'reservoir_height', 'reservoir_permeability', 'inj_prod_well_distance', 'subsurface_water_loss', 'fracture_aperature', 'fracture_width', 'num_fractures', 'fracture_angle', 'hr_pl_nlev'):
('num_wells_getem', 'geotherm.plant_efficiency_used', 'gross_output', 'pump_depth', 'pump_work', 'pump_size_hp', 'geotherm.delta_pressure_reservoir', 'geotherm.avg_reservoir_temp', 'geotherm.bottom_hole_pressure'),
('well_flow_rate', 'num_wells_getem'):
('geotherm.total_flow_kg_per_s'),
('geotherm.egs_design_temp_autoselect', 'resource_temp', 'geotherm.egs_design_temp_input'):
('design_temp'),
():
('ui_calculations_only'),
('gross_output', 'pump_work'):
('geotherm.net_output'),
('geotherm.total_flow_kg_per_s'):
('geotherm.total_flow_gpm') },
'Geothermal Resource': {
('geotherm.bottom_hole_pressure'):
('geotherm.bottom_hole_pressureBar'),
('geotherm.avg_reservoir_temp'):
('geotherm.avg_reservoir_tempF'),
('geotherm.delta_pressure_reservoir'):
('geotherm.delta_pressure_reservoirBar') },
'LF DSG Solar Field': {
('x_b_des'):
('SF_COPY_x_b_des'),
('P_turb_des'):
('SF_COPY_P_turb_des'),
('T_cold_ref'):
('SF_COPY_T_cold_ref_des'),
('csp.lf.sf.field_area', 'csp.lf.sf.area_multiplier'):
('csp.lf.sf.total_land_area'),
('I_bn_des'):
('SF_COPY_I_bn_des'),
('csp.lf.sf.dp.actual_aper'):
('csp.lf.sf.field_area'),
('csp.lf.geom1.rec_thermal_derate'):
('csp.lf.sf.dp.loop_therm_eff'),
('csp.lf.sf.dp.actual_aper', 'csp.lf.sf.dp.sm1_aperture'):
('solarm'),
('specified_solar_multiple', 'csp.lf.sf.dp.sm1_aperture', 'csp.lf.sf.dp.loop_aperture'):
('nLoops'),
('csp.lf.sf.dp.loop_aperture', 'nLoops'):
('csp.lf.sf.dp.actual_aper'),
('csp.lf.sf.dp.sm1_aperture', 'csp.lf.sf.dp.loop_aperture'):
('csp.lf.sf.dp.sm1_numloops'),
('csp.lf.sf.dp.actual_aper', 'I_bn_des', 'csp.lf.sf.dp.total_loop_conv_eff'):
('field_thermal_output'),
('specified_solar_multiple'):
('SF_COPY_specified_solar_multiple'),
('q_pb_des', 'I_bn_des', 'csp.lf.sf.dp.total_loop_conv_eff'):
('csp.lf.sf.dp.sm1_aperture'),
('fP_hdr_c', 'fP_sf_boil', 'fP_hdr_h', 'P_turb_des'):
('csp.lf.sf.total_pres_drop'),
('csp.lf.sf.dp.loop_opt_eff', 'csp.lf.sf.dp.loop_therm_eff'):
('csp.lf.sf.dp.total_loop_conv_eff'),
('specified_q_dot_rec_des'):
('SF_COPY_specified_q_dot_rec_des'),
('csp.lf.geom1.rec_optical_derate', 'csp.lf.geom1.coll_opt_loss_norm_inc'):
('csp.lf.sf.dp.loop_opt_eff'),
('nModBoil', 'csp.lf.geom1.refl_aper_area'):
('csp.lf.sf.dp.loop_aperture') },
'LF DSG System Design': {
():
('T_hot '),
('specified_q_dot_rec_des'):
('system_capacity'),
('specified_solar_multiple', 'q_pb_des'):
('specified_q_dot_rec_des') },
'Physical Trough Parasitics': {
('csp.dtr.par.bop_val', 'csp.dtr.par.bop_pf', 'csp.dtr.par.bop_c0', 'csp.dtr.par.bop_c1', 'csp.dtr.par.bop_c2'):
('bop_array'),
('pb_fixed_par', 'P_ref'):
('csp.dtr.par.calc.frac_gross'),
('csp.dtr.par.bop_val', 'csp.dtr.par.bop_pf', 'csp.dtr.par.bop_c0', 'csp.dtr.par.bop_c1', 'csp.dtr.par.bop_c2', 'P_ref'):
('csp.dtr.par.calc.bop'),
('csp.dtr.par.aux_val', 'csp.dtr.par.aux_pf', 'csp.dtr.par.aux_c0', 'csp.dtr.par.aux_c1', 'csp.dtr.par.aux_c2', 'P_ref'):
('csp.dtr.par.calc.aux'),
('nSCA', 'nLoops', 'SCA_drives_elec'):
('csp.dtr.par.calc.tracking'),
('csp.dtr.par.aux_val', 'csp.dtr.par.aux_pf', 'csp.dtr.par.aux_c0', 'csp.dtr.par.aux_c1', 'csp.dtr.par.aux_c2'):
('aux_array') },
'Dish Reference Inputs': {
('csp.ds.refc.coolfluid'):
('test_cooling_fluid') },
'Generic CSP System Costs': {
():
('system_use_recapitalization'),
():
('system_use_lifetime_output'),
('csp.gss.cost.solar_field.area', 'csp.gss.cost.solar_field.cost_per_m2'):
('csp.gss.cost.solar_field'),
('csp.gss.sf.field_area'):
('csp.gss.cost.site_improvements.area'),
('csp.gss.cost.storage.mwht', 'csp.gss.cost.storage.cost_per_kwht'):
('csp.gss.cost.storage'),
('csp.gss.tes.max_capacity'):
('csp.gss.cost.storage.mwht'),
('total_installed_cost', 'csp.gss.pwrb.nameplate'):
('csp.gss.cost.installed_per_capacity'),
('csp.gss.sf.field_area'):
('csp.gss.cost.solar_field.area'),
('csp.gss.cost.bop_mwe', 'csp.gss.cost.bop_per_kwe'):
('csp.gss.cost.bop'),
('csp.gss.cost.sales_tax.value', 'total_direct_cost', 'csp.gss.cost.sales_tax.percent'):
('csp.gss.cost.sales_tax.total'),
('csp.gss.cost.fossil_backup.mwe', 'csp.gss.cost.fossil_backup.cost_per_kwe'):
('csp.gss.cost.fossil_backup'),
('csp.gss.cost.contingency', 'csp.gss.cost.solar_field', 'csp.gss.cost.storage', 'csp.gss.cost.power_plant', 'csp.gss.cost.site_improvements', 'csp.gss.cost.fossil_backup', 'csp.gss.cost.bop'):
('total_direct_cost'),
('csp.gss.cost.site_improvements.area', 'csp.gss.cost.site_improvements.cost_per_m2'):
('csp.gss.cost.site_improvements'),
('csp.gss.cost.contingency_percent', 'csp.gss.cost.solar_field', 'csp.gss.cost.storage', 'csp.gss.cost.power_plant', 'csp.gss.cost.site_improvements', 'csp.gss.cost.fossil_backup', 'csp.gss.cost.bop'):
('csp.gss.cost.contingency'),
('csp.gss.cost.epc.per_acre', 'csp.gss.cost.total_land_area', 'csp.gss.cost.epc.percent', 'total_direct_cost', 'csp.gss.cost.nameplate', 'csp.gss.cost.epc.per_watt', 'csp.gss.cost.epc.fixed'):
('csp.gss.cost.epc.total'),
('w_des'):
('csp.gss.cost.fossil_backup.mwe'),
('w_des'):
('csp.gss.cost.power_plant.mwe'),
('csp.gss.solf.total_land_area'):
('csp.gss.cost.total_land_area'),
('w_des'):
('csp.gss.cost.bop_mwe'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('csp.gss.cost.power_plant.mwe', 'csp.gss.cost.power_plant.cost_per_kwe'):
('csp.gss.cost.power_plant'),
('sales_tax_rate'):
('csp.gss.cost.sales_tax.value'),
('csp.gss.cost.plm.per_acre', 'csp.gss.cost.total_land_area', 'csp.gss.cost.plm.percent', 'total_direct_cost', 'csp.gss.cost.nameplate', 'csp.gss.cost.plm.per_watt', 'csp.gss.cost.plm.fixed'):
('csp.gss.cost.plm.total'),
('csp.gss.cost.epc.total', 'csp.gss.cost.plm.total', 'csp.gss.cost.sales_tax.total'):
('total_indirect_cost'),
('csp.gss.pwrb.nameplate'):
('csp.gss.cost.nameplate') },
'Linear Fresnel Superheater Geometry': {
('csp.lf.geom2.var1.broken_glass', 'csp.lf.geom2.var2.broken_glass', 'csp.lf.geom2.var3.broken_glass', 'csp.lf.geom2.var4.broken_glass'):
('csp.lf.geom2.glazing_intact'),
('csp.lf.geom2.var1.gas_type', 'csp.lf.geom2.var2.gas_type', 'csp.lf.geom2.var3.gas_type', 'csp.lf.geom2.var4.gas_type'):
('csp.lf.geom2.annulus_gas'),
('csp.lf.geom2.heat_loss_at_design', 'I_bn_des', 'csp.lf.geom2.refl_aper_area', 'csp.lf.geom2.coll_length'):
('csp.lf.geom2.rec_thermal_derate'),
('csp.lf.geom2.hl_mode', 'csp.lf.geom2.var1.field_fraction', 'csp.lf.geom2.var1.bellows_shadowing', 'csp.lf.geom2.var1.hce_dirt', 'csp.lf.geom2.var2.field_fraction', 'csp.lf.geom2.var2.bellows_shadowing', 'csp.lf.geom2.var2.hce_dirt', 'csp.lf.geom2.var3.field_fraction', 'csp.lf.geom2.var3.bellows_shadowing', 'csp.lf.geom2.var3.hce_dirt', 'csp.lf.geom2.var4.field_fraction', 'csp.lf.geom2.var4.bellows_shadowing', 'csp.lf.geom2.var4.hce_dirt'):
('csp.lf.geom2.rec_optical_derate'),
('T_cold_ref', 'T_hot', 'T_amb_des_sf'):
('csp.lf.geom2.avg_field_temp_dt_design'),
('csp.lf.geom2.track_error', 'csp.lf.geom2.geom_error', 'csp.lf.geom2.mirror_refl', 'csp.lf.geom2.soiling', 'csp.lf.geom2.general_error'):
('csp.lf.geom2.coll_opt_loss_norm_inc'),
('csp.lf.geom2.hl_mode', 'csp.lf.geom2.hlpolyt0', 'csp.lf.geom2.hlpolyt1', 'csp.lf.geom2.avg_field_temp_dt_design', 'csp.lf.geom2.hlpolyt2', 'csp.lf.geom2.hlpolyt3', 'csp.lf.geom2.hlpolyt4', 'csp.lf.geom2.var1.field_fraction', 'csp.lf.geom2.var1.rated_heat_loss', 'csp.lf.geom2.var2.field_fraction', 'csp.lf.geom2.var2.rated_heat_loss', 'csp.lf.geom2.var3.field_fraction', 'csp.lf.geom2.var3.rated_heat_loss', 'csp.lf.geom2.var4.field_fraction', 'csp.lf.geom2.var4.rated_heat_loss'):
('csp.lf.geom2.heat_loss_at_design') },
'Empirical Trough Capital Costs': {
():
('system_use_recapitalization'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('sales_tax_rate', 'total_direct_cost', 'csp.tr.cost.sales_tax.percent'):
('csp.tr.cost.sales_tax.total'),
('Solar_Field_Area'):
('csp.tr.cost.htf_system.area'),
('calc_max_energy', 'csp.tr.cost.storage.cost_per_kwht'):
('csp.tr.cost.storage'),
('csp.tr.cost.epc.total', 'csp.tr.cost.plm.total', 'csp.tr.cost.sales_tax.total'):
('total_indirect_cost'),
('Solar_Field_Area', 'csp.tr.cost.solar_field.cost_per_m2'):
('csp.tr.cost.solar_field'),
('csp.tr.cost.plm.per_acre', 'csp.tr.cost.total_land_area', 'csp.tr.cost.plm.percent', 'total_direct_cost', 'system_capacity', 'csp.tr.cost.plm.per_watt', 'csp.tr.cost.plm.fixed'):
('csp.tr.cost.plm.total'),
('ui_net_capacity'):
('csp.tr.cost.nameplate'),
('ui_total_land_area'):
('csp.tr.cost.total_land_area'),
('sales_tax_rate'):
('csp.tr.cost.sales_tax.value'),
('csp.tr.cost.contingency_percent', 'csp.tr.cost.site_improvements', 'csp.tr.cost.solar_field', 'csp.tr.cost.htf_system', 'csp.tr.cost.storage', 'csp.tr.cost.fossil_backup', 'csp.tr.cost.power_plant', 'csp.tr.cost.bop'):
('csp.tr.cost.contingency'),
('TurbOutG', 'csp.tr.cost.bop_per_kwe'):
('csp.tr.cost.bop'),
('calc_max_energy'):
('csp.tr.cost.storage.mwht'),
('TurbOutG'):
('csp.tr.cost.bop.mwe'),
('TurbOutG', 'csp.tr.cost.fossil_backup.cost_per_kwe'):
('csp.tr.cost.fossil_backup'),
('csp.tr.cost.epc.per_acre', 'csp.tr.cost.total_land_area', 'csp.tr.cost.epc.percent', 'total_direct_cost', 'system_capacity', 'csp.tr.cost.epc.per_watt', 'csp.tr.cost.epc.fixed'):
('csp.tr.cost.epc.total'),
('TurbOutG', 'csp.tr.cost.power_plant.cost_per_kwe'):
('csp.tr.cost.power_plant'),
('TurbOutG'):
('csp.tr.cost.power_plant.mwe'),
('Solar_Field_Area', 'csp.tr.cost.htf_system.cost_per_m2'):
('csp.tr.cost.htf_system'),
('TurbOutG'):
('csp.tr.cost.fossil_backup.mwe'),
('Solar_Field_Area', 'csp.tr.cost.site_improvements.cost_per_m2'):
('csp.tr.cost.site_improvements'),
():
('system_use_lifetime_output'),
('Solar_Field_Area'):
('csp.tr.cost.site_improvements.area'),
('Solar_Field_Area'):
('csp.tr.cost.solar_field.area'),
('total_installed_cost', 'ui_net_capacity'):
('csp.tr.cost.installed_per_capacity'),
('csp.tr.cost.contingency', 'csp.tr.cost.site_improvements', 'csp.tr.cost.solar_field', 'csp.tr.cost.htf_system', 'csp.tr.cost.storage', 'csp.tr.cost.fossil_backup', 'csp.tr.cost.power_plant', 'csp.tr.cost.bop'):
('total_direct_cost') },
'Empirical Trough HCE': {
('ui_hce_heat_losses_1', 'HCEFrac_1', 'ui_hce_heat_losses_2', 'HCEFrac_2', 'ui_hce_heat_losses_3', 'HCEFrac_3', 'ui_hce_heat_losses_4', 'HCEFrac_4'):
('ui_hce_thermloss_weighted_m'),
('PerfFac_2', 'HCEA0_2', 'HCEA5_2', 'ui_hce_hl_term_1', 'HCEA1_2', 'HCEA6_2', 'ui_hce_hl_term_2', 'HCEA2_2', 'HCEA4_2', 'ui_reference_direct_normal_irradiance', 'ui_hce_hl_term_3', 'HCEA3_2', 'ui_hce_hl_term_4'):
('ui_hce_heat_losses_2'),
('PerfFac_3', 'HCEA0_3', 'HCEA5_3', 'ui_hce_hl_term_1', 'HCEA1_3', 'HCEA6_3', 'ui_hce_hl_term_2', 'HCEA2_3', 'HCEA4_3', 'ui_reference_direct_normal_irradiance', 'ui_hce_hl_term_3', 'HCEA3_3', 'ui_hce_hl_term_4'):
('ui_hce_heat_losses_3'),
('ui_reference_wind_speed'):
('ui_hce_hl_term_1'),
('ui_hce_opt_eff_1', 'HCEFrac_1', 'ui_hce_opt_eff_2', 'HCEFrac_2', 'ui_hce_opt_eff_3', 'HCEFrac_3', 'ui_hce_opt_eff_4', 'HCEFrac_4'):
('ui_hce_opt_eff_weighted'),
('calc_hce_col_factor', 'ui_hce_broken_glass_1', 'ui_hce_HCEdust', 'HCEBelShad_1', 'HCEEnvTrans_1', 'HCEabs_1', 'HCEmisc_1'):
('ui_hce_opt_eff_1'),
('calc_hce_col_factor', 'ui_hce_broken_glass_4', 'ui_hce_HCEdust', 'HCEBelShad_4', 'HCEEnvTrans_4', 'HCEabs_4', 'HCEmisc_4'):
('ui_hce_opt_eff_4'),
('calc_hce_col_factor', 'ui_hce_broken_glass_3', 'ui_hce_HCEdust', 'HCEBelShad_3', 'HCEEnvTrans_3', 'HCEabs_3', 'HCEmisc_3'):
('ui_hce_opt_eff_3'),
('calc_hce_col_factor', 'ui_hce_broken_glass_2', 'ui_hce_HCEdust', 'HCEBelShad_2', 'HCEEnvTrans_2', 'HCEabs_2', 'HCEmisc_2'):
('ui_hce_opt_eff_2'),
('HCEA5_1', 'HCEA5_2', 'HCEA5_3', 'HCEA5_4'):
('HCE_A5'),
('SfOutTempD', 'SfInTempD'):
('ui_hce_hl_term_4'),
('HCEA4_1', 'HCEA4_2', 'HCEA4_3', 'HCEA4_4'):
('HCE_A4'),
('SfOutTempD', 'SfInTempD', 'ui_reference_ambient_temperature'):
('ui_hce_hl_term_2'),
('HCEA3_1', 'HCEA3_2', 'HCEA3_3', 'HCEA3_4'):
('HCE_A3'),
('ui_hce_thermloss_weighted_m', 'SCA_aper'):
('ui_hce_thermloss_weighted_m2'),
('HCEmisc_1', 'HCEmisc_2', 'HCEmisc_3', 'HCEmisc_4'):
('HCEmisc'),
('HCEA2_1', 'HCEA2_2', 'HCEA2_3', 'HCEA2_4'):
('HCE_A2'),
('SfOutTempD', 'SfInTempD'):
('ui_hce_hl_term_3'),
('PerfFac_4', 'HCEA0_4', 'HCEA5_4', 'ui_hce_hl_term_1', 'HCEA1_4', 'HCEA6_4', 'ui_hce_hl_term_2', 'HCEA2_4', 'HCEA4_4', 'ui_reference_direct_normal_irradiance', 'ui_hce_hl_term_3', 'HCEA3_4', 'ui_hce_hl_term_4'):
('ui_hce_heat_losses_4'),
('HCEA6_1', 'HCEA6_2', 'HCEA6_3', 'HCEA6_4'):
('HCE_A6'),
('PerfFac_1', 'PerfFac_2', 'PerfFac_3', 'PerfFac_4'):
('PerfFac'),
('HCEA1_1', 'HCEA1_2', 'HCEA1_3', 'HCEA1_4'):
('HCE_A1'),
('calc_col_factor'):
('calc_hce_col_factor'),
('HCEdust'):
('ui_hce_HCEdust'),
('HCEFrac_1', 'HCEFrac_2', 'HCEFrac_3', 'HCEFrac_4'):
('HCEFrac'),
('HCEA0_1', 'HCEA0_2', 'HCEA0_3', 'HCEA0_4'):
('HCE_A0'),
('HCEabs_1', 'HCEabs_2', 'HCEabs_3', 'HCEabs_4'):
('HCEabs'),
('HCEBelShad_1', 'HCEBelShad_2', 'HCEBelShad_3', 'HCEBelShad_4'):
('HCEBelShad'),
('PerfFac_1', 'HCEA0_1', 'HCEA5_1', 'ui_hce_hl_term_1', 'HCEA1_1', 'HCEA6_1', 'ui_hce_hl_term_2', 'HCEA2_1', 'HCEA4_1', 'ui_reference_direct_normal_irradiance', 'ui_hce_hl_term_3', 'HCEA3_1', 'ui_hce_hl_term_4'):
('ui_hce_heat_losses_1'),
('HCEEnvTrans_1', 'HCEEnvTrans_2', 'HCEEnvTrans_3', 'HCEEnvTrans_4'):
('HCEEnvTrans') },
'Empirical Trough Power Block': {
('ui_net_capacity'):
('system_capacity'),
('ui_q_design', 'E2TPLF0', 'E2TPLF1', 'MinGrOut', 'E2TPLF2', 'E2TPLF3', 'E2TPLF4'):
('ui_min_therm_input'),
('TurbOutG', 'ui_gross_net_conversion_factor'):
('ui_net_capacity'),
('TurbOutG', 'TurbEffG'):
('ui_q_design'),
('ui_q_design', 'E2TPLF0', 'E2TPLF1', 'MaxGrOut', 'E2TPLF2', 'E2TPLF3', 'E2TPLF4'):
('ui_max_therm_input'),
('MinGrOut'):
('PTTMIN'),
('MaxGrOut'):
('PTTMAX') },
'Physical Trough Collector Type 2': {
('csp_dtr_sca_ave_focal_len_2', 'csp_dtr_sca_calc_theta_2', 'csp_dtr_sca_piping_dist_2'):
('csp_dtr_sca_calc_end_gain_2'),
('lat'):
('csp_dtr_sca_calc_latitude_2'),
('csp_dtr_sca_ave_focal_len_2', 'csp_dtr_sca_calc_theta_2', 'nSCA', 'csp_dtr_sca_calc_end_gain_2', 'csp_dtr_sca_length_2', 'csp_dtr_sca_ncol_per_sca_2'):
('csp_dtr_sca_calc_end_loss_2'),
('csp_dtr_sca_length_2', 'csp_dtr_sca_ncol_per_sca_2'):
('csp_dtr_sca_ap_length_2'),
('csp_dtr_sca_calc_costh_2'):
('csp_dtr_sca_calc_theta_2'),
('lat'):
('csp_dtr_sca_calc_zenith_2'),
('IAMs_2', 'csp_dtr_sca_calc_theta_2', 'csp_dtr_sca_calc_costh_2'):
('csp_dtr_sca_calc_iam_2'),
('csp_dtr_sca_calc_zenith_2', 'tilt', 'azimuth'):
('csp_dtr_sca_calc_costh_2'),
('csp_dtr_sca_tracking_error_2', 'csp_dtr_sca_geometry_effects_2', 'csp_dtr_sca_clean_reflectivity_2', 'csp_dtr_sca_mirror_dirt_2', 'csp_dtr_sca_general_error_2'):
('csp_dtr_sca_calc_sca_eff_2') },
'Empirical Trough Solar Field': {
('ui_field_htf_type'):
('HTFFluid'),
('ui_field_layout_option', 'ui_solar_multiple', 'calc_aperture_area_at_sm_1', 'ui_solar_field_area'):
('Solar_Field_Area'),
('ui_field_layout_option', 'ui_solar_multiple', 'ui_solar_field_area', 'calc_aperture_area_at_sm_1'):
('Solar_Field_Mult'),
('ui_design_exact_num_scas_sm_1', 'ui_sca_aperture_area'):
('calc_aperture_area_at_sm_1'),
('ui_hce_opt_eff_weighted'):
('ui_hce_weighted_optical_efficiency'),
('Solar_Field_Mult', 'ui_design_exact_area_sm_1', 'Row_Distance', 'SCA_aper'):
('ui_fixed_land_area'),
('ui_field_htf_type'):
('ui_field_htf_min_operating_temp'),
('ui_design_exact_area_sm_1', 'ui_sca_aperture_area'):
('ui_design_exact_num_scas_sm_1'),
('ui_fixed_land_area', 'ui_land_multiplier'):
('ui_total_land_area'),
('ui_field_htf_type'):
('ui_field_htf_max_operating_temp'),
('SfInTempD', 'SfOutTempD', 'ui_reference_ambient_temperature'):
('calc_field_htf_average_temp'),
('ui_sca_aperture_area'):
('ui_aperture_area_per_SCA'),
('SfPipeHl3', 'calc_field_htf_average_temp', 'SfPipeHl2', 'SfPipeHl1', 'SfPipeHl300'):
('ui_piping_heat_loss'),
('ui_pb_q_design', 'ui_reference_direct_normal_irradiance', 'ui_hce_weighted_optical_efficiency', 'ui_hce_weighted_thermal_losses', 'ui_piping_heat_loss'):
('ui_design_exact_area_sm_1'),
('ui_q_design'):
('ui_pb_q_design'),
('ui_hce_thermloss_weighted_m2'):
('ui_hce_weighted_thermal_losses'),
():
('i_SfTi') },
'Financial LCOE Calculator': {
('ui_fcr_input_option', 'ui_fixed_charge_rate', 'c_inflation', 'c_equity_return', 'c_debt_percent', 'c_nominal_interest_rate', 'c_tax_rate', 'c_lifetime', 'c_depreciation_schedule', 'c_construction_cost', 'c_construction_interest'):
('fixed_charge_rate', 'ui_wacc', 'ui_crf', 'ui_pfin', 'ui_cfin', 'ui_ireal'),
('ui_variable_operating_cost'):
('variable_operating_cost'),
('ui_cost_input_option', 'ui_capital_cost_fixed', 'system_capacity', 'ui_capital_cost_capacity'):
('capital_cost'),
('ui_cost_input_option', 'ui_operating_cost_fixed', 'system_capacity', 'ui_operating_cost_capacity'):
('fixed_operating_cost'),
('system_capacity'):
('ui_system_capacity') },
'Physical Trough Thermal Storage': {
('vol_tank', 'h_tank', 'tank_pairs'):
('csp.dtr.tes.tank_diameter'),
('is_hx', 'dt_hot', 'dt_cold', 'T_loop_out', 'T_loop_in_des'):
('csp.dtr.tes.hx_derate'),
('vol_tank', 'h_tank_min', 'h_tank'):
('csp.dtr.tes.min_fluid_volume'),
('P_ref', 'eta_ref', 'tshours'):
('csp.dtr.tes.thermal_capacity'),
('h_tank_min', 'h_tank', 'vol_tank'):
('V_tank_hot_ini'),
('T_loop_in_des', 'T_loop_out'):
('csp.dtr.tes.htf_calc_temp'),
('combo_tes_htf_type'):
('csp.dtr.tes.htf_max_opt_temp'),
('h_tank', 'csp.dtr.tes.tank_diameter', 'tank_pairs', 'csp.dtr.tes.htf_calc_temp', 'u_tank'):
('csp.dtr.tes.estimated_heat_loss'),
('combo_tes_htf_type'):
('csp.dtr.tes.htf_min_opt_temp'),
('combo_tes_htf_type', 'store_fluid', 'csp.dtr.tes.htf_calc_temp', 'store_fl_props'):
('csp.dtr.tes.fluid_dens'),
('dt_hot'):
('dt_cold'),
('csp.dtr.tes.thermal_capacity', 'csp.dtr.tes.fluid_dens', 'csp.dtr.tes.fluid_sph', 'csp.dtr.tes.hx_derate', 'T_loop_out', 'dt_hot', 'T_loop_in_des', 'dt_cold'):
('vol_tank'),
('combo_tes_htf_type', 'store_fluid', 'csp.dtr.tes.htf_calc_temp', 'store_fl_props'):
('csp.dtr.tes.fluid_sph'),
('combo_tes_htf_type'):
('store_fluid') },
'Physical Trough Power Block Common': {
('q_pb_design'):
('PB_COPY_q_pb_design'),
('csp.dtr.pwrb.design_inlet_temp'):
('PB_COPY_T_htf_hot_des'),
('csp.dtr.pwrb.nameplate'):
('system_capacity'),
('T_loop_in_des'):
('csp.dtr.pwrb.design_outlet_temp'),
('PB_COPY_q_pb_design', 'PB_COPY_htf_cp_avg', 'PB_COPY_T_htf_hot_des', 'PB_COPY_T_htf_cold_des'):
('PB_m_dot_htf_cycle_des'),
('T_loop_out'):
('csp.dtr.pwrb.design_inlet_temp'),
('csp.dtr.pwrb.design_outlet_temp'):
('PB_COPY_T_htf_cold_des'),
('P_ref', 'csp.dtr.pwrb.gross_net_conversion_factor'):
('csp.dtr.pwrb.nameplate'),
('field_htf_cp_avg'):
('PB_COPY_htf_cp_avg'),
('P_ref', 'eta_ref'):
('W_pb_design', 'q_pb_design', 'q_max_aux'),
('comb_fossil_mode'):
('fossil_mode') },
'Generic CSP Power Block': {
('csp.gss.pwrb.nameplate'):
('system_capacity'),
('dni_par_f3', 'dni_par_f2', 'dni_par_f1', 'dni_par_f0'):
('Wpar_prodD_coefs'),
('csp.gss.pwrb.temp_eff_f4', 'csp.gss.pwrb.temp_eff_f3', 'csp.gss.pwrb.temp_eff_f2', 'csp.gss.pwrb.temp_eff_f1', 'csp.gss.pwrb.temp_eff_f0'):
('etaT_coefs'),
('csp.gss.pwrb.pl_eff_f4', 'csp.gss.pwrb.pl_eff_f3', 'csp.gss.pwrb.pl_eff_f2', 'csp.gss.pwrb.pl_eff_f1', 'csp.gss.pwrb.pl_eff_f0'):
('etaQ_coefs'),
('csp.gss.pwrb.temp_corr_mode'):
('PC_T_corr'),
('csp.gss.pwrb.gross_net_conversion_factor', 'w_des'):
('csp.gss.pwrb.nameplate'),
('csp.gss.pwrb.temp_par_f3', 'csp.gss.pwrb.temp_par_f2', 'csp.gss.pwrb.temp_par_f1', 'csp.gss.pwrb.temp_par_f0'):
('Wpar_prodT_coefs'),
('csp.gss.pwrb.pl_par_f3', 'csp.gss.pwrb.pl_par_f2', 'csp.gss.pwrb.pl_par_f1', 'csp.gss.pwrb.pl_par_f0'):
('Wpar_prodQ_coefs'),
('csp.gss.pwrb.pl_par_design', 'csp.gss.pwrb.temp_par_design', 'dni_par_design'):
('f_par_tot_des'),
('w_des', 'f_Wpar_fixed', 'f_Wpar_prod', 'csp.gss.pwrb.pl_par_design', 'csp.gss.pwrb.temp_par_design', 'dni_par_design'):
('csp.gss.pwrb.design_parasitic_load'),
('dni_par_f0', 'dni_par_f1', 'dni_par_f2', 'dni_par_f3'):
('dni_par_design'),
('w_des', 'f_Wpar_prod', 'f_par_tot_des'):
('W_dot_part_load_des'),
('w_des', 'f_Wpar_fixed'):
('W_dot_par_fixed'),
('csp.gss.pwrb.pl_par_f0', 'csp.gss.pwrb.pl_par_f1', 'csp.gss.pwrb.pl_par_f2', 'csp.gss.pwrb.pl_par_f3'):
('csp.gss.pwrb.pl_par_design'),
('csp.gss.pwrb.temp_par_f0', 'csp.gss.pwrb.temp_par_f1', 'csp.gss.pwrb.temp_par_f2', 'csp.gss.pwrb.temp_par_f3'):
('csp.gss.pwrb.temp_par_design') },
'Physical Trough Receiver Type 3': {
('csp_dtr_hce_var1_field_fraction_3', 'csp_dtr_hce_var1_bellows_shadowing_3', 'csp_dtr_hce_var1_hce_dirt_3', 'csp_dtr_hce_var1_abs_abs_3', 'csp_dtr_hce_var1_env_trans_3', 'csp_dtr_hce_var2_field_fraction_3', 'csp_dtr_hce_var2_bellows_shadowing_3', 'csp_dtr_hce_var2_hce_dirt_3', 'csp_dtr_hce_var2_abs_abs_3', 'csp_dtr_hce_var2_env_trans_3', 'csp_dtr_hce_var3_field_fraction_3', 'csp_dtr_hce_var3_bellows_shadowing_3', 'csp_dtr_hce_var3_hce_dirt_3', 'csp_dtr_hce_var3_abs_abs_3', 'csp_dtr_hce_var3_env_trans_3', 'csp_dtr_hce_var4_field_fraction_3', 'csp_dtr_hce_var4_bellows_shadowing_3', 'csp_dtr_hce_var4_hce_dirt_3', 'csp_dtr_hce_var4_abs_abs_3', 'csp_dtr_hce_var4_env_trans_3'):
('csp_dtr_hce_optical_eff_3'),
('csp_dtr_hce_var1_field_fraction_3', 'csp_dtr_hce_var1_rated_heat_loss_3', 'csp_dtr_hce_var2_field_fraction_3', 'csp_dtr_hce_var2_rated_heat_loss_3', 'csp_dtr_hce_var3_field_fraction_3', 'csp_dtr_hce_var3_rated_heat_loss_3', 'csp_dtr_hce_var4_field_fraction_3', 'csp_dtr_hce_var4_rated_heat_loss_3'):
('csp_dtr_hce_design_heat_loss_3') },
'Empirical Trough Parasitics': {
('HtrParPF', 'ui_par_hb_const', 'ui_par_turb_out_gr'):
('HtrPar'),
('BOPParPF', 'ui_par_bop_const', 'ui_par_turb_out_gr'):
('BOPPar'),
('ui_par_fixedblock_const', 'ui_par_turb_out_gr'):
('PbFixPar'),
('ChtfParPF', 'ui_par_htfpump_const', 'ui_par_sf_area'):
('ChtfPar'),
('CtParPF', 'ui_par_ct0_const', 'ui_par_turb_out_gr'):
('CtPar'),
('Solar_Field_Area'):
('ui_par_sf_area'),
('HhtfParPF', 'ui_par_tes_const', 'ui_par_turb_out_gr'):
('HhtfPar'),
('SfParPF', 'ui_par_sf_const', 'ui_par_sf_area'):
('SfPar'),
('SfPar', 'ChtfPar', 'HhtfPar', 'AntiFrPar', 'PbFixPar', 'BOPPar', 'HtrPar', 'CtPar'):
('ui_par_dp_total'),
('ui_par_antifreeze_const', 'ChtfPar'):
('AntiFrPar'),
('TurbOutG'):
('ui_par_turb_out_gr') },
'Phys Trough Direct Storage': {
('T_loop_in_des'):
('TES_COPY_T_htf_cold_des'),
('T_loop_out'):
('TES_COPY_T_htf_hot_des'),
('tshours'):
('TES_COPY_tshours'),
('q_pb_design'):
('TES_COPY_q_pb_design'),
('q_pb_design', 'tshours', 'T_loop_out', 'T_loop_in_des', 'Fluid', 'field_fl_props', 'h_tank_min', 'h_tank', 'tank_pairs', 'u_tank'):
('Q_tes', 'tes_avail_vol', 'vol_tank', 'csp.pt.tes.tank_diameter', 'q_dot_tes_est', 'csp.pt.tes.htf_density') },
'Physical Trough Receiver Type 2': {
('csp_dtr_hce_var1_field_fraction_2', 'csp_dtr_hce_var1_rated_heat_loss_2', 'csp_dtr_hce_var2_field_fraction_2', 'csp_dtr_hce_var2_rated_heat_loss_2', 'csp_dtr_hce_var3_field_fraction_2', 'csp_dtr_hce_var3_rated_heat_loss_2', 'csp_dtr_hce_var4_field_fraction_2', 'csp_dtr_hce_var4_rated_heat_loss_2'):
('csp_dtr_hce_design_heat_loss_2'),
('csp_dtr_hce_var1_field_fraction_2', 'csp_dtr_hce_var1_bellows_shadowing_2', 'csp_dtr_hce_var1_hce_dirt_2', 'csp_dtr_hce_var1_abs_abs_2', 'csp_dtr_hce_var1_env_trans_2', 'csp_dtr_hce_var2_field_fraction_2', 'csp_dtr_hce_var2_bellows_shadowing_2', 'csp_dtr_hce_var2_hce_dirt_2', 'csp_dtr_hce_var2_abs_abs_2', 'csp_dtr_hce_var2_env_trans_2', 'csp_dtr_hce_var3_field_fraction_2', 'csp_dtr_hce_var3_bellows_shadowing_2', 'csp_dtr_hce_var3_hce_dirt_2', 'csp_dtr_hce_var3_abs_abs_2', 'csp_dtr_hce_var3_env_trans_2', 'csp_dtr_hce_var4_field_fraction_2', 'csp_dtr_hce_var4_bellows_shadowing_2', 'csp_dtr_hce_var4_hce_dirt_2', 'csp_dtr_hce_var4_abs_abs_2', 'csp_dtr_hce_var4_env_trans_2'):
('csp_dtr_hce_optical_eff_2') },
'Financial Construction Financing': {
('const_per_total1', 'const_per_total2', 'const_per_total3', 'const_per_total4', 'const_per_total5'):
('construction_financing_cost'),
('const_per_interest1', 'const_per_interest2', 'const_per_interest3', 'const_per_interest4', 'const_per_interest5'):
('const_per_interest_total'),
('const_per_percent1', 'const_per_percent2', 'const_per_percent3', 'const_per_percent4', 'const_per_percent5'):
('const_per_percent_total'),
('const_per_principal1', 'const_per_principal2', 'const_per_principal3', 'const_per_principal4', 'const_per_principal5'):
('const_per_principal_total'),
('total_installed_cost', 'const_per_interest_rate1', 'const_per_months1', 'const_per_percent1', 'const_per_upfront_rate1', 'const_per_interest_rate2', 'const_per_months2', 'const_per_percent2', 'const_per_upfront_rate2', 'const_per_interest_rate3', 'const_per_months3', 'const_per_percent3', 'const_per_upfront_rate3', 'const_per_interest_rate4', 'const_per_months4', 'const_per_percent4', 'const_per_upfront_rate4', 'const_per_interest_rate5', 'const_per_months5', 'const_per_percent5', 'const_per_upfront_rate5'):
('const_per_principal1', 'const_per_interest1', 'const_per_total1', 'const_per_principal2', 'const_per_interest2', 'const_per_total2', 'const_per_principal3', 'const_per_interest3', 'const_per_total3', 'const_per_principal4', 'const_per_interest4', 'const_per_total4', 'const_per_principal5', 'const_per_interest5', 'const_per_total5') },
'Wind OBOS': {
('wind_farm_num_turbines', 'wind_turbine_kw_rating', 'wind_turbine_rotor_diameter', 'wind_turbine_hub_ht', 'windfarm.farm.turbine_spacing', 'windfarm.farm.row_spacing', 'turbine_cost_total', 'system_capacity', 'waterD', 'distShore', 'distPort', 'distPtoA', 'distAtoS', 'substructure', 'anchor', 'turbInstallMethod', 'towerInstallMethod', 'installStrategy', 'cableOptimizer', 'moorLines', 'buryDepth', 'substructCont', 'turbCont', 'elecCont', 'interConVolt', 'distInterCon', 'scrapVal', 'number_install_seasons', 'detailed_obos_general', 'detailed_obos_substructure', 'detailed_obos_electrical', 'detailed_obos_assembly', 'detailed_obos_port', 'detailed_obos_development'):
('obos_warning', 'total_obos_cost'),
('total_obos_cost', 'system_capacity'):
('total_obos_cost_per_kw') },
'Dish Parasitics': {
('csp.ds.coolfluid'):
('cooling_fluid') },
'Physical Trough Receiver Type 1': {
('csp_dtr_hce_var1_field_fraction_1', 'csp_dtr_hce_var1_bellows_shadowing_1', 'csp_dtr_hce_var1_hce_dirt_1', 'csp_dtr_hce_var1_abs_abs_1', 'csp_dtr_hce_var1_env_trans_1', 'csp_dtr_hce_var2_field_fraction_1', 'csp_dtr_hce_var2_bellows_shadowing_1', 'csp_dtr_hce_var2_hce_dirt_1', 'csp_dtr_hce_var2_abs_abs_1', 'csp_dtr_hce_var2_env_trans_1', 'csp_dtr_hce_var3_field_fraction_1', 'csp_dtr_hce_var3_bellows_shadowing_1', 'csp_dtr_hce_var3_hce_dirt_1', 'csp_dtr_hce_var3_abs_abs_1', 'csp_dtr_hce_var3_env_trans_1', 'csp_dtr_hce_var4_field_fraction_1', 'csp_dtr_hce_var4_bellows_shadowing_1', 'csp_dtr_hce_var4_hce_dirt_1', 'csp_dtr_hce_var4_abs_abs_1', 'csp_dtr_hce_var4_env_trans_1'):
('csp_dtr_hce_optical_eff_1'),
('csp_dtr_hce_var1_field_fraction_1', 'csp_dtr_hce_var1_rated_heat_loss_1', 'csp_dtr_hce_var2_field_fraction_1', 'csp_dtr_hce_var2_rated_heat_loss_1', 'csp_dtr_hce_var3_field_fraction_1', 'csp_dtr_hce_var3_rated_heat_loss_1', 'csp_dtr_hce_var4_field_fraction_1', 'csp_dtr_hce_var4_rated_heat_loss_1'):
('csp_dtr_hce_design_heat_loss_1') },
'Physical Trough Collector Type 3': {
('csp_dtr_sca_length_3', 'csp_dtr_sca_ncol_per_sca_3'):
('csp_dtr_sca_ap_length_3'),
('IAMs_3', 'csp_dtr_sca_calc_theta_3', 'csp_dtr_sca_calc_costh_3'):
('csp_dtr_sca_calc_iam_3'),
('csp_dtr_sca_calc_zenith_3', 'tilt', 'azimuth'):
('csp_dtr_sca_calc_costh_3'),
('lat'):
('csp_dtr_sca_calc_latitude_3'),
('csp_dtr_sca_ave_focal_len_3', 'csp_dtr_sca_calc_theta_3', 'nSCA', 'csp_dtr_sca_calc_end_gain_3', 'csp_dtr_sca_length_3', 'csp_dtr_sca_ncol_per_sca_3'):
('csp_dtr_sca_calc_end_loss_3'),
('csp_dtr_sca_ave_focal_len_3', 'csp_dtr_sca_calc_theta_3', 'csp_dtr_sca_piping_dist_3'):
('csp_dtr_sca_calc_end_gain_3'),
('csp_dtr_sca_tracking_error_3', 'csp_dtr_sca_geometry_effects_3', 'csp_dtr_sca_clean_reflectivity_3', 'csp_dtr_sca_mirror_dirt_3', 'csp_dtr_sca_general_error_3'):
('csp_dtr_sca_calc_sca_eff_3'),
('csp_dtr_sca_calc_costh_3'):
('csp_dtr_sca_calc_theta_3'),
('lat'):
('csp_dtr_sca_calc_zenith_3') },
'User Defined Power Cycle': {
('PB_COPY_T_htf_hot_des'):
('ud_COPY_T_HTF_des'),
():
('ud_m_dot_design'),
('ud_T_amb_des'):
('ud_COPY_T_amb_des'),
('P_ref', 'ud_f_W_dot_cool_des'):
('ud_W_dot_cool_calc') },
'Physical Trough Collector Type 1': {
('IAMs_1', 'csp_dtr_sca_calc_theta_1', 'csp_dtr_sca_calc_costh_1'):
('csp_dtr_sca_calc_iam_1'),
('csp_dtr_sca_calc_costh_1'):
('csp_dtr_sca_calc_theta_1'),
('lat'):
('csp_dtr_sca_calc_zenith_1'),
('lat'):
('csp_dtr_sca_calc_latitude_1'),
('csp_dtr_sca_tracking_error_1', 'csp_dtr_sca_geometry_effects_1', 'csp_dtr_sca_clean_reflectivity_1', 'csp_dtr_sca_mirror_dirt_1', 'csp_dtr_sca_general_error_1'):
('csp_dtr_sca_calc_sca_eff_1'),
('csp_dtr_sca_ave_focal_len_1', 'csp_dtr_sca_calc_theta_1', 'nSCA', 'csp_dtr_sca_calc_end_gain_1', 'csp_dtr_sca_length_1', 'csp_dtr_sca_ncol_per_sca_1'):
('csp_dtr_sca_calc_end_loss_1'),
('csp_dtr_sca_calc_zenith_1', 'tilt', 'azimuth'):
('csp_dtr_sca_calc_costh_1'),
('csp_dtr_sca_ave_focal_len_1', 'csp_dtr_sca_calc_theta_1', 'csp_dtr_sca_piping_dist_1'):
('csp_dtr_sca_calc_end_gain_1'),
('csp_dtr_sca_length_1', 'csp_dtr_sca_ncol_per_sca_1'):
('csp_dtr_sca_ap_length_1') },
'CEC Performance Model with Module Database': {
('cec_gamma_r', 'cec_p_mp_ref'):
('gamma_r_calc'),
('cec_beta_oc', 'cec_v_oc_ref'):
('beta_oc_calc'),
('cec_v_mp_ref', 'cec_i_mp_ref', 'cec_area'):
('cec_eff'),
('cec_alpha_sc', 'cec_i_sc_ref'):
('alpha_sc_calc'),
('cec_area', 'cec_module_width'):
('cec_module_length'),
('cec_i_mp_ref', 'cec_v_mp_ref'):
('cec_p_mp_ref') },
'Physical Trough Solar Field': {
('trough_loop_control'):
('SCAInfoArray'),
('fixed_land_area', 'non_solar_field_land_area_multiplier'):
('total_land_area'),
('P_ref', 'eta_ref', 'I_bn_des', 'total_loop_conversion_efficiency'):
('total_required_aperture_for_SM1'),
('total_aperture', 'Row_Distance', 'max_collector_width'):
('fixed_land_area'),
('solar_mult', 'P_ref', 'eta_ref'):
('field_thermal_output'),
('trough_loop_control', 'csp_dtr_sca_calc_sca_eff_1', 'csp_dtr_sca_calc_sca_eff_2', 'csp_dtr_sca_calc_sca_eff_3', 'csp_dtr_sca_calc_sca_eff_4', 'csp_dtr_sca_length_1', 'csp_dtr_sca_length_2', 'csp_dtr_sca_length_3', 'csp_dtr_sca_length_4', 'csp_dtr_hce_optical_eff_1', 'csp_dtr_hce_optical_eff_2', 'csp_dtr_hce_optical_eff_3', 'csp_dtr_hce_optical_eff_4'):
('loop_optical_efficiency'),
('total_required_aperture_for_SM1', 'single_loop_aperature'):
('required_number_of_loops_for_SM1'),
('trough_loop_control'):
('SCADefocusArray'),
('single_loop_aperature', 'nLoops'):
('total_aperture'),
('radio_sm_or_area', 'specified_solar_multiple', 'total_aperture', 'total_required_aperture_for_SM1'):
('solar_mult'),
('combo_feather'):
('fthrctrl'),
('combo_htf_type'):
('Fluid'),
('m_dot_htfmin', 'fluid_dens_inlet_temp', 'min_inner_diameter'):
('min_field_flow_velocity'),
('combo_FieldConfig'):
('FieldConfig'),
('radio_sm_or_area', 'specified_solar_multiple', 'total_required_aperture_for_SM1', 'specified_total_aperture', 'single_loop_aperature'):
('nLoops'),
('trough_loop_control', 'csp_dtr_hce_diam_absorber_inner_1', 'csp_dtr_hce_diam_absorber_inner_2', 'csp_dtr_hce_diam_absorber_inner_3', 'csp_dtr_hce_diam_absorber_inner_4'):
('min_inner_diameter'),
('trough_loop_control', 'I_bn_des', 'csp_dtr_hce_design_heat_loss_1', 'csp_dtr_hce_design_heat_loss_2', 'csp_dtr_hce_design_heat_loss_3', 'csp_dtr_hce_design_heat_loss_4', 'csp_dtr_sca_length_1', 'csp_dtr_sca_length_2', 'csp_dtr_sca_length_3', 'csp_dtr_sca_length_4', 'csp_dtr_sca_aperture_1', 'csp_dtr_sca_aperture_2', 'csp_dtr_sca_aperture_3', 'csp_dtr_sca_aperture_4'):
('cspdtr_loop_hce_heat_loss'),
('m_dot_htfmax', 'fluid_dens_outlet_temp', 'min_inner_diameter'):
('max_field_flow_velocity'),
('trough_loop_control', 'csp_dtr_sca_aperture_1', 'csp_dtr_sca_aperture_2', 'csp_dtr_sca_aperture_3', 'csp_dtr_sca_aperture_4'):
('single_loop_aperature'),
('combo_htf_type', 'Fluid', 'T_loop_in_des', 'T_loop_out', 'field_fl_props'):
('field_htf_cp_avg'),
('loop_optical_efficiency', 'cspdtr_loop_hce_heat_loss'):
('total_loop_conversion_efficiency'),
():
('defocus') },
'Molten Salt Tower Power Block Common': {
('PB_COPY_q_pb_design', 'PB_COPY_htf_cp_avg', 'PB_COPY_T_htf_hot_des', 'PB_COPY_T_htf_cold_des'):
('PB_m_dot_htf_cycle_des'),
('csp.pt.rec.htf_c_avg'):
('PB_COPY_htf_cp_avg'),
('T_htf_cold_des'):
('PB_COPY_T_htf_cold_des'),
('q_pb_design'):
('PB_COPY_q_pb_design'),
('T_htf_hot_des'):
('PB_COPY_T_htf_hot_des'),
('design_eff'):
('PB_COPY_design_eff'),
('nameplate'):
('PB_COPY_nameplate'),
('gross_net_conversion_factor'):
('PB_COPY_gross_net_conversion_factor'),
('P_ref'):
('PB_COPY_P_ref'),
('nameplate'):
('system_capacity') },
'Wind Farm Costs': {
('turbine_cost_total', 'bos_cost_total', 'sales_tax_basis', 'sales_tax_rate'):
('sales_tax_total'),
('sales_tax_rate'):
('reference_sales_tax_percent'),
():
('system_use_lifetime_output'),
():
('system_use_recapitalization'),
('total_installed_cost', 'reference_capacity'):
('total_installed_cost_per_kw'),
('system_capacity'):
('reference_capacity'),
('turbine_cost_total', 'bos_cost_total', 'sales_tax_total'):
('total_installed_cost'),
('bos_cost_per_kw', 'reference_capacity', 'bos_cost_per_turbine', 'reference_number_turbines', 'bos_cost_fixed'):
('bos_cost_total'),
('turbine_cost_per_kw', 'reference_capacity', 'turbine_cost_per_turbine', 'reference_number_turbines', 'turbine_cost_fixed'):
('turbine_cost_total'),
('wind_resource_filename'):
('reference_resource_file'),
('wind_farm_num_turbines'):
('reference_number_turbines') },
'Tower SolarPilot Solar Field': {
():
('opt_algorithm'),
('is_optimize', 'override_layout'):
('field_model_type'),
('Q_rec_des'):
('q_design'),
('helio_height', 'helio_width', 'dens_mirror'):
('csp.pt.sf.heliostat_area'),
('helio_width', 'helio_height', 'dens_mirror', 'n_hel'):
('A_sf_UI'),
('helio_optical_error_mrad'):
('error_equiv'),
('h_tower'):
('csp.pt.sf.tower_height'),
('A_sf_UI'):
('helio_area_tot'),
():
('opt_flux_penalty'),
('csp.pt.sf.fixed_land_area', 'land_area_base', 'csp.pt.sf.land_overhead_factor'):
('csp.pt.sf.total_land_area'),
('helio_positions'):
('n_hel'),
('land_max', 'h_tower'):
('land_max_calc'),
('override_opt'):
('is_optimize'),
('n_hel', 'csp.pt.sf.heliostat_area'):
('csp.pt.sf.total_reflective_area'),
('dni_des'):
('dni_des_calc'),
('helio_positions', 'c_atm_0', 'c_atm_1', 'c_atm_2', 'c_atm_3', 'h_tower'):
('c_atm_info'),
('land_min', 'h_tower'):
('land_min_calc') },
'Wind Farm Specifications': {
('wind_farm_sizing_mode'):
('specify_label'),
('wind_farm_sizing_mode', 'desired_farm_size', 'system_capacity'):
('sizing_warning'),
('wind_farm_num_turbines', 'wind_turbine_kw_rating'):
('system_capacity'),
('wind_farm_sizing_mode', 'windfarm.layout.file_or_controls', 'wind_farm_xCoord_file', 'wind_farm_yCoord_file', 'desired_farm_size', 'wind_turbine_kw_rating', 'wind_turbine_rotor_diameter', 'windfarm.farm.shape', 'windfarm.farm.turbines_per_row', 'windfarm.farm.number_of_rows', 'windfarm.farm.offset', 'windfarm.farm.offset_type', 'windfarm.farm.layout_angle', 'windfarm.farm.turbine_spacing', 'windfarm.farm.row_spacing'):
('wind_farm_num_turbines', 'wind_farm_xCoordinates', 'wind_farm_yCoordinates', 'rows', 'cols') },
'Wind Resource File': {
('use_specific_wf_wind', 'user_specified_wf_wind', 'wind_resource.file'):
('wind_resource_filename'),
('wind_turbine_hub_ht'):
('wind_resource.requested_ht') },
'MSPT Dispatch Control': {
('ui_disp_1_turbout', 'ui_disp_2_turbout', 'ui_disp_3_turbout', 'ui_disp_4_turbout', 'ui_disp_5_turbout', 'ui_disp_6_turbout', 'ui_disp_7_turbout', 'ui_disp_8_turbout', 'ui_disp_9_turbout', 'hybrid_tou1', 'hybrid_tou2', 'hybrid_tou3', 'hybrid_tou4', 'hybrid_tou5', 'hybrid_tou6', 'hybrid_tou7', 'hybrid_tou8', 'hybrid_tou9'):
('f_turb_tou_periods', 'F_wc') },
'Generic CSP Thermal Storage': {
('csp.gss.tes.temp_loss_f3', 'csp.gss.tes.temp_loss_f2', 'csp.gss.tes.temp_loss_f1', 'csp.gss.tes.temp_loss_f0'):
('teshlT_coefs'),
('csp.gss.tes.charge_loss_f3', 'csp.gss.tes.charge_loss_f2', 'csp.gss.tes.charge_loss_f1', 'csp.gss.tes.charge_loss_f0'):
('teshlX_coefs'),
('lon'):
('longitude'),
('lat'):
('latitude'),
():
('itoth'),
('w_des', 'eta_des', 'hrs_tes'):
('csp.gss.tes.max_capacity'),
():
('ntod'),
():
('twb'),
():
('vwind'),
():
('ibn'),
():
('tdb'),
():
('ibh'),
():
('azimuth'),
():
('tilt'),
():
('timezone'),
('exergy_table_ui'):
('exergy_table') },
'Financial Analysis Parameters': {
('real_discount_rate', 'inflation_rate'):
('nominal_discount_rate') },
'Molten Salt Tower Storage': {
('tshours'):
('TES_COPY_tshours'),
('q_pb_design'):
('TES_COPY_q_pb_design'),
('T_htf_cold_des'):
('TES_COPY_T_htf_cold_des'),
('P_ref', 'design_eff', 'tshours', 'T_htf_hot_des', 'T_htf_cold_des', 'rec_htf', 'field_fl_props', 'h_tank_min', 'h_tank', 'tank_pairs', 'u_tank'):
('Q_tes', 'tes_avail_vol', 'vol_tank', 'csp.pt.tes.tank_diameter', 'q_dot_tes_est', 'csp.pt.tes.htf_density'),
('csp.pt.tes.tc_fill_type'):
('tc_fill'),
('T_htf_hot_des'):
('TES_COPY_T_htf_hot_des'),
('csp.pt.tes.storage_type'):
('tes_type'),
('csp.pt.tes.tc_fill_type'):
('csp.pt.tes.tc_fill_sph'),
('tc_fill'):
('csp.pt.tes.tc_fill_dens') },
'Supercritical Carbon Dioxide Power Cycle': {
('dd_sco2_cycle_config'):
('sco2_cycle_config'),
('T_htf_hot_des'):
('SCO2_COPY_T_htf_hot_des'),
('design_eff'):
('SCO2_COPY_design_eff'),
('P_ref'):
('SCO2_COPY_P_ref') },
'Wind BOS': {
('sales_tax_rate'):
('sales_and_use_tax'),
('wind_farm_num_turbines'):
('access_road_entrances'),
('wind_farm_num_turbines'):
('weather_delay_days_sugg'),
('weather_delay_days_choice', 'weather_delay_days_input', 'wind_farm_num_turbines'):
('weather_delay_days'),
('farm_size_MW'):
('quantity_permanent_met_towers_sugg'),
('quantity_permanent_met_towers_choice', 'quantity_permanent_met_towers_input', 'farm_size_MW'):
('quantity_permanent_met_towers'),
('farm_size_MW'):
('quantity_test_met_towers_sugg'),
('quantity_test_met_towers_choice', 'quantity_test_met_towers_input', 'farm_size_MW'):
('quantity_test_met_towers'),
('wind_turbine_hub_ht'):
('hub_height'),
('wind_farm_num_turbines'):
('construction_time_sugg'),
('om_building_size_choice', 'om_building_size_input', 'farm_size_MW'):
('om_building_size'),
('crane_breakdowns_choice', 'crane_breakdowns_input', 'wind_farm_num_turbines'):
('crane_breakdowns'),
('farm_size_MW'):
('om_building_size_sugg'),
('construction_time_choice', 'construction_time_input', 'wind_farm_num_turbines'):
('construction_time'),
('wind_turbine_kw_rating', 'wind_turbine_rotor_diameter', 'wind_turbine_hub_ht', 'wind_farm_num_turbines', 'interconnect_voltage', 'distance_to_interconnect', 'site_terrain', 'turbine_layout', 'soil_condition', 'construction_time', 'om_building_size', 'quantity_test_met_towers', 'quantity_permanent_met_towers', 'weather_delay_days', 'crane_breakdowns', 'access_road_entrances', 'turbine_capital_cost', 'tower_top_mass', 'delivery_assist_required', 'pad_mount_transformer_required', 'new_switchyard_required', 'rock_trenching_required', 'mv_thermal_backfill', 'mv_overhead_collector', 'performance_bond', 'contingency', 'warranty_management', 'sales_and_use_tax', 'overhead', 'profit_margin', 'development_fee', 'turbine_transportation'):
('bos_total_budgeted_cost', 'transportation_cost', 'insurance_cost', 'engineering_cost', 'power_performance_cost', 'site_compound_security_cost', 'building_cost', 'transmission_cost', 'markup_cost', 'development_cost', 'access_roads_cost', 'foundation_cost', 'erection_cost', 'electrical_materials_cost', 'electrical_installation_cost', 'substation_cost', 'project_mgmt_cost'),
('wind_turbine_kw_rating'):
('machine_rating'),
('wind_farm_num_turbines'):
('number_of_turbines'),
('wind_turbine_rotor_diameter'):
('rotor_diameter'),
('bos_total_budgeted_cost', 'farm_size_MW'):
('bos_total_cost_per_kw'),
('wind_farm_num_turbines'):
('crane_breakdowns_sugg'),
('wind_farm_num_turbines', 'wind_turbine_kw_rating'):
('farm_size_MW') },
'PV System Design': {
('en_batt', 'batt_power_discharge_max'):
('batt_max_power'),
('subarray1_modules_per_string', 'subarray1_nstrings'):
('subarray1_nmodules'),
('en_batt', 'batt_ac_or_dc', 'system_capacity', 'batt_max_power', 'total_inverter_capacity', 'module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_ref_voc', 'sd11par_Voc0', 'mppt_low_inverter', 'mppt_hi_inverter', 'subarray1_string_voc', 'subarray2_enable', 'subarray2_string_voc', 'subarray3_enable', 'subarray3_string_voc', 'subarray4_enable', 'subarray4_string_voc', 'subarray1_string_vmp', 'subarray2_string_vmp', 'subarray3_string_vmp', 'subarray4_string_vmp', 'vdcmax_inverter'):
('layout_warning'),
('module_model', 'spe_area', 'cec_area', '6par_area', 'snl_area', 'sd11par_area', 'subarray1_modules_per_string', 'subarray1_nstrings', 'subarray1_gcr', 'subarray2_enable', 'subarray2_modules_per_string', 'subarray2_nstrings', 'subarray2_gcr', 'subarray3_enable', 'subarray3_modules_per_string', 'subarray3_nstrings', 'subarray3_gcr', 'subarray4_enable', 'subarray4_modules_per_string', 'subarray4_nstrings', 'subarray4_gcr'):
('total_land_area'),
('total_area'):
('array_area'),
('subarray1_nstrings', 'subarray2_enable', 'subarray2_nstrings', 'subarray3_enable', 'subarray3_nstrings', 'subarray4_enable', 'subarray4_nstrings'):
('num_strings_total'),
('subarray2_enable', 'subarray2_modules_per_string', 'subarray2_nstrings'):
('subarray2_nmodules'),
('module_model', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_voco', 'sd11par_Voc0', 'subarray3_modules_per_string'):
('subarray3_string_voc'),
('inverter_model', 'inv_snl_mppt_hi', 'inv_ds_mppt_hi', 'inv_pd_mppt_hi', 'inv_cec_cg_mppt_hi'):
('mppt_hi_inverter'),
('subarray4_enable', 'subarray4_modules_per_string', 'subarray4_nstrings'):
('subarray4_nmodules'),
('inverter_model', 'inv_snl_vdcmax', 'inv_ds_vdcmax', 'inv_pd_vdcmax', 'inv_cec_cg_vdcmax'):
('vdcmax_inverter'),
('module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'subarray1_modules_per_string'):
('subarray1_string_vmp'),
('inverter_model', 'inv_snl_mppt_low', 'inv_ds_mppt_low', 'inv_pd_mppt_low', 'inv_cec_cg_mppt_low'):
('mppt_low_inverter'),
('module_model', 'spe_power', 'cec_p_mp_ref', '6par_pmp', 'snl_ref_pmp', 'sd11par_Pmp0', 'total_modules'):
('system_capacity'),
('inverter_model', 'inv_snl_pdco', 'inv_ds_pdco', 'inv_pd_pdco', 'inv_cec_cg_pdco', 'inverter_count'):
('total_dc_inverter_capacity'),
('module_model', 'spe_area', 'cec_area', '6par_area', 'snl_area', 'sd11par_area', 'total_modules'):
('total_area'),
('module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'subarray4_modules_per_string'):
('subarray4_string_vmp'),
('module_model', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_voco', 'sd11par_Voc0', 'subarray1_modules_per_string'):
('subarray1_string_voc'),
('module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'subarray2_modules_per_string'):
('subarray2_string_vmp'),
('subarray2_enable', 'subarray3_enable', 'subarray4_enable'):
('num_enabled'),
('inverter_model', 'inv_snl_paco', 'inv_ds_paco', 'inv_pd_paco', 'inv_cec_cg_paco', 'inverter_count'):
('total_inverter_capacity'),
('module_model', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_voco', 'sd11par_Voc0', 'subarray4_modules_per_string'):
('subarray4_string_voc'),
('enable_auto_size', 'module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_ref_voc', 'sd11par_Voc0', 'spe_power', 'cec_p_mp_ref', '6par_pmp', 'snl_ref_pmp', 'sd11par_Pmp0', 'inverter_model', 'inv_snl_mppt_low', 'inv_ds_mppt_low', 'inv_pd_mppt_low', 'inv_cec_cg_mppt_low', 'inv_snl_vdcmax', 'inv_ds_vdcmax', 'inv_pd_vdcmax', 'inv_cec_cg_vdcmax', 'inv_snl_mppt_hi', 'inv_ds_mppt_hi', 'inv_pd_mppt_hi', 'inv_cec_cg_mppt_hi', 'inv_snl_paco', 'inv_ds_paco', 'inv_pd_paco', 'inv_cec_cg_paco', 'en_batt', 'batt_ac_or_dc', 'batt_max_power', 'desired_size', 'desired_dcac_ratio'):
('subarray2_enable', 'subarray3_enable', 'subarray4_enable', 'subarray1_modules_per_string', 'subarray1_nstrings', 'inverter_count'),
('system_capacity', 'total_inverter_capacity'):
('calculated_dcac_ratio'),
('module_model', 'spe_voc', 'cec_v_oc_ref', '6par_voc', 'snl_voco', 'sd11par_Voc0', 'subarray2_modules_per_string'):
('subarray2_string_voc'),
('total_area'):
('total_module_area'),
('subarray1_modules_per_string', 'subarray1_nstrings', 'subarray2_modules_per_string', 'subarray2_nstrings', 'subarray2_enable', 'subarray3_modules_per_string', 'subarray3_nstrings', 'subarray3_enable', 'subarray4_modules_per_string', 'subarray4_nstrings', 'subarray4_enable'):
('total_modules'),
('inverter_model', 'inv_snl_num_mppt', 'inv_ds_num_mppt', 'inv_pd_num_mppt', 'inv_cec_cg_num_mppt'):
('inv_num_mppt'),
('subarray3_enable', 'subarray3_modules_per_string', 'subarray3_nstrings'):
('subarray3_nmodules'),
('module_model', 'spe_vmp', 'cec_v_mp_ref', '6par_vmp', 'snl_ref_vmp', 'sd11par_Vmp0', 'subarray3_modules_per_string'):
('subarray3_string_vmp') },
'Biopower Plant Specifications': {
('biopwr.plant.nameplate'):
('system_capacity'),
('biopwr.plant.disp9.power', 'biopwr.plant.disp8.power', 'biopwr.plant.disp7.power', 'biopwr.plant.disp6.power', 'biopwr.plant.disp5.power', 'biopwr.plant.disp4.power', 'biopwr.plant.disp3.power', 'biopwr.plant.disp2.power', 'biopwr.plant.disp1.power'):
('biopwr.plant.disp.power'),
('biopwr.plant.boiler.flue_temp'):
('biopwr.plant.boiler.moisture_enth_out'),
('biopwr.plant.boiler.steam_produced', 'biopwr.plant.boiler.num', 'biopwr.plant.boiler.over_design'):
('biopwr.plant.boiler.cap_per_boiler'),
('biopwr.plant.drying_spec_wet'):
('biopwr.plant.drying_spec'),
():
('biopwr.plant.boiler.ref_temp'),
('biopwr.plant.boiler.air_feed', 'biopwr.feedstock.total'):
('biopwr.plant.par_air_blower'),
('biopwr.plant.boiler.steam_grade'):
('biopwr.plant.boiler.steam_pressure'),
('biopwr.plant.par_percent', 'biopwr.plant.nameplate'):
('biopwr.plant.par'),
('biopwr.feedstock.total', 'biopwr.feedstock.total_hhv', 'biopwr.plant.boiler.efficiency', 'biopwr.plant.boiler.steam_enthalpy'):
('biopwr.plant.boiler.steam_produced'),
():
('biopwr.plant.eff.rad_loss'),
('biopwr.plant.tou_option', 'biopwr.plant.ramp_opt', 'biopwr.plant.ramp_opt1', 'biopwr.plant.nameplate', 'biopwr.plant.ramp_opt2'):
('biopwr.plant.ramp_rate'),
('biopwr.plant.boiler.moisture_in_fuel', 'biopwr.plant.boiler.moisture_enth_out', 'biopwr.plant.boiler.moisture_enth_in'):
('biopwr.plant.eff.moisture_loss'),
('biopwr.plant.drying_method', 'biopwr.feedstock.total_moisture', 'biopwr.feedstock.total_hhv', 'biopwr.feedstock.bagasse_frac', 'biopwr.feedstock.barley_frac', 'biopwr.feedstock.stover_frac', 'biopwr.feedstock.rice_frac', 'biopwr.feedstock.wheat_frac', 'biopwr.feedstock.forest_frac', 'biopwr.feedstock.mill_frac', 'biopwr.feedstock.urban_frac', 'biopwr.feedstock.feedstock1_frac', 'biopwr.feedstock.feedstock2_frac', 'biopwr.feedstock.bit_frac', 'biopwr.feedstock.subbit_frac', 'biopwr.feedstock.lig_frac', 'biopwr.feedstock.total_coal_moisture', 'biopwr.plant.drying_spec'):
('biopwr.plant.boiler.moisture_in_fuel'),
('biopwr.plant.boiler.steam_grade'):
('biopwr.plant.boiler.steam_enthalpy'),
('biopwr.feedstock.total_h', 'biopwr.feedstock.total_hhv', 'biopwr.plant.boiler.moisture_enth_out', 'biopwr.plant.boiler.moisture_enth_in'):
('biopwr.plant.eff.latent'),
('biopwr.plant.boiler.ref_temp'):
('biopwr.plant.boiler.moisture_enth_in'),
('biopwr.plant.eff.flue_loss', 'biopwr.plant.eff.fuel_loss', 'biopwr.plant.eff.moisture_loss', 'biopwr.plant.eff.rad_loss', 'biopwr.plant.eff.latent'):
('biopwr.plant.boiler.efficiency'),
('biopwr.plant.boiler.steam_grade'):
('biopwr.plant.boiler.steam_temp'),
('biopwr.plant.boiler.cap_per_boiler', 'biopwr.plant.boiler.num', 'biopwr.plant.boiler.steam_enthalpy', 'biopwr.plant.rated_eff'):
('biopwr.plant.nameplate'),
():
('biopwr.plant.boiler.bfw_enthalpy'),
('biopwr.plant.boiler.air_feed', 'biopwr.plant.boiler.flue_temp', 'biopwr.plant.boiler.ref_temp'):
('biopwr.plant.eff.flue_loss'),
('biopwr.plant.combustor_type', 'biopwr.feedstock.total_c', 'biopwr.plant.boiler.excess_air', 'biopwr.feedstock.total_h', 'biopwr.feedstock.total_o', 'biopwr.feedstock.total_ash', 'biopwr.feedstock.total_hhv'):
('biopwr.plant.boiler.air_feed'),
('biopwr.plant.combustor_type'):
('biopwr.plant.eff.fuel_loss'),
('biopwr.plant.boiler.steam_pressure', 'biopwr.plant.boiler.cap_per_boiler', 'biopwr.plant.boiler.num', 'biopwr.plant.par_air_blower'):
('biopwr.plant.par_bfw_pump') },
'Dish Capital Costs': {
():
('system_use_recapitalization'),
():
('system_use_lifetime_output'),
('total_installed_cost', 'csp.ds.cost.nameplate'):
('csp.ds.cost.installed_per_capacity'),
('csp.ds.cost.epc.per_acre', 'csp.ds.cost.total_land_area', 'csp.ds.cost.epc.percent', 'total_direct_cost', 'csp.ds.cost.nameplate', 'csp.ds.cost.epc.per_watt', 'csp.ds.cost.epc.fixed'):
('csp.ds.cost.epc.total'),
('csp.ds.total_capacity'):
('csp.ds.cost.nameplate'),
('csp.ds.ncollectors', 'csp.ds.cost.collector.area', 'csp.ds.cost.collector.cost_per_m2'):
('csp.ds.cost.collector'),
('csp.ds.field_area'):
('csp.ds.cost.site_improvements.area'),
('csp.ds.cost.site_improvements.area', 'csp.ds.cost.site_improvements.cost_per_m2'):
('csp.ds.cost.site_improvements'),
('csp.ds.cost.site_improvements', 'csp.ds.cost.collector', 'csp.ds.cost.receiver', 'csp.ds.cost.engine', 'csp.ds.cost.contingency'):
('total_direct_cost'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('A_proj'):
('csp.ds.cost.collector.area'),
('csp.ds.nameplate_capacity'):
('csp.ds.cost.engine.kw'),
('csp.ds.field_area'):
('csp.ds.cost.total_land_area'),
('csp.ds.ncollectors', 'csp.ds.cost.receiver.kw', 'csp.ds.cost.receiver.cost_per_kw'):
('csp.ds.cost.receiver'),
('csp.ds.cost.plm.per_acre', 'csp.ds.cost.total_land_area', 'csp.ds.cost.plm.percent', 'total_direct_cost', 'csp.ds.cost.nameplate', 'csp.ds.cost.plm.per_watt', 'csp.ds.cost.plm.fixed'):
('csp.ds.cost.plm.total'),
('csp.ds.cost.epc.total', 'csp.ds.cost.plm.total', 'csp.ds.cost.sales_tax.total'):
('total_indirect_cost'),
('csp.ds.nameplate_capacity'):
('csp.ds.cost.receiver.kw'),
('csp.ds.cost.contingency_percent', 'csp.ds.cost.site_improvements', 'csp.ds.cost.collector', 'csp.ds.cost.receiver', 'csp.ds.cost.engine'):
('csp.ds.cost.contingency'),
('csp.ds.ncollectors', 'csp.ds.cost.engine.kw', 'csp.ds.cost.engine.cost_per_kw'):
('csp.ds.cost.engine'),
('sales_tax_rate'):
('csp.ds.cost.sales_tax.value'),
('csp.ds.cost.sales_tax.value', 'total_direct_cost', 'csp.ds.cost.sales_tax.percent'):
('csp.ds.cost.sales_tax.total') },
'Rankine Cycle': {
('csp.pt.pwrb.pressure_mode'):
('tech_type'),
('csp.pt.pwrb.condenser_type'):
('CT') },
'Solar Resource Data': {
('solar_resource_file'):
('file_name'),
('use_specific_weather_file', 'user_specified_weather_file', 'solar_data_file_name'):
('solar_resource_file') },
'Generic System Costs': {
('system_capacity', 'genericsys.cost.per_watt'):
('genericsys.cost.plant_scaled'),
('genericsys.cost.plm.fixed', 'genericsys.cost.plm.nonfixed'):
('genericsys.cost.plm.total'),
('system_use_lifetime_output'):
('system_use_recapitalization'),
('genericsys.cost.epc.fixed', 'genericsys.cost.epc.nonfixed'):
('genericsys.cost.epc.total'),
('total_direct_cost', 'genericsys.cost.plm.percent'):
('genericsys.cost.plm.nonfixed'),
('fixed_plant_input'):
('genericsys.cost.plant'),
('genericsys.cost.contingency', 'genericsys.cost.plant', 'genericsys.cost.plant_scaled', 'battery_total'):
('total_direct_cost'),
('genericsys.cost.contingency_percent', 'genericsys.cost.plant', 'genericsys.cost.plant_scaled', 'battery_total'):
('genericsys.cost.contingency'),
('en_batt', 'batt_power_discharge_max'):
('battery_power'),
('total_direct_cost', 'genericsys.cost.epc.percent'):
('genericsys.cost.epc.nonfixed'),
('sales_tax_rate'):
('genericsys.cost.sales_tax.value'),
('genericsys.cost.sales_tax.value', 'total_direct_cost', 'genericsys.cost.sales_tax.percent'):
('genericsys.cost.sales_tax.total'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('total_installed_cost', 'system_capacity'):
('genericsys.cost.installed_per_capacity'),
('battery_energy', 'battery_per_kWh', 'battery_power', 'battery_per_kW'):
('battery_total'),
('genericsys.cost.epc.total', 'genericsys.cost.plm.total', 'genericsys.cost.sales_tax.total'):
('total_indirect_cost'),
('en_batt', 'batt_computed_bank_capacity'):
('battery_energy'),
('system_capacity'):
('nameplate_capacity') },
'Biopower Feedstock': {
():
('biopwr.feedstock.subbit_c'),
():
('biopwr.feedstock.mill_hhv'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstock.bagasse_lhv', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstock.barley_lhv', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstock.stover_lhv', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstock.rice_lhv', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstock.wheat_lhv', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstock.forest_lhv', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstock.mill_lhv', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstock.urban_lhv', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstock.woody_lhv', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstock.herb_lhv', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstock.feedstock1_hhv', 'biopwr.feedstock.feedstock1_h', 'biopwr.feedstock.feedstock2_biomass_frac', 'biopwr.feedstock.feedstock2_hhv', 'biopwr.feedstock.feedstock2_h'):
('biopwr.feedstock.total_biomass_lhv'),
('biopwr.feedstock.additional_opt', 'biopwr.feedstock.feedstock2_resource', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.feedstock2_biomass_frac'),
():
('biopwr.feedstock.wheat_o'),
():
('biopwr.feedstock.bit_c'),
('biopwr.feedstock.rice_moisture_wet'):
('biopwr.feedstock.rice_moisture'),
('biopwr.feedstock.stover_moisture_wet'):
('biopwr.feedstock.stover_usual_moisture'),
():
('biopwr.feedstock.rice_hhv'),
():
('biopwr.feedstock.lig_ash'),
():
('biopwr.feedstock.herb_o'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.total_biomass', 'biopwr.feedstock.total'):
('biopwr.feedstock.biomass_frac'),
():
('biopwr.feedstock.urban_o'),
('biopwr.feedstock.wheat_resource', 'biopwr.feedstock.wheat_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.wheat_frac'),
('biopwr.feedstock.woody_moisture_wet'):
('biopwr.feedstock.woody_usual_moisture'),
('biopwr.feedstock.herb_resource', 'biopwr.feedstock.herb_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.herb_biomass_frac'),
('biopwr.feedstock.herb_moisture_wet'):
('biopwr.feedstock.herb_usual_moisture'),
():
('biopwr.feedstock.wheat_h'),
('biopwr.feedstock.lig_moisture_wet'):
('biopwr.feedstock.lig_usual_moisture'),
('biopwr.feedstock.feedstock2_moisture'):
('biopwr.feedstock.feedstock2_usual_moisture'),
():
('biopwr.feedstock.barley_hhv'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.lig_resource', 'biopwr.feedstock.total_coal'):
('biopwr.feedstock.lig_coal_frac'),
():
('biopwr.feedstock.bagasse_c'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_resource', 'biopwr.feedstock.subbit_resource', 'biopwr.feedstock.lig_resource'):
('biopwr.feedstock.total_coal'),
('biopwr.feedstock.stover_moisture_wet'):
('biopwr.feedstock.stover_moisture'),
():
('biopwr.feedstock.stover_hhv'),
():
('biopwr.feedstock.herb_h'),
('biopwr.feedstock.feedstock2_opt', 'biopwr.feedstock.feedstock2_user_hhv', 'biopwr.feedstock.feedstock2_calc_hhv'):
('biopwr.feedstock.feedstock2_hhv'),
('biopwr.feedstock.barley_resource', 'biopwr.feedstock.barley_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.barley_biomass_frac'),
('biopwr.feedstock.subbit_moisture_wet'):
('biopwr.feedstock.subbit_moisture'),
():
('biopwr.feedstock.barley_c'),
():
('biopwr.feedstock.urban_h'),
('biopwr.feedstock.stover_resource', 'biopwr.feedstock.stover_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.stover_biomass_frac'),
():
('biopwr.feedstock.subbit_h'),
('biopwr.feedstock.forest_moisture_wet'):
('biopwr.feedstock.forest_usual_moisture'),
():
('biopwr.feedstock.barley_o'),
():
('biopwr.feedstock.woody_ash'),
('biopwr.feedstock.mill_moisture_wet'):
('biopwr.feedstock.mill_moisture'),
():
('biopwr.feedstock.forest_lhv'),
():
('biopwr.feedstock.woody_c'),
('biopwr.feedstock.feedstock1_c', 'biopwr.feedstock.feedstock1_h', 'biopwr.feedstock.feedstock1_n'):
('biopwr.feedstock.feedstock1_calc_hhv'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.subbit_resource', 'biopwr.feedstock.total'):
('biopwr.feedstock.subbit_frac'),
():
('biopwr.feedstock.mill_c'),
('biopwr.feedstock.bagasse_moisture_wet'):
('biopwr.feedstock.bagasse_moisture'),
():
('biopwr.feedstock.stover_ash'),
('biopwr.feedstock.forest_moisture_wet'):
('biopwr.feedstock.forest_moisture'),
('biopwr.feedstock.feedstock1_c', 'biopwr.feedstock.feedstock1_h', 'biopwr.feedstock.feedstock1_n'):
('biopwr.feedstock.feedstock1_o'),
('biopwr.feedstock.wheat_resource', 'biopwr.feedstock.wheat_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.wheat_biomass_frac'),
('biopwr.feedstock.feedstock2_c', 'biopwr.feedstock.feedstock2_h', 'biopwr.feedstock.feedstock2_n'):
('biopwr.feedstock.feedstock2_o'),
('biopwr.feedstock.rice_resource', 'biopwr.feedstock.rice_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.rice_frac'),
():
('biopwr.feedstock.wheat_hhv'),
('biopwr.feedstock.biomass_frac', 'biopwr.feedstock.total_biomass_hhv', 'biopwr.feedstock.coal_frac', 'biopwr.feedstock.total_coal_hhv'):
('biopwr.feedstock.total_hhv'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_coal_frac', 'biopwr.feedstock.bit_hhv', 'biopwr.feedstock.subbit_coal_frac', 'biopwr.feedstock.subbit_hhv', 'biopwr.feedstock.lig_coal_frac', 'biopwr.feedstock.lig_hhv'):
('biopwr.feedstock.total_coal_hhv'),
('biopwr.feedstock.additional_opt', 'biopwr.feedstock.feedstock1_resource', 'biopwr.feedstock.total'):
('biopwr.feedstock.feedstock1_frac'),
('biopwr.feedstock.subbit_moisture_wet'):
('biopwr.feedstock.subbit_usual_moisture'),
():
('biopwr.feedstock.woody_o'),
('biopwr.feedstock.bagasse_frac', 'biopwr.feedstock.bagasse_moisture', 'biopwr.feedstock.barley_frac', 'biopwr.feedstock.barley_moisture', 'biopwr.feedstock.stover_frac', 'biopwr.feedstock.stover_moisture', 'biopwr.feedstock.rice_frac', 'biopwr.feedstock.rice_moisture', 'biopwr.feedstock.wheat_frac', 'biopwr.feedstock.wheat_moisture', 'biopwr.feedstock.forest_frac', 'biopwr.feedstock.forest_moisture', 'biopwr.feedstock.mill_frac', 'biopwr.feedstock.mill_moisture', 'biopwr.feedstock.urban_frac', 'biopwr.feedstock.urban_moisture', 'biopwr.feedstock.woody_frac', 'biopwr.feedstock.woody_moisture', 'biopwr.feedstock.herb_frac', 'biopwr.feedstock.herb_moisture', 'biopwr.feedstock.feedstock1_frac', 'biopwr.feedstock.feedstock1_moisture', 'biopwr.feedstock.feedstock2_frac', 'biopwr.feedstock.feedstock2_moisture', 'biopwr.feedstock.bit_frac', 'biopwr.feedstock.bit_moisture', 'biopwr.feedstock.subbit_frac', 'biopwr.feedstock.subbit_moisture', 'biopwr.feedstock.lig_frac', 'biopwr.feedstock.lig_moisture'):
('biopwr.feedstock.total_moisture'),
('biopwr.feedstock.additional_opt', 'biopwr.feedstock.feedstock1_resource', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.feedstock1_biomass_frac'),
():
('biopwr.feedstock.subbit_ash'),
('biopwr.feedstock.barley_moisture_wet'):
('biopwr.feedstock.barley_usual_moisture'),
():
('biopwr.feedstock.rice_ash'),
('biopwr.feedstock.rice_h'):
('biopwr.feedstock.rice_lhv'),
():
('biopwr.feedstock.herb_hhv'),
('biopwr.feedstock.bagasse_resource', 'biopwr.feedstock.bagasse_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.bagasse_frac'),
():
('biopwr.feedstock.wheat_ash'),
('biopwr.feedstock.rice_resource', 'biopwr.feedstock.rice_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.rice_biomass_frac'),
():
('biopwr.feedstock.herb_c'),
():
('biopwr.feedstock.bit_o'),
('biopwr.feedstock.lig_moisture_wet'):
('biopwr.feedstock.lig_moisture'),
('biopwr.feedstock.biomass_frac', 'biopwr.feedstock.total_biomass_ash', 'biopwr.feedstock.coal_frac', 'biopwr.feedstock.total_coal_ash'):
('biopwr.feedstock.total_ash'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_resource', 'biopwr.feedstock.total_coal'):
('biopwr.feedstock.bit_coal_frac'),
('biopwr.feedstock.total_coal_hhv'):
('biopwr.feedstock.total_coal_hhv_avg'),
('biopwr.feedstock.bagasse_h'):
('biopwr.feedstock.bagasse_lhv'),
():
('biopwr.feedstock.woody_hhv'),
():
('biopwr.feedstock.bit_h'),
('biopwr.feedstock.feedstock2_c', 'biopwr.feedstock.feedstock2_h', 'biopwr.feedstock.feedstock2_n'):
('biopwr.feedstock.feedstock2_calc_hhv'),
():
('biopwr.feedstock.stover_o'),
('biopwr.feedstock.additional_opt', 'biopwr.feedstock.feedstock2_resource', 'biopwr.feedstock.total'):
('biopwr.feedstock.feedstock2_frac'),
('biopwr.feedstock.wheat_moisture_wet'):
('biopwr.feedstock.wheat_moisture'),
('biopwr.feedstock.barley_resource', 'biopwr.feedstock.barley_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.barley_frac'),
('biopwr.feedstock.bagasse_frac', 'biopwr.feedstock.bagasse_h', 'biopwr.feedstock.barley_frac', 'biopwr.feedstock.barley_h', 'biopwr.feedstock.stover_frac', 'biopwr.feedstock.stover_h', 'biopwr.feedstock.rice_frac', 'biopwr.feedstock.rice_h', 'biopwr.feedstock.wheat_frac', 'biopwr.feedstock.wheat_h', 'biopwr.feedstock.forest_frac', 'biopwr.feedstock.forest_h', 'biopwr.feedstock.mill_frac', 'biopwr.feedstock.mill_h', 'biopwr.feedstock.urban_frac', 'biopwr.feedstock.urban_h', 'biopwr.feedstock.woody_frac', 'biopwr.feedstock.woody_h', 'biopwr.feedstock.herb_frac', 'biopwr.feedstock.herb_h', 'biopwr.feedstock.feedstock1_frac', 'biopwr.feedstock.feedstock1_h', 'biopwr.feedstock.feedstock2_frac', 'biopwr.feedstock.feedstock2_h', 'biopwr.feedstock.bit_frac', 'biopwr.feedstock.bit_h', 'biopwr.feedstock.subbit_frac', 'biopwr.feedstock.subbit_h', 'biopwr.feedstock.lig_frac', 'biopwr.feedstock.lig_h'):
('biopwr.feedstock.total_h'),
():
('biopwr.feedstock.stover_lhv'),
():
('biopwr.feedstock.bagasse_ash'),
('biopwr.feedstock.wheat_moisture_wet'):
('biopwr.feedstock.wheat_usual_moisture'),
():
('biopwr.feedstock.forest_h'),
('biopwr.feedstock.woody_resource', 'biopwr.feedstock.woody_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.woody_biomass_frac'),
('biopwr.feedstock.bagasse_frac', 'biopwr.feedstock.bagasse_c', 'biopwr.feedstock.barley_frac', 'biopwr.feedstock.barley_c', 'biopwr.feedstock.stover_frac', 'biopwr.feedstock.stover_c', 'biopwr.feedstock.rice_frac', 'biopwr.feedstock.rice_c', 'biopwr.feedstock.wheat_frac', 'biopwr.feedstock.wheat_c', 'biopwr.feedstock.forest_frac', 'biopwr.feedstock.forest_c', 'biopwr.feedstock.mill_frac', 'biopwr.feedstock.mill_c', 'biopwr.feedstock.urban_frac', 'biopwr.feedstock.urban_c', 'biopwr.feedstock.woody_frac', 'biopwr.feedstock.woody_c', 'biopwr.feedstock.herb_frac', 'biopwr.feedstock.herb_c', 'biopwr.feedstock.feedstock1_frac', 'biopwr.feedstock.feedstock1_c', 'biopwr.feedstock.feedstock2_frac', 'biopwr.feedstock.feedstock2_c', 'biopwr.feedstock.bit_frac', 'biopwr.feedstock.bit_c', 'biopwr.feedstock.subbit_frac', 'biopwr.feedstock.subbit_c', 'biopwr.feedstock.lig_frac', 'biopwr.feedstock.lig_c'):
('biopwr.feedstock.total_c'),
('biopwr.feedstock.herb_moisture_wet'):
('biopwr.feedstock.herb_moisture'),
():
('biopwr.feedstock.rice_o'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstock.bagasse_hhv', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstock.barley_hhv', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstock.stover_hhv', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstock.rice_hhv', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstock.wheat_hhv', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstock.forest_hhv', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstock.mill_hhv', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstock.urban_hhv', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstock.woody_hhv', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstock.herb_hhv', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstock.feedstock1_hhv', 'biopwr.feedstock.feedstock2_biomass_frac', 'biopwr.feedstock.feedstock2_hhv'):
('biopwr.feedstock.total_biomass_hhv'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.lig_resource', 'biopwr.feedstock.total'):
('biopwr.feedstock.lig_frac'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_coal_frac', 'biopwr.feedstock.subbit_coal_frac', 'biopwr.feedstock.lig_coal_frac'):
('biopwr.feedstock.total_coal_lhv'),
('biopwr.feedstock.forest_resource', 'biopwr.feedstock.forest_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.forest_frac'),
():
('biopwr.feedstock.barley_ash'),
():
('biopwr.feedstock.stover_c'),
('biopwr.feedstock.bagasse_frac', 'biopwr.feedstock.bagasse_o', 'biopwr.feedstock.barley_frac', 'biopwr.feedstock.barley_o', 'biopwr.feedstock.stover_frac', 'biopwr.feedstock.stover_o', 'biopwr.feedstock.rice_frac', 'biopwr.feedstock.rice_o', 'biopwr.feedstock.wheat_frac', 'biopwr.feedstock.wheat_o', 'biopwr.feedstock.forest_frac', 'biopwr.feedstock.forest_o', 'biopwr.feedstock.mill_frac', 'biopwr.feedstock.mill_o', 'biopwr.feedstock.urban_frac', 'biopwr.feedstock.urban_o', 'biopwr.feedstock.woody_frac', 'biopwr.feedstock.woody_o', 'biopwr.feedstock.herb_frac', 'biopwr.feedstock.herb_o', 'biopwr.feedstock.feedstock1_frac', 'biopwr.feedstock.feedstock1_o', 'biopwr.feedstock.feedstock2_frac', 'biopwr.feedstock.feedstock2_o', 'biopwr.feedstock.bit_frac', 'biopwr.feedstock.bit_o', 'biopwr.feedstock.subbit_frac', 'biopwr.feedstock.subbit_o', 'biopwr.feedstock.lig_frac', 'biopwr.feedstock.lig_o'):
('biopwr.feedstock.total_o'),
():
('biopwr.feedstock.bit_ash'),
():
('biopwr.feedstock.bagasse_h'),
():
('biopwr.feedstock.mill_ash'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_coal_frac', 'biopwr.feedstock.bit_ash', 'biopwr.feedstock.subbit_coal_frac', 'biopwr.feedstock.subbit_ash', 'biopwr.feedstock.lig_coal_frac', 'biopwr.feedstock.lig_ash'):
('biopwr.feedstock.total_coal_ash'),
('biopwr.feedstock.barley_moisture_wet'):
('biopwr.feedstock.barley_moisture'),
():
('biopwr.feedstock.bagasse_o'),
():
('biopwr.feedstock.stover_h'),
():
('biopwr.feedstock.woody_lhv'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstock.bagasse_c', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstock.barley_c', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstock.stover_c', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstock.rice_c', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstock.wheat_c', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstock.forest_c', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstock.mill_c', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstock.urban_c', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstock.woody_c', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstock.herb_c', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstock.feedstock2_biomass_frac'):
('biopwr.feedstock.total_biomass_c'),
('biopwr.feedstock.rice_moisture_wet'):
('biopwr.feedstock.rice_usual_moisture'),
():
('biopwr.feedstock.wheat_lhv'),
('biopwr.feedstock.forest_resource', 'biopwr.feedstock.forest_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.forest_biomass_frac'),
():
('biopwr.feedstock.mill_o'),
('biopwr.feedstock.feedstock1_opt', 'biopwr.feedstock.feedstock1_user_hhv', 'biopwr.feedstock.feedstock1_calc_hhv'):
('biopwr.feedstock.feedstock1_hhv'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.total_coal'):
('biopwr.feedstock.total'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.subbit_resource', 'biopwr.feedstock.total_coal'):
('biopwr.feedstock.subbit_coal_frac'),
('biopwr.plant.nameplate'):
('biopwr.feedstock.total_nameplate'),
('biopwr.feedstock.stover_resource', 'biopwr.feedstock.stover_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.stover_frac'),
():
('biopwr.feedstock.forest_c'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.total_coal', 'biopwr.feedstock.total'):
('biopwr.feedstock.coal_frac'),
('biopwr.feedstock.feedstock1_moisture_wet'):
('biopwr.feedstock.feedstock1_moisture'),
('biopwr.feedstock.feedstock2_moisture'):
('biopwr.feedstock.feedstock1_usual_moisture'),
():
('biopwr.feedstock.lig_c'),
():
('biopwr.feedstock.rice_c'),
():
('biopwr.feedstock.bagasse_hhv'),
():
('biopwr.feedstock.barley_h'),
('biopwr.feedstock.urban_moisture_wet'):
('biopwr.feedstock.urban_usual_moisture'),
('biopwr.feedstock.total_biomass_hhv'):
('biopwr.feedstock.total_biomass_hhv_avg'),
():
('biopwr.feedstock.herb_ash'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_coal_frac', 'biopwr.feedstock.bit_moisture', 'biopwr.feedstock.subbit_coal_frac', 'biopwr.feedstock.subbit_moisture', 'biopwr.feedstock.lig_coal_frac', 'biopwr.feedstock.lig_moisture'):
('biopwr.feedstock.total_coal_moisture'),
('biopwr.feedstock.biomass_frac', 'biopwr.feedstock.total_biomass_lhv', 'biopwr.feedstock.coal_frac', 'biopwr.feedstock.total_coal_lhv'):
('biopwr.feedstock.total_lhv'),
():
('biopwr.feedstock.forest_ash'),
('biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstock.bagasse_moisture', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstock.barley_moisture', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstock.stover_moisture', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstock.rice_moisture', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstock.wheat_moisture', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstock.forest_moisture', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstock.mill_moisture', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstock.urban_moisture', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstock.woody_moisture', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstock.herb_moisture', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstock.feedstock1_moisture', 'biopwr.feedstock.feedstock2_biomass_frac', 'biopwr.feedstock.feedstock2_moisture'):
('biopwr.feedstock.total_biomass_moisture'),
('biopwr.feedstock.mill_resource', 'biopwr.feedstock.mill_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.mill_frac'),
():
('biopwr.feedstock.lig_o'),
():
('biopwr.feedstock.urban_lhv'),
('biopwr.feedstock.urban_moisture_wet'):
('biopwr.feedstock.urban_moisture'),
():
('biopwr.feedstock.urban_ash'),
('biopwr.feedstock.bagasse_resource', 'biopwr.feedstock.bagasse_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.bagasse_biomass_frac'),
():
('biopwr.feedstock.wheat_c'),
('biopwr.feedstock.bagasse_moisture_wet'):
('biopwr.feedstock.bagasse_usual_moisture'),
('biopwr.feedstock.mill_resource', 'biopwr.feedstock.mill_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.mill_biomass_frac'),
('biopwr.feedstock.herb_resource', 'biopwr.feedstock.herb_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.herb_frac'),
('biopwr.feedstock.herb_hhv', 'biopwr.feedstock.herb_h'):
('biopwr.feedstock.herb_lhv'),
():
('biopwr.feedstock.rice_h'),
():
('biopwr.feedstock.barley_lhv'),
('biopwr.feedstock.woody_resource', 'biopwr.feedstock.woody_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.woody_frac'),
():
('biopwr.feedstock.lig_h'),
('biopwr.feedstock.feedstock2_moisture_wet'):
('biopwr.feedstock.feedstock2_moisture'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_resource', 'biopwr.feedstock.total'):
('biopwr.feedstock.bit_frac'),
('biopwr.feedstock.additional_opt', 'biopwr.feedstock.bagasse_resource', 'biopwr.feedstock.bagasse_obtainable', 'biopwr.feedstock.barley_resource', 'biopwr.feedstock.barley_obtainable', 'biopwr.feedstock.stover_resource', 'biopwr.feedstock.stover_obtainable', 'biopwr.feedstock.rice_resource', 'biopwr.feedstock.rice_obtainable', 'biopwr.feedstock.wheat_resource', 'biopwr.feedstock.wheat_obtainable', 'biopwr.feedstock.forest_resource', 'biopwr.feedstock.forest_obtainable', 'biopwr.feedstock.mill_resource', 'biopwr.feedstock.mill_obtainable', 'biopwr.feedstock.urban_resource', 'biopwr.feedstock.urban_obtainable', 'biopwr.feedstock.woody_resource', 'biopwr.feedstock.woody_obtainable', 'biopwr.feedstock.herb_resource', 'biopwr.feedstock.herb_obtainable', 'biopwr.feedstock.feedstock1_resource', 'biopwr.feedstock.feedstock2_resource'):
('biopwr.feedstock.total_biomass'),
('biopwr.feedstock.bit_moisture_wet'):
('biopwr.feedstock.bit_moisture'),
('biopwr.feedstock.bit_moisture_wet'):
('biopwr.feedstock.bit_usual_moisture'),
():
('biopwr.feedstock.urban_hhv'),
('biopwr.feedstock.urban_resource', 'biopwr.feedstock.urban_obtainable', 'biopwr.feedstock.total'):
('biopwr.feedstock.urban_frac'),
():
('biopwr.feedstock.forest_hhv'),
():
('biopwr.feedstock.forest_o'),
():
('biopwr.feedstock.mill_lhv'),
():
('biopwr.feedstock.woody_h'),
('biopwr.feedstock.urban_resource', 'biopwr.feedstock.urban_obtainable', 'biopwr.feedstock.total_biomass'):
('biopwr.feedstock.urban_biomass_frac'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstock.bagasse_ash', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstock.barley_ash', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstock.stover_ash', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstock.rice_ash', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstock.wheat_ash', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstock.forest_ash', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstock.mill_ash', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstock.urban_ash', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstock.woody_ash', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstock.herb_ash', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstock.feedstock2_biomass_frac'):
('biopwr.feedstock.total_biomass_ash'),
('biopwr.feedstock.mill_moisture_wet'):
('biopwr.feedstock.mill_usual_moisture'),
():
('biopwr.feedstock.subbit_o'),
('biopwr.feedstock.woody_moisture_wet'):
('biopwr.feedstock.woody_moisture'),
():
('biopwr.feedstock.urban_c'),
():
('biopwr.feedstock.mill_h') },
'Financial Third Party Ownership': {
('real_discount_rate', 'inflation_rate'):
('nominal_discount_rate') },
'HCPV Module': {
('module_a0', 'module_a1', 'module_a2', 'module_a3', 'module_a4'):
('hcpv.module.mam_ref'),
('module_concentration', 'hcpv.module.rad1'):
('hcpv.module.rad1X'),
('hcpv.module.mjeff4', 'hcpv.module.mjeff3', 'hcpv.module.mjeff2', 'hcpv.module.mjeff1', 'hcpv.module.mjeff0'):
('module_mjeff'),
('module_reference', 'hcpv.module.mjeff0', 'hcpv.module.mjeff1', 'hcpv.module.mjeff2', 'hcpv.module.mjeff3', 'hcpv.module.mjeff4', 'module_optical_error', 'module_flutter_loss_coeff', 'module_alignment_error', 'hcpv.module.mam_ref'):
('hcpv.module.est_eff'),
('hcpv.module.rad4', 'hcpv.module.rad3', 'hcpv.module.rad2', 'hcpv.module.rad1', 'hcpv.module.rad0'):
('module_rad'),
('module_reference', 'hcpv.module.mjeff0', 'hcpv.module.rad0', 'hcpv.module.mjeff1', 'hcpv.module.rad1', 'hcpv.module.mjeff2', 'hcpv.module.rad2', 'hcpv.module.mjeff3', 'hcpv.module.rad3', 'hcpv.module.mjeff4', 'hcpv.module.rad4', 'hcpv.module.area', 'module_optical_error', 'module_flutter_loss_coeff', 'module_alignment_error', 'hcpv.module.mam_ref'):
('hcpv.module.power'),
('module_concentration', 'hcpv.module.rad3'):
('hcpv.module.rad3X'),
('module_concentration', 'hcpv.module.rad4'):
('hcpv.module.rad4X'),
('module_concentration', 'hcpv.module.rad0'):
('hcpv.module.rad0X'),
('module_concentration', 'hcpv.module.rad2'):
('hcpv.module.rad2X'),
('module_reference', 'hcpv.module.rad0', 'hcpv.module.rad1', 'hcpv.module.rad2', 'hcpv.module.rad3', 'hcpv.module.rad4', 'module_a', 'module_b', 'module_dT'):
('hcpv.module.cell_temp'),
('module_concentration', 'module_cell_area', 'module_ncells'):
('hcpv.module.area') },
'Battery Model Simple': {
():
('batt_simple_meter_position') },
'Physical Trough Receiver Type 4': {
('csp_dtr_hce_var1_field_fraction_4', 'csp_dtr_hce_var1_bellows_shadowing_4', 'csp_dtr_hce_var1_hce_dirt_4', 'csp_dtr_hce_var1_abs_abs_4', 'csp_dtr_hce_var1_env_trans_4', 'csp_dtr_hce_var2_field_fraction_4', 'csp_dtr_hce_var2_bellows_shadowing_4', 'csp_dtr_hce_var2_hce_dirt_4', 'csp_dtr_hce_var2_abs_abs_4', 'csp_dtr_hce_var2_env_trans_4', 'csp_dtr_hce_var3_field_fraction_4', 'csp_dtr_hce_var3_bellows_shadowing_4', 'csp_dtr_hce_var3_hce_dirt_4', 'csp_dtr_hce_var3_abs_abs_4', 'csp_dtr_hce_var3_env_trans_4', 'csp_dtr_hce_var4_field_fraction_4', 'csp_dtr_hce_var4_bellows_shadowing_4', 'csp_dtr_hce_var4_hce_dirt_4', 'csp_dtr_hce_var4_abs_abs_4', 'csp_dtr_hce_var4_env_trans_4'):
('csp_dtr_hce_optical_eff_4'),
('csp_dtr_hce_var1_field_fraction_4', 'csp_dtr_hce_var1_rated_heat_loss_4', 'csp_dtr_hce_var2_field_fraction_4', 'csp_dtr_hce_var2_rated_heat_loss_4', 'csp_dtr_hce_var3_field_fraction_4', 'csp_dtr_hce_var3_rated_heat_loss_4', 'csp_dtr_hce_var4_field_fraction_4', 'csp_dtr_hce_var4_rated_heat_loss_4'):
('csp_dtr_hce_design_heat_loss_4') },
'Physical Trough Collector Type 4': {
('csp_dtr_sca_tracking_error_4', 'csp_dtr_sca_geometry_effects_4', 'csp_dtr_sca_clean_reflectivity_4', 'csp_dtr_sca_mirror_dirt_4', 'csp_dtr_sca_general_error_4'):
('csp_dtr_sca_calc_sca_eff_4'),
('csp_dtr_sca_ave_focal_len_4', 'csp_dtr_sca_calc_theta_4', 'csp_dtr_sca_piping_dist_4'):
('csp_dtr_sca_calc_end_gain_4'),
('csp_dtr_sca_calc_zenith_4', 'tilt', 'azimuth'):
('csp_dtr_sca_calc_costh_4'),
('lat'):
('csp_dtr_sca_calc_latitude_4'),
('csp_dtr_sca_calc_costh_4'):
('csp_dtr_sca_calc_theta_4'),
('lat'):
('csp_dtr_sca_calc_zenith_4'),
('csp_dtr_sca_length_4', 'csp_dtr_sca_ncol_per_sca_4'):
('csp_dtr_sca_ap_length_4'),
('IAMs_4', 'csp_dtr_sca_calc_theta_4', 'csp_dtr_sca_calc_costh_4'):
('csp_dtr_sca_calc_iam_4'),
('csp_dtr_sca_ave_focal_len_4', 'csp_dtr_sca_calc_theta_4', 'nSCA', 'csp_dtr_sca_calc_end_gain_4', 'csp_dtr_sca_length_4', 'csp_dtr_sca_ncol_per_sca_4'):
('csp_dtr_sca_calc_end_loss_4') },
'Linear Fresnel Parasitics': {
('PB_fixed_par', 'demand_var'):
('csp.lf.par.fixed_total'),
('csp.lf.par.bop_val', 'csp.lf.par.bop_pf', 'csp.lf.par.bop_c0', 'csp.lf.par.bop_c1', 'csp.lf.par.bop_c2'):
('bop_array'),
('SCA_drives_elec', 'csp.lf.sf.dp.actual_aper'):
('csp.lf.par.tracking_total'),
('csp.lf.par.aux_val', 'csp.lf.par.aux_pf', 'csp.lf.par.aux_c0', 'csp.lf.par.aux_c1', 'csp.lf.par.aux_c2'):
('aux_array'),
('csp.lf.par.bop_val', 'csp.lf.par.bop_pf', 'csp.lf.par.bop_c0', 'csp.lf.par.bop_c1', 'csp.lf.par.bop_c2', 'demand_var'):
('csp.lf.par.bop_total'),
('csp.lf.par.aux_val', 'csp.lf.par.aux_pf', 'csp.lf.par.aux_c0', 'csp.lf.par.aux_c1', 'csp.lf.par.aux_c2', 'demand_var'):
('csp.lf.par.aux_total') },
'ISCC Molten Salt Tower Receiver': {
('piping_length', 'piping_loss'):
('piping_loss_tot'),
('THT', 'piping_length_mult', 'piping_length_const'):
('piping_length'),
('N_panels'):
('n_flux_x'),
():
('tower_technology'),
():
('conv_forced'),
('THT'):
('h_tower'),
('h_rec_panel', 'csp.pt.rec.cav_lip_height_ratio'):
('csp.pt.rec.cav_lip_height'),
('D_rec', 'H_rec'):
('rec_aspect'),
():
('rec_angle'),
():
('h_wind_meas'),
():
('eps_wavelength'),
():
('conv_wind_dir'),
():
('n_flux_y'),
():
('conv_coupled'),
('T_htf_cold_des', 'T_htf_hot_des'):
('csp.pt.rec.htf_t_avg'),
('csp.pt.rec.htf_type', 'csp.pt.rec.htf_t_avg', 'field_fl_props'):
('csp.pt.rec.htf_c_avg'),
('csp.pt.rec.max_flow_to_rec'):
('m_dot_htf_max'),
('solarm', 'q_pb_design'):
('Q_rec_des'),
('csp.pt.rec.cav_ap_height'):
('csp.pt.rec.cav_panel_height'),
('rec_d_spec', 'csp.pt.rec.cav_ap_hw_ratio'):
('csp.pt.rec.cav_ap_height'),
():
('conv_model'),
('csp.pt.rec.max_oper_frac', 'Q_rec_des', 'csp.pt.rec.htf_c_avg', 'T_htf_hot_des', 'T_htf_cold_des'):
('csp.pt.rec.max_flow_to_rec'),
('csp.pt.rec.htf_type'):
('rec_htf'),
('csp.pt.rec.flow_pattern'):
('Flow_type'),
('field_fl_props'):
('user_fluid'),
('csp.pt.rec.material_type'):
('mat_tube') },
'Battery Current and Capacity': {
('batt_Qexp_percent', 'batt_Qfull', 'batt_Qnom_percent', 'batt_computed_bank_capacity', 'batt_computed_voltage'):
('batt_Qexp', 'batt_Qnom', 'batt_Qfull_flow'),
('batt_computed_strings', 'LeadAcid_q10', 'batt_Qfull', 'LeadAcid_q20', 'LeadAcid_qn'):
('LeadAcid_q10_computed', 'LeadAcid_q20_computed', 'LeadAcid_qn_computed'),
('batt_size_choice', 'batt_chem', 'batt_bank_power', 'batt_bank_size', 'batt_bank_size_dc_ac', 'batt_dc_ac_efficiency', 'batt_bank_power_dc_ac', 'batt_Qfull', 'batt_bank_voltage', 'batt_Vnom_default', 'batt_bank_ncells_serial', 'batt_bank_nstrings', 'batt_C_rate_max_discharge_input', 'batt_C_rate_max_charge_input', 'batt_current_choice', 'batt_cell_power_discharge_max', 'batt_cell_current_discharge_max', 'batt_bank_nseries_stacks', 'batt_bank_size_specify', 'batt_cell_power_charge_max', 'batt_cell_current_charge_max'):
('batt_computed_voltage', 'batt_computed_series', 'batt_computed_strings', 'batt_num_cells', 'batt_computed_bank_capacity', 'batt_power_discharge_max', 'batt_power_charge_max', 'batt_time_capacity', 'batt_C_rate_max_charge', 'batt_C_rate_max_discharge', 'batt_current_charge_max', 'batt_current_discharge_max', 'batt_computed_stacks_series') },
'Geothermal Costs': {
('geotherm.cost.recap'):
('system_recapitalization_cost'),
():
('system_use_lifetime_output'),
('total_installed_cost'):
('geotherm.cost.total_installed_millions'),
('sales_tax_rate'):
('geotherm.cost.sales_tax.value'),
('geotherm.cost.prod_num_wells', 'geotherm.cost.inj_num_wells'):
('geotherm.cost.prod_inj_num_wells'),
('geotherm.cost.prod_cost_curve', 'resource_depth'):
('geotherm.cost.prod_per_well'),
('geotherm.cost.plm.fixed', 'geotherm.cost.plm.nonfixed'):
('geotherm.cost.plm.total'),
('geotherm.cost.inj_cost_curve', 'resource_depth'):
('geotherm.cost.inj_per_well'),
('geotherm.cost.plant_total.calc', 'geotherm.cost.plant_total.amount_specified', 'geotherm.cost.plant_total'):
('geotherm.cost.plant_total.amount'),
('geotherm.cost.conf_num_wells', 'geotherm.cost.confirm_wells_percent'):
('geotherm.cost.confirm_wells_num'),
('geotherm.cost.conf_per_well', 'geotherm.cost.conf_num_wells'):
('geotherm.cost.conf_drill'),
('pump_depth'):
('geotherm.cost.pump_depth'),
('geotherm.cost.contingency_percent', 'geotherm.cost.capital_total'):
('geotherm.cost.contingency'),
('geotherm.cost.inj_per_well', 'geotherm.cost.inj_num_wells'):
('geotherm.cost.inj_drill'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('gross_output'):
('geotherm.cost.plant_size'),
('geotherm.cost.surf_per_well', 'geotherm.cost.surf_num_wells'):
('geotherm.cost.surf_non_drill'),
('geotherm.cost.plant_auto_estimate', 'geotherm.cost.plant_per_kW_input', 'geotherm.cost.plant_size', 'geotherm.cost.plant_per_kW'):
('geotherm.cost.plant_total'),
('pump_size_hp'):
('geotherm.cost.pump_size'),
('geotherm.cost.inj_wells_drilled'):
('geotherm.cost.inj_num_wells'),
('total_installed_cost', 'geotherm.net_output'):
('geotherm.cost.installed_per_capacity'),
('geotherm.cost.stim_per_well', 'geotherm.cost.stim_num_wells'):
('geotherm.cost.stim_non_drill'),
('geotherm.cost.prod_drill', 'geotherm.cost.inj_drill'):
('geotherm.cost.prod_inj_drill'),
('geotherm.cost.surf_non_drill'):
('geotherm.cost.surf_total'),
('geotherm.cost.prod_wells_drilled'):
('geotherm.cost.prod_num_wells'),
('geotherm.cost.pump_per_foot', 'geotherm.cost.pump_depth'):
('geotherm.cost.pump_installation'),
('geotherm.cost.prod_req'):
('geotherm.cost.num_pumps'),
('geotherm.cost.epc.fixed', 'geotherm.cost.epc.nonfixed'):
('geotherm.cost.epc.total'),
('geotherm.cost.prod_inj_drill', 'geotherm.cost.prod_inj_non_drill'):
('geotherm.cost.prod_inj_total'),
('geotherm.cost.stim_non_drill'):
('geotherm.cost.stim_total'),
('geotherm.cost.prod_req', 'geotherm.cost.inj_num_wells'):
('geotherm.cost.stim_num_wells'),
('geotherm.cost.prod_req', 'geotherm.cost.confirm_wells_num'):
('geotherm.cost.prod_wells_drilled'),
('geotherm.cost.pump_per_hp', 'geotherm.cost.pump_size'):
('geotherm.cost.pump_per_pump'),
('geotherm.cost.prod_req', 'geotherm.cost.inj_num_wells'):
('geotherm.cost.surf_num_wells'),
('geotherm.cost.contingency', 'geotherm.cost.capital_total'):
('total_direct_cost'),
('geotherm.cost.pump_total_per_pump', 'geotherm.cost.num_pumps'):
('geotherm.cost.pumps_total'),
('geotherm.cost.drilling.calc', 'geotherm.cost.drilling.amount_specified', 'geotherm.cost.expl_total', 'geotherm.cost.conf_total', 'geotherm.cost.prod_inj_total', 'geotherm.cost.surf_total', 'geotherm.cost.stim_total'):
('geotherm.cost.drilling.amount'),
('geotherm.cost.recap_use_calc', 'geotherm.cost.recap_specified', 'geotherm.cost.conf_drill', 'geotherm.cost.prod_inj_drill', 'geotherm.cost.surf_total', 'geotherm.cost.pumps_total'):
('geotherm.cost.recap'),
('geotherm.cost.indirect.calc', 'geotherm.cost.indirect.amount_specified', 'geotherm.cost.epc.total', 'geotherm.cost.plm.total', 'geotherm.cost.sales_tax.total'):
('total_indirect_cost'),
('geotherm.cost.prod_req', 'geotherm.cost.inj_prod_well_ratio'):
('geotherm.cost.inj_wells_drilled'),
('geotherm.cost.pump_installation', 'geotherm.cost.pump_per_pump'):
('geotherm.cost.pump_total_per_pump'),
('total_direct_cost', 'geotherm.cost.plm.percent'):
('geotherm.cost.plm.nonfixed'),
('total_direct_cost', 'geotherm.cost.epc.percent'):
('geotherm.cost.epc.nonfixed'),
():
('system_use_recapitalization'),
('geotherm.cost.expl_per_well', 'geotherm.cost.expl_num_wells'):
('geotherm.cost.expl_drill'),
('geotherm.cost.expl_multiplier', 'geotherm.cost.prod_per_well'):
('geotherm.cost.expl_per_well'),
('geotherm.cost.pumping.calc', 'geotherm.cost.pumping.amount_specified', 'geotherm.cost.pumps_total'):
('geotherm.cost.pumping.amount'),
('geotherm.cost.conf_multiplier', 'geotherm.cost.prod_per_well'):
('geotherm.cost.conf_per_well'),
('geotherm.cost.drilling.amount', 'geotherm.cost.plant_total.amount', 'geotherm.cost.pumping.amount'):
('geotherm.cost.capital_total'),
('geotherm.cost.plant_auto_estimate', 'nameplate', 'resource_type', 'resource_temp', 'resource_depth', 'geothermal_analysis_period', 'model_choice', 'analysis_type', 'num_wells', 'conversion_type', 'plant_efficiency_input', 'conversion_subtype', 'decline_type', 'temp_decline_rate', 'temp_decline_max', 'wet_bulb_temp', 'ambient_pressure', 'well_flow_rate', 'pump_efficiency', 'delta_pressure_equip', 'excess_pressure_pump', 'well_diameter', 'casing_size', 'inj_well_diam', 'design_temp', 'specify_pump_work', 'specified_pump_work_amount', 'rock_thermal_conductivity', 'rock_specific_heat', 'rock_density', 'reservoir_pressure_change_type', 'reservoir_pressure_change', 'reservoir_width', 'reservoir_height', 'reservoir_permeability', 'inj_prod_well_distance', 'subsurface_water_loss', 'fracture_aperature', 'fracture_width', 'num_fractures', 'fracture_angle', 'hr_pl_nlev', 'geotherm.cost.plant_size'):
('geotherm.cost.plant_per_kW'),
('num_wells_getem'):
('geotherm.cost.prod_req'),
('geotherm.cost.prod_per_well', 'geotherm.cost.prod_num_wells'):
('geotherm.cost.prod_drill'),
('geotherm.cost.conf_drill', 'geotherm.cost.conf_non_drill'):
('geotherm.cost.conf_total'),
('geotherm.cost.sales_tax.value', 'total_direct_cost', 'geotherm.cost.sales_tax.percent'):
('geotherm.cost.sales_tax.total'),
('geotherm.cost.expl_drill', 'geotherm.cost.expl_non_drill'):
('geotherm.cost.expl_total') },
'Tower SolarPilot Capital Costs': {
('csp.pt.cost.heliostats_m2', 'site_spec_cost', 'heliostat_spec_cost', 'cost_sf_fixed', 'ui_tower_height', 'ui_receiver_height', 'ui_heliostat_height', 'tower_fixed_cost', 'tower_exp', 'csp.pt.cost.receiver.area', 'rec_ref_cost', 'rec_ref_area', 'rec_cost_exp', 'csp.pt.cost.storage_mwht', 'tes_spec_cost', 'csp.pt.cost.power_block_mwe', 'plant_spec_cost', 'bop_spec_cost', 'fossil_spec_cost', 'contingency_rate', 'csp.pt.cost.total_land_area', 'csp.pt.cost.nameplate', 'csp.pt.cost.epc.per_acre', 'csp.pt.cost.epc.percent', 'csp.pt.cost.epc.per_watt', 'csp.pt.cost.epc.fixed', 'land_spec_cost', 'csp.pt.cost.plm.percent', 'csp.pt.cost.plm.per_watt', 'csp.pt.cost.plm.fixed', 'sales_tax_frac', 'csp.pt.cost.sales_tax.value'):
('csp.pt.cost.site_improvements', 'csp.pt.cost.heliostats', 'csp.pt.cost.tower', 'csp.pt.cost.receiver', 'csp.pt.cost.storage', 'csp.pt.cost.power_block', 'csp.pt.cost.bop', 'csp.pt.cost.fossil', 'ui_direct_subtotal', 'csp.pt.cost.contingency', 'total_direct_cost', 'csp.pt.cost.epc.total', 'csp.pt.cost.plm.total', 'csp.pt.cost.sales_tax.total', 'total_indirect_cost', 'total_installed_cost', 'csp.pt.cost.installed_per_capacity'),
():
('system_use_lifetime_output'),
('sales_tax_rate'):
('csp.pt.cost.sales_tax.value'),
('P_ref', 'demand_var'):
('csp.pt.cost.power_block_mwe'),
('P_ref', 'design_eff', 'tshours'):
('csp.pt.cost.storage_mwht'),
('receiver_type', 'rec_height', 'D_rec', 'rec_d_spec', 'csp.pt.rec.cav_ap_height', 'd_rec'):
('csp.pt.cost.receiver.area'),
('helio_height'):
('ui_heliostat_height'),
('nameplate'):
('csp.pt.cost.nameplate'),
('receiver_type', 'rec_height', 'csp.pt.rec.cav_ap_height'):
('csp.pt.cost.rec_height'),
('rec_height'):
('ui_receiver_height'),
():
('system_use_recapitalization'),
('THT', 'h_tower'):
('ui_tower_height'),
('csp.pt.sf.total_land_area'):
('csp.pt.cost.total_land_area'),
('A_sf_UI'):
('csp.pt.cost.site_improvements_m2'),
('A_sf_UI'):
('csp.pt.cost.heliostats_m2') },
'Physical Trough Collector Header': {
('IAMs_1', 'IAMs_2', 'IAMs_3', 'IAMs_4'):
('IAM_matrix'),
('csp_dtr_sca_w_profile_1', 'csp_dtr_sca_w_profile_2', 'csp_dtr_sca_w_profile_3', 'csp_dtr_sca_w_profile_4', 'arr_collectors_in_loop', 'csp_dtr_sca_aperture_1', 'csp_dtr_sca_aperture_2', 'csp_dtr_sca_aperture_3', 'csp_dtr_sca_aperture_4', 'csp_dtr_sca_tracking_error_1', 'csp_dtr_sca_tracking_error_2', 'csp_dtr_sca_tracking_error_3', 'csp_dtr_sca_tracking_error_4', 'csp_dtr_sca_geometry_effects_1', 'csp_dtr_sca_geometry_effects_2', 'csp_dtr_sca_geometry_effects_3', 'csp_dtr_sca_geometry_effects_4', 'csp_dtr_sca_clean_reflectivity_1', 'csp_dtr_sca_clean_reflectivity_2', 'csp_dtr_sca_clean_reflectivity_3', 'csp_dtr_sca_clean_reflectivity_4', 'csp_dtr_sca_mirror_dirt_1', 'csp_dtr_sca_mirror_dirt_2', 'csp_dtr_sca_mirror_dirt_3', 'csp_dtr_sca_mirror_dirt_4', 'csp_dtr_sca_general_error_1', 'csp_dtr_sca_general_error_2', 'csp_dtr_sca_general_error_3', 'csp_dtr_sca_general_error_4', 'csp_dtr_sca_ave_focal_len_1', 'csp_dtr_sca_ave_focal_len_2', 'csp_dtr_sca_ave_focal_len_3', 'csp_dtr_sca_ave_focal_len_4', 'csp_dtr_sca_length_1', 'csp_dtr_sca_length_2', 'csp_dtr_sca_length_3', 'csp_dtr_sca_length_4', 'csp_dtr_sca_ap_length_1', 'csp_dtr_sca_ap_length_2', 'csp_dtr_sca_ap_length_3', 'csp_dtr_sca_ap_length_4', 'csp_dtr_sca_ncol_per_sca_1', 'csp_dtr_sca_ncol_per_sca_2', 'csp_dtr_sca_ncol_per_sca_3', 'csp_dtr_sca_ncol_per_sca_4', 'csp_dtr_sca_piping_dist_1', 'csp_dtr_sca_piping_dist_2', 'csp_dtr_sca_piping_dist_3', 'csp_dtr_sca_piping_dist_4'):
('W_aperture', 'max_collector_width', 'A_aperture', 'TrackingError', 'GeomEffects', 'Rho_mirror_clean', 'Dirt_mirror', 'Error', 'Ave_Focal_Length', 'L_SCA', 'L_aperture', 'ColperSCA', 'Distance_SCA'),
():
('nColt'),
('SCAInfoArray', 'nColt'):
('collectors_in_field', 'arr_collectors_in_loop') },
'Tower Capital Costs': {
('csp.pt.cost.heliostats_m2', 'csp.pt.cost.site_improvements_per_m2', 'csp.pt.cost.heliostats_per_m2', 'csp.pt.cost.fixed_sf', 'ui_tower_height', 'ui_receiver_height', 'ui_heliostat_height', 'csp.pt.cost.tower.fixed', 'csp.pt.cost.tower.scaling_exp', 'csp.pt.cost.receiver.area', 'csp.pt.cost.receiver.ref_cost', 'csp.pt.cost.receiver.ref_area', 'csp.pt.cost.receiver.scaling_exp', 'csp.pt.cost.storage_mwht', 'csp.pt.cost.storage_per_kwht', 'csp.pt.cost.power_block_mwe', 'csp.pt.cost.power_block_per_kwe', 'csp.pt.cost.bop_per_kwe', 'csp.pt.cost.fossil_per_kwe', 'csp.pt.cost.contingency_percent', 'csp.pt.cost.total_land_area', 'csp.pt.cost.nameplate', 'csp.pt.cost.epc.per_acre', 'csp.pt.cost.epc.percent', 'csp.pt.cost.epc.per_watt', 'csp.pt.cost.epc.fixed', 'csp.pt.cost.plm.per_acre', 'csp.pt.cost.plm.percent', 'csp.pt.cost.plm.per_watt', 'csp.pt.cost.plm.fixed', 'csp.pt.cost.sales_tax.percent', 'csp.pt.cost.sales_tax.value'):
('csp.pt.cost.site_improvements', 'csp.pt.cost.heliostats', 'csp.pt.cost.tower', 'csp.pt.cost.receiver', 'csp.pt.cost.storage', 'csp.pt.cost.power_block', 'csp.pt.cost.bop', 'csp.pt.cost.fossil', 'ui_direct_subtotal', 'csp.pt.cost.contingency', 'total_direct_cost', 'csp.pt.cost.epc.total', 'csp.pt.cost.plm.total', 'csp.pt.cost.sales_tax.total', 'total_indirect_cost', 'total_installed_cost', 'csp.pt.cost.installed_per_capacity'),
():
('system_use_lifetime_output'),
('sales_tax_rate'):
('csp.pt.cost.sales_tax.value'),
('P_ref', 'demand_var'):
('csp.pt.cost.power_block_mwe'),
('P_ref', 'design_eff', 'tshours'):
('csp.pt.cost.storage_mwht'),
('receiver_type', 'H_rec', 'D_rec', 'rec_d_spec', 'csp.pt.rec.cav_ap_height', 'd_rec'):
('csp.pt.cost.receiver.area'),
('helio_height'):
('ui_heliostat_height'),
('nameplate'):
('csp.pt.cost.nameplate'),
('receiver_type', 'H_rec', 'csp.pt.rec.cav_ap_height'):
('csp.pt.cost.rec_height'),
('H_rec'):
('ui_receiver_height'),
():
('system_use_recapitalization'),
('THT', 'h_tower'):
('ui_tower_height'),
('csp.pt.sf.total_land_area'):
('csp.pt.cost.total_land_area'),
('A_sf'):
('csp.pt.cost.site_improvements_m2'),
('A_sf'):
('csp.pt.cost.heliostats_m2') },
'PBNS Power Block': {
('nameplate'):
('system_capacity'),
('csp.pbns.condenser_type'):
('CT'),
('csp.pbns.fossil_mode_st', 'csp.pbns.fossil_mode_lf'):
('fossil_mode'),
('demand_var', 'eta_ref'):
('q_pb_des'),
('demand_var', 'csp.pbns.gross_net_conv_factor'):
('nameplate') },
'Tower Solar Field': {
():
('opt_flux_penalty'),
():
('opt_algorithm'),
('dni_des'):
('dni_des_calc'),
('csp.pt.cost.fossil_per_kwe'):
('fossil_spec_cost'),
('csp.pt.cost.sales_tax.percent'):
('sales_tax_frac'),
('csp.pt.cost.contingency_percent'):
('contingency_rate'),
('csp.pt.cost.storage_per_kwht'):
('tes_spec_cost'),
('csp.pt.cost.bop_per_kwe'):
('bop_spec_cost'),
('csp.pt.cost.heliostats_per_m2'):
('heliostat_spec_cost'),
('override_layout'):
('run_type'),
('csp.pt.cost.receiver.ref_cost'):
('rec_ref_cost'),
('helio_optical_error_mrad'):
('helio_optical_error'),
('helio_positions', 'c_atm_0', 'c_atm_1', 'c_atm_2', 'c_atm_3', 'THT'):
('c_atm_info'),
('csp.pt.cost.plm.per_acre'):
('land_spec_cost'),
():
('V_wind_10'),
('csp.pt.sf.fixed_land_area', 'land_area_base', 'csp.pt.sf.land_overhead_factor'):
('csp.pt.sf.total_land_area'),
('THT'):
('csp.pt.sf.tower_height'),
('A_sf'):
('helio_area_tot'),
('csp.pt.cost.site_improvements_per_m2'):
('site_spec_cost'),
('csp.pt.cost.receiver.ref_area'):
('rec_ref_area'),
('helio_width', 'helio_height', 'dens_mirror', 'n_hel'):
('A_sf'),
('csp.pt.cost.receiver.scaling_exp'):
('rec_cost_exp'),
():
('field_control'),
('csp.pt.cost.power_block_per_kwe'):
('plant_spec_cost'),
('csp.pt.cost.tower.scaling_exp'):
('tower_exp'),
('csp.pt.cost.fixed_sf'):
('cost_sf_fixed'),
('helio_optical_error_mrad'):
('error_equiv'),
('helio_positions'):
('n_hel'),
('land_max', 'THT'):
('land_max_calc'),
('H_rec'):
('rec_height'),
('override_opt'):
('is_optimize'),
('n_hel', 'csp.pt.sf.heliostat_area'):
('csp.pt.sf.total_reflective_area'),
('Q_rec_des'):
('q_design'),
('helio_height', 'helio_width', 'dens_mirror'):
('csp.pt.sf.heliostat_area'),
('land_min', 'THT'):
('land_min_calc'),
('csp.pt.cost.tower.fixed'):
('tower_fixed_cost') },
'Generic CSP Solar Field': {
('csp.gss.sf.wspd_loss_f3', 'csp.gss.sf.wspd_loss_f2', 'csp.gss.sf.wspd_loss_f1', 'csp.gss.sf.wspd_loss_f0'):
('f_v_wind_loss_des'),
('csp.gss.sf.wspd_loss_f3', 'csp.gss.sf.wspd_loss_f2', 'csp.gss.sf.wspd_loss_f1', 'csp.gss.sf.wspd_loss_f0'):
('sfhlV_coefs'),
('csp.gss.sf.ambt_loss_f3', 'csp.gss.sf.ambt_loss_f2', 'csp.gss.sf.ambt_loss_f1', 'csp.gss.sf.ambt_loss_f0'):
('sfhlT_coefs'),
('qsf_des', 'csp.gss.sf.design_thermal_loss', 'csp.gss.sf.total_opt_eff', 'irr_des'):
('csp.gss.sf.field_area'),
('csp.gss.sf.irr_loss_f3', 'csp.gss.sf.irr_loss_f2', 'csp.gss.sf.irr_loss_f1', 'csp.gss.sf.irr_loss_f0'):
('f_dni_loss_des'),
('csp.gss.sf.ambt_loss_f3', 'csp.gss.sf.ambt_loss_f2', 'csp.gss.sf.ambt_loss_f1', 'csp.gss.sf.ambt_loss_f0'):
('f_t_amb_loss_des'),
('csp.gss.sf.irr_loss_f3', 'csp.gss.sf.irr_loss_f2', 'csp.gss.sf.irr_loss_f1', 'csp.gss.sf.irr_loss_f0'):
('sfhlQ_coefs'),
('csp.gss.sf.rad_type'):
('rad_type'),
('csp.gss.sf.rad_type'):
('track_mode'),
('f_sfhl_ref', 'qsf_des'):
('csp.gss.sf.design_thermal_loss'),
('OpticalTable', 'istableunsorted'):
('csp.gss.sf.peak_opt_eff'),
('csp.gss.sf.peak_opt_eff', 'eta_opt_soil', 'eta_opt_gen'):
('csp.gss.sf.total_opt_eff'),
('csp.gss.solf.fixed_land_area', 'csp.gss.solf.land_overhead_factor'):
('csp.gss.solf.total_land_area'),
('csp.gss.sf.field_area'):
('csp.gss.solf.fixed_land_area'),
('f_dni_loss_des', 'f_t_amb_loss_des', 'f_v_wind_loss_des'):
('f_loss_tot_des'),
('w_des', 'eta_des', 'solarm'):
('qsf_des') },
'Battery Thermal': {
('solar_resource_file', 'spec_mode', 'energy_output_array', 'batt_thermal_choice', 'batt_room_temperature_single', 'batt_room_temperature_vector'):
('batt_room_temperature_celsius'),
('batt_volume'):
('batt_width'),
('batt_volume'):
('batt_length'),
('batt_computed_bank_capacity', 'batt_specific_energy_per_volume'):
('batt_volume'),
('batt_volume'):
('batt_height'),
('batt_computed_bank_capacity', 'batt_specific_energy_per_mass'):
('batt_mass') },
'Empirical Trough Thermal Storage': {
('ui_tes_htf_type', 'ui_field_htf_type', 'ui_q_design', 'TurTesOutAdj', 'TurTesEffAdj', 'MaxGrOut'):
('PFSmax'),
('ui_q_design'):
('ui_tes_q_design'),
('TSHOURS', 'ui_q_design'):
('calc_max_energy'),
('ui_tes_htf_type', 'ui_field_htf_type', 'Solar_Field_Mult'):
('calc_heat_ex_duty'),
('ui_tes_htf_type', 'ui_field_htf_type', 'ui_q_design', 'Solar_Field_Mult', 'MaxGrOut', 'calc_heat_ex_duty'):
('PTSmax'),
('ui_tes_htf_type'):
('calc_htf_max_opt_temp'),
('ui_tes_htf_type'):
('calc_htf_min_opt_temp') },
'Rankine Cycle and Hybrid Cooling': {
('hybrid_tou1', 'hybrid_tou2', 'hybrid_tou3', 'hybrid_tou4', 'hybrid_tou5', 'hybrid_tou6', 'hybrid_tou7', 'hybrid_tou8', 'hybrid_tou9'):
('F_wc'),
('combo_condenser_type'):
('CT'),
('pressure_mode'):
('tech_type') },
'Direct Steam Tower Parasitics': {
():
('bop_array'),
('aux_par', 'aux_par_f', 'aux_par_0', 'aux_par_1', 'aux_par_2', 'demand_var'):
('csp.dst.calc.aux'),
('bop_par', 'bop_par_f', 'bop_par_0', 'bop_par_1', 'bop_par_2', 'demand_var'):
('csp.dst.calc.bop'),
('THT', 'piping_length_mult', 'piping_length_add'):
('Piping_length'),
('Piping_length', 'Piping_loss'):
('Piping_loss_tot'),
():
('aux_array') },
'Financial Debt DSCR or Debt Fraction': {
('real_discount_rate', 'inflation_rate', 'debt_percent', 'federal_tax_rate', 'state_tax_rate', 'term_int_rate'):
('ui_wacc') },
'Battery Dispatch Front of Meter': {
('batt_dispatch_choice', 'dispatch_factor1', 'dispatch_factor2', 'dispatch_factor3', 'dispatch_factor4', 'dispatch_factor5', 'dispatch_factor6', 'dispatch_factor7', 'dispatch_factor8', 'dispatch_factor9'):
('dispatch_tod_factors') },
'Linear Fresnel Boiler Geometry': {
('csp.lf.geom1.var1.broken_glass', 'csp.lf.geom1.var2.broken_glass', 'csp.lf.geom1.var3.broken_glass', 'csp.lf.geom1.var4.broken_glass'):
('csp.lf.geom1.glazing_intact'),
('csp.lf.geom1.var1.gas_type', 'csp.lf.geom1.var2.gas_type', 'csp.lf.geom1.var3.gas_type', 'csp.lf.geom1.var4.gas_type'):
('csp.lf.geom1.annulus_gas'),
('csp.lf.geom1.hl_mode', 'csp.lf.geom1.var1.field_fraction', 'csp.lf.geom1.var1.bellows_shadowing', 'csp.lf.geom1.var1.hce_dirt', 'csp.lf.geom1.var2.field_fraction', 'csp.lf.geom1.var2.bellows_shadowing', 'csp.lf.geom1.var2.hce_dirt', 'csp.lf.geom1.var3.field_fraction', 'csp.lf.geom1.var3.bellows_shadowing', 'csp.lf.geom1.var3.hce_dirt', 'csp.lf.geom1.var4.field_fraction', 'csp.lf.geom1.var4.bellows_shadowing', 'csp.lf.geom1.var4.hce_dirt'):
('csp.lf.geom1.rec_optical_derate'),
('csp.lf.geom1.hl_mode', 'csp.lf.geom1.hlpolyt0', 'csp.lf.geom1.hlpolyt1', 'csp.lf.geom1.avg_field_temp_dt_design', 'csp.lf.geom1.hlpolyt2', 'csp.lf.geom1.hlpolyt3', 'csp.lf.geom1.hlpolyt4', 'csp.lf.geom1.var1.field_fraction', 'csp.lf.geom1.var1.rated_heat_loss', 'csp.lf.geom1.var2.field_fraction', 'csp.lf.geom1.var2.rated_heat_loss', 'csp.lf.geom1.var3.field_fraction', 'csp.lf.geom1.var3.rated_heat_loss', 'csp.lf.geom1.var4.field_fraction', 'csp.lf.geom1.var4.rated_heat_loss'):
('csp.lf.geom1.heat_loss_at_design'),
('csp.lf.geom1.heat_loss_at_design', 'I_bn_des', 'csp.lf.geom1.refl_aper_area', 'csp.lf.geom1.coll_length'):
('csp.lf.geom1.rec_thermal_derate'),
('T_cold_ref', 'T_hot', 'T_amb_des_sf'):
('csp.lf.geom1.avg_field_temp_dt_design'),
('csp.lf.geom1.track_error', 'csp.lf.geom1.geom_error', 'csp.lf.geom1.mirror_refl', 'csp.lf.geom1.soiling', 'csp.lf.geom1.general_error'):
('csp.lf.geom1.coll_opt_loss_norm_inc') },
'Battery Model': {
('batt_type'):
('batt_chem') },
'Physical Trough Receiver Header': {
('csp_dtr_hce_var1_bellows_shadowing_1', 'csp_dtr_hce_var2_bellows_shadowing_1', 'csp_dtr_hce_var3_bellows_shadowing_1', 'csp_dtr_hce_var4_bellows_shadowing_1', 'csp_dtr_hce_var1_bellows_shadowing_2', 'csp_dtr_hce_var2_bellows_shadowing_2', 'csp_dtr_hce_var3_bellows_shadowing_2', 'csp_dtr_hce_var4_bellows_shadowing_2', 'csp_dtr_hce_var1_bellows_shadowing_3', 'csp_dtr_hce_var2_bellows_shadowing_3', 'csp_dtr_hce_var3_bellows_shadowing_3', 'csp_dtr_hce_var4_bellows_shadowing_3', 'csp_dtr_hce_var1_bellows_shadowing_4', 'csp_dtr_hce_var2_bellows_shadowing_4', 'csp_dtr_hce_var3_bellows_shadowing_4', 'csp_dtr_hce_var4_bellows_shadowing_4'):
('Shadowing'),
('csp_dtr_hce_var1_gas_type_1', 'csp_dtr_hce_var2_gas_type_1', 'csp_dtr_hce_var3_gas_type_1', 'csp_dtr_hce_var4_gas_type_1', 'csp_dtr_hce_var1_gas_type_2', 'csp_dtr_hce_var2_gas_type_2', 'csp_dtr_hce_var3_gas_type_2', 'csp_dtr_hce_var4_gas_type_2', 'csp_dtr_hce_var1_gas_type_3', 'csp_dtr_hce_var2_gas_type_3', 'csp_dtr_hce_var3_gas_type_3', 'csp_dtr_hce_var4_gas_type_3', 'csp_dtr_hce_var1_gas_type_4', 'csp_dtr_hce_var2_gas_type_4', 'csp_dtr_hce_var3_gas_type_4', 'csp_dtr_hce_var4_gas_type_4'):
('AnnulusGas'),
('csp_dtr_hce_var1_annulus_pressure_1', 'csp_dtr_hce_var2_annulus_pressure_1', 'csp_dtr_hce_var3_annulus_pressure_1', 'csp_dtr_hce_var4_annulus_pressure_1', 'csp_dtr_hce_var1_annulus_pressure_2', 'csp_dtr_hce_var2_annulus_pressure_2', 'csp_dtr_hce_var3_annulus_pressure_2', 'csp_dtr_hce_var4_annulus_pressure_2', 'csp_dtr_hce_var1_annulus_pressure_3', 'csp_dtr_hce_var2_annulus_pressure_3', 'csp_dtr_hce_var3_annulus_pressure_3', 'csp_dtr_hce_var4_annulus_pressure_3', 'csp_dtr_hce_var1_annulus_pressure_4', 'csp_dtr_hce_var2_annulus_pressure_4', 'csp_dtr_hce_var3_annulus_pressure_4', 'csp_dtr_hce_var4_annulus_pressure_4'):
('P_a'),
('csp_dtr_hce_var1_env_emis_1', 'csp_dtr_hce_var2_env_emis_1', 'csp_dtr_hce_var3_env_emis_1', 'csp_dtr_hce_var4_env_emis_1', 'csp_dtr_hce_var1_env_emis_2', 'csp_dtr_hce_var2_env_emis_2', 'csp_dtr_hce_var3_env_emis_2', 'csp_dtr_hce_var4_env_emis_2', 'csp_dtr_hce_var1_env_emis_3', 'csp_dtr_hce_var2_env_emis_3', 'csp_dtr_hce_var3_env_emis_3', 'csp_dtr_hce_var4_env_emis_3', 'csp_dtr_hce_var1_env_emis_4', 'csp_dtr_hce_var2_env_emis_4', 'csp_dtr_hce_var3_env_emis_4', 'csp_dtr_hce_var4_env_emis_4'):
('EPSILON_4', 'EPSILON_5'),
('csp_dtr_hce_var1_env_trans_1', 'csp_dtr_hce_var2_env_trans_1', 'csp_dtr_hce_var3_env_trans_1', 'csp_dtr_hce_var4_env_trans_1', 'csp_dtr_hce_var1_env_trans_2', 'csp_dtr_hce_var2_env_trans_2', 'csp_dtr_hce_var3_env_trans_2', 'csp_dtr_hce_var4_env_trans_2', 'csp_dtr_hce_var1_env_trans_3', 'csp_dtr_hce_var2_env_trans_3', 'csp_dtr_hce_var3_env_trans_3', 'csp_dtr_hce_var4_env_trans_3', 'csp_dtr_hce_var1_env_trans_4', 'csp_dtr_hce_var2_env_trans_4', 'csp_dtr_hce_var3_env_trans_4', 'csp_dtr_hce_var4_env_trans_4'):
('Tau_envelope'),
('csp_dtr_hce_var1_abs_abs_1', 'csp_dtr_hce_var2_abs_abs_1', 'csp_dtr_hce_var3_abs_abs_1', 'csp_dtr_hce_var4_abs_abs_1', 'csp_dtr_hce_var1_abs_abs_2', 'csp_dtr_hce_var2_abs_abs_2', 'csp_dtr_hce_var3_abs_abs_2', 'csp_dtr_hce_var4_abs_abs_2', 'csp_dtr_hce_var1_abs_abs_3', 'csp_dtr_hce_var2_abs_abs_3', 'csp_dtr_hce_var3_abs_abs_3', 'csp_dtr_hce_var4_abs_abs_3', 'csp_dtr_hce_var1_abs_abs_4', 'csp_dtr_hce_var2_abs_abs_4', 'csp_dtr_hce_var3_abs_abs_4', 'csp_dtr_hce_var4_abs_abs_4'):
('alpha_abs'),
('csp_dtr_hce_var1_broken_glass_1', 'csp_dtr_hce_var2_broken_glass_1', 'csp_dtr_hce_var3_broken_glass_1', 'csp_dtr_hce_var4_broken_glass_1', 'csp_dtr_hce_var1_broken_glass_2', 'csp_dtr_hce_var2_broken_glass_2', 'csp_dtr_hce_var3_broken_glass_2', 'csp_dtr_hce_var4_broken_glass_2', 'csp_dtr_hce_var1_broken_glass_3', 'csp_dtr_hce_var2_broken_glass_3', 'csp_dtr_hce_var3_broken_glass_3', 'csp_dtr_hce_var4_broken_glass_3', 'csp_dtr_hce_var1_broken_glass_4', 'csp_dtr_hce_var2_broken_glass_4', 'csp_dtr_hce_var3_broken_glass_4', 'csp_dtr_hce_var4_broken_glass_4'):
('GlazingIntactIn'),
('csp_dtr_hce_var1_env_abs_1', 'csp_dtr_hce_var2_env_abs_1', 'csp_dtr_hce_var3_env_abs_1', 'csp_dtr_hce_var4_env_abs_1', 'csp_dtr_hce_var1_env_abs_2', 'csp_dtr_hce_var2_env_abs_2', 'csp_dtr_hce_var3_env_abs_2', 'csp_dtr_hce_var4_env_abs_2', 'csp_dtr_hce_var1_env_abs_3', 'csp_dtr_hce_var2_env_abs_3', 'csp_dtr_hce_var3_env_abs_3', 'csp_dtr_hce_var4_env_abs_3', 'csp_dtr_hce_var1_env_abs_4', 'csp_dtr_hce_var2_env_abs_4', 'csp_dtr_hce_var3_env_abs_4', 'csp_dtr_hce_var4_env_abs_4'):
('alpha_env'),
('csp_dtr_hce_var1_rated_heat_loss_1', 'csp_dtr_hce_var2_rated_heat_loss_1', 'csp_dtr_hce_var3_rated_heat_loss_1', 'csp_dtr_hce_var4_rated_heat_loss_1', 'csp_dtr_hce_var1_rated_heat_loss_2', 'csp_dtr_hce_var2_rated_heat_loss_2', 'csp_dtr_hce_var3_rated_heat_loss_2', 'csp_dtr_hce_var4_rated_heat_loss_2', 'csp_dtr_hce_var1_rated_heat_loss_3', 'csp_dtr_hce_var2_rated_heat_loss_3', 'csp_dtr_hce_var3_rated_heat_loss_3', 'csp_dtr_hce_var4_rated_heat_loss_3', 'csp_dtr_hce_var1_rated_heat_loss_4', 'csp_dtr_hce_var2_rated_heat_loss_4', 'csp_dtr_hce_var3_rated_heat_loss_4', 'csp_dtr_hce_var4_rated_heat_loss_4'):
('Design_loss'),
('csp_dtr_hce_var1_field_fraction_1', 'csp_dtr_hce_var2_field_fraction_1', 'csp_dtr_hce_var3_field_fraction_1', 'csp_dtr_hce_var4_field_fraction_1', 'csp_dtr_hce_var1_field_fraction_2', 'csp_dtr_hce_var2_field_fraction_2', 'csp_dtr_hce_var3_field_fraction_2', 'csp_dtr_hce_var4_field_fraction_2', 'csp_dtr_hce_var1_field_fraction_3', 'csp_dtr_hce_var2_field_fraction_3', 'csp_dtr_hce_var3_field_fraction_3', 'csp_dtr_hce_var4_field_fraction_3', 'csp_dtr_hce_var1_field_fraction_4', 'csp_dtr_hce_var2_field_fraction_4', 'csp_dtr_hce_var3_field_fraction_4', 'csp_dtr_hce_var4_field_fraction_4'):
('HCE_FieldFrac'),
('csp_dtr_hce_diam_envelope_inner_1', 'csp_dtr_hce_diam_envelope_inner_2', 'csp_dtr_hce_diam_envelope_inner_3', 'csp_dtr_hce_diam_envelope_inner_4'):
('D_4'),
('csp_dtr_hce_absorber_material_1', 'csp_dtr_hce_absorber_material_2', 'csp_dtr_hce_absorber_material_3', 'csp_dtr_hce_absorber_material_4'):
('AbsorberMaterial'),
('csp_dtr_hce_flow_type_1', 'csp_dtr_hce_flow_type_2', 'csp_dtr_hce_flow_type_3', 'csp_dtr_hce_flow_type_4'):
('Flow_type'),
('csp_dtr_hce_var1_hce_dirt_1', 'csp_dtr_hce_var2_hce_dirt_1', 'csp_dtr_hce_var3_hce_dirt_1', 'csp_dtr_hce_var4_hce_dirt_1', 'csp_dtr_hce_var1_hce_dirt_2', 'csp_dtr_hce_var2_hce_dirt_2', 'csp_dtr_hce_var3_hce_dirt_2', 'csp_dtr_hce_var4_hce_dirt_2', 'csp_dtr_hce_var1_hce_dirt_3', 'csp_dtr_hce_var2_hce_dirt_3', 'csp_dtr_hce_var3_hce_dirt_3', 'csp_dtr_hce_var4_hce_dirt_3', 'csp_dtr_hce_var1_hce_dirt_4', 'csp_dtr_hce_var2_hce_dirt_4', 'csp_dtr_hce_var3_hce_dirt_4', 'csp_dtr_hce_var4_hce_dirt_4'):
('Dirt_HCE'),
('csp_dtr_hce_inner_roughness_1', 'csp_dtr_hce_inner_roughness_2', 'csp_dtr_hce_inner_roughness_3', 'csp_dtr_hce_inner_roughness_4'):
('Rough'),
('csp_dtr_hce_diam_absorber_plug_1', 'csp_dtr_hce_diam_absorber_plug_2', 'csp_dtr_hce_diam_absorber_plug_3', 'csp_dtr_hce_diam_absorber_plug_4'):
('D_p'),
('csp_dtr_hce_diam_envelope_outer_1', 'csp_dtr_hce_diam_envelope_outer_2', 'csp_dtr_hce_diam_envelope_outer_3', 'csp_dtr_hce_diam_envelope_outer_4'):
('D_5'),
('csp_dtr_hce_diam_absorber_outer_1', 'csp_dtr_hce_diam_absorber_outer_2', 'csp_dtr_hce_diam_absorber_outer_3', 'csp_dtr_hce_diam_absorber_outer_4'):
('D_3'),
('csp_dtr_hce_diam_absorber_inner_1', 'csp_dtr_hce_diam_absorber_inner_2', 'csp_dtr_hce_diam_absorber_inner_3', 'csp_dtr_hce_diam_absorber_inner_4'):
('D_2'),
('SCAInfoArray', 'nColt'):
('receivers_in_field') },
'PV Shading': {
('subarray4_gcr'):
('subarray4_gcr_ref'),
('subarray1_gcr'):
('subarray1_gcr_ref'),
('subarray4_enable', 'subarray4_nstrings', 'subarray4_modules_per_string'):
('subarray4_ref_nmodules'),
('subarray1_nstrings', 'subarray1_modules_per_string'):
('subarray1_ref_nmodules'),
('subarray4_ref_nmodules', 'subarray4_nmodx', 'subarray4_nmody'):
('ui_subarray4_nrows'),
('subarray3_ref_nmodules', 'subarray3_nmodx', 'subarray3_nmody'):
('ui_subarray3_nrows'),
('subarray2_ref_nmodules', 'subarray2_nmodx', 'subarray2_nmody'):
('ui_subarray2_nrows'),
('module_area', 'module_width', 'module_length', 'subarray4_nmody', 'subarray4_mod_orient', 'subarray4_gcr_ref'):
('ui_subarray4_row_spacing'),
('subarray2_gcr'):
('subarray2_gcr_ref'),
('module_area', 'module_width', 'module_length', 'subarray3_nmody', 'subarray3_mod_orient', 'subarray3_gcr_ref'):
('ui_subarray3_row_spacing'),
('module_area', 'module_width', 'module_length', 'subarray1_nmody', 'subarray1_mod_orient', 'subarray1_gcr_ref'):
('ui_subarray1_row_spacing'),
('module_area', 'module_width', 'module_length', 'subarray2_nmody', 'subarray2_mod_orient', 'subarray2_gcr_ref'):
('ui_subarray2_row_spacing'),
('subarray1_ref_nmodules', 'subarray1_nmodx', 'subarray1_nmody'):
('ui_subarray1_nrows'),
('subarray3_gcr'):
('subarray3_gcr_ref'),
('subarray3_mod_orient', 'subarray3_nmody', 'module_length', 'module_width'):
('ui_subarray3_length_side'),
('subarray4_mod_orient', 'subarray4_nmody', 'module_length', 'module_width'):
('ui_subarray4_length_side'),
('module_model', 'spe_area', 'cec_area', '6par_area', 'snl_area', 'sd11par_area'):
('module_area'),
('subarray2_mod_orient', 'subarray2_nmody', 'module_length', 'module_width'):
('ui_subarray2_length_side'),
('subarray1_mod_orient', 'subarray1_nmody', 'module_length', 'module_width'):
('ui_subarray1_length_side'),
('subarray3_enable', 'subarray3_nstrings', 'subarray3_modules_per_string'):
('subarray3_ref_nmodules'),
('subarray2_enable', 'subarray2_nstrings', 'subarray2_modules_per_string'):
('subarray2_ref_nmodules'),
('module_area', 'module_aspect_ratio'):
('module_length'),
('module_area', 'module_aspect_ratio'):
('module_width') },
'IEC61853 Single Diode Model': {
('iec61853_test_data'):
('sd11par_Pmp0', 'sd11par_Vmp0', 'sd11par_Isc0', 'sd11par_Voc0', 'sd11par_Imp0'),
('sd11par_Pmp0', 'sd11par_area'):
('sd11par_eff') },
'Wind Turbine Design': {
('wind.turbine.radio_list_or_design', 'wind_turbine_powercurve_windspeeds_from_lib', 'wind_turbine_powercurve_powerout_from_lib', 'wind_turbine_kw_rating_from_lib', 'wind_turbine_kw_rating_input', 'wind_turbine_rotor_diameter_input', 'wind_turbine_hub_ht', 'wind.turbine.elevation', 'wind_resource_model_choice', 'wind_turbine_max_cp', 'wind.turbine.max_tip_speed', 'wind.turbine.max_tspeed_ratio', 'wind.turbine.region2nhalf_slope', 'wind_turbine_cutin', 'wind_turbine_cut_out', 'wind.turbine.drive_train'):
('wind_turbine_powercurve_windspeeds', 'wind_turbine_powercurve_powerout', 'wind_turbine_rated_wind_speed', 'wind_turbine_powercurve_err_msg', 'wind_turbine_powercurve_hub_efficiency'),
('wind.turbine.radio_list_or_design', 'wind_turbine_kw_rating_from_lib', 'wind_turbine_kw_rating_input'):
('wind_turbine_kw_rating'),
('wind.turbine.radio_list_or_design', 'wind_turbine_rotor_diameter_from_lib', 'wind_turbine_rotor_diameter_input'):
('wind_turbine_rotor_diameter') },
'Inverter CEC Database': {
('inv_snl_vdco', 'inv_snl_pdco', 'inv_snl_pso', 'inv_snl_paco', 'inv_snl_c0', 'inv_snl_c1', 'inv_snl_c2', 'inv_snl_c3'):
('inv_snl_eff_cec', 'inv_snl_eff_euro') },
'Electric Load': {
():
('ui_annual_load'),
('load_model', 'escal_other', 'escal_belpe'):
('load_escalation') },
'Financial Debt Min DSCR': {
('construction_financing_cost'):
('ui_construction_financing_cost'),
('real_discount_rate', 'inflation_rate', 'debt_fraction', 'federal_tax_rate', 'state_tax_rate', 'loan_rate'):
('ui_wacc'),
('ui_net_capital_cost', 'debt_fraction', 'construction_financing_cost'):
('ui_loan_amount'),
('total_installed_cost', 'ibi_fed_amount', 'ibi_sta_amount', 'ibi_uti_amount', 'ibi_oth_amount', 'ibi_fed_percent', 'ibi_fed_percent_maxvalue', 'ibi_sta_percent', 'ibi_sta_percent_maxvalue', 'ibi_uti_percent', 'ibi_uti_percent_maxvalue', 'ibi_oth_percent', 'ibi_oth_percent_maxvalue', 'system_capacity', 'cbi_fed_amount', 'cbi_fed_maxvalue', 'cbi_sta_amount', 'cbi_sta_maxvalue', 'cbi_uti_amount', 'cbi_uti_maxvalue', 'cbi_oth_amount', 'cbi_oth_maxvalue'):
('ui_net_capital_cost') },
'Solar Water Heating Costs': {
('epc_total', 'plm_total', 'sales_tax_total'):
('total_indirect'),
('sales_tax_rate'):
('sales_tax_value'),
('plm_percent', 'total_direct'):
('plm_nonfixed'),
('total_installed_cost', 'system_capacity'):
('installed_per_capacity'),
('sales_tax_value', 'total_direct', 'sales_tax_percent'):
('sales_tax_total'),
('contingency_percent', 'collector', 'storage', 'bos', 'installation'):
('contingency'),
('ncoll'):
('num_collectors'),
():
('system_use_lifetime_output'),
('contingency', 'bos', 'installation', 'storage', 'collector'):
('total_direct'),
('collector_cost_units', 'total_area', 'system_capacity', 'num_collectors', 'per_collector'):
('collector'),
('epc_percent', 'total_direct'):
('epc_nonfixed'),
():
('system_use_recapitalization'),
('storage_cost_units', 'V_tank', 'per_storage'):
('storage'),
('epc_nonfixed', 'epc_fixed'):
('epc_total'),
('total_direct', 'total_indirect'):
('total_installed_cost'),
('plm_nonfixed', 'plm_fixed'):
('plm_total') },
'MSPT System Control': {
('disp_wlim_max'):
('wlim_series'),
('disp_wlim_maxspec', 'adjust'):
('disp_wlim_max'),
('is_dispatch'):
('is_wlim_series'),
('aux_par', 'aux_par_f', 'aux_par_0', 'aux_par_1', 'aux_par_2', 'P_ref'):
('csp.pt.par.calc.aux'),
('bop_par', 'bop_par_f', 'bop_par_0', 'bop_par_1', 'bop_par_2', 'P_ref'):
('csp.pt.par.calc.bop') },
'Molten Salt Linear Fresnel Parasitics': {
('csp.mslf.control.bop_array_mult', 'csp.mslf.control.bop_array_pf', 'csp.mslf.control.bop_array_c0', 'csp.mslf.control.bop_array_c1', 'csp.mslf.control.bop_array_c2'):
('bop_array'),
('csp.mslf.control.bop_array_mult', 'csp.mslf.control.bop_array_pf', 'csp.mslf.control.bop_array_c0', 'csp.mslf.control.bop_array_c1', 'csp.mslf.control.bop_array_c2', 'P_ref'):
('csp.mslf.par.calc.bop'),
('csp.mslf.control.aux_array_mult', 'csp.mslf.control.aux_array_pf', 'csp.mslf.control.aux_array_c0', 'csp.mslf.control.aux_array_c1', 'csp.mslf.control.aux_array_c2', 'P_ref'):
('csp.mslf.par.calc.aux'),
('csp.mslf.control.aux_array_mult', 'csp.mslf.control.aux_array_pf', 'csp.mslf.control.aux_array_c0', 'csp.mslf.control.aux_array_c1', 'csp.mslf.control.aux_array_c2'):
('aux_array'),
('nMod', 'nLoops', 'SCA_drives_elec'):
('csp.mslf.par.calc.tracking'),
('P_ref', 'pb_fixed_par'):
('csp.mslf.par.calc.frac_gross') },
'Inverter Part Load Curve': {
('inv_pd_data'):
('inv_pd_partload', 'inv_pd_efficiency'),
('inv_pd_paco', 'inv_pd_eff'):
('inv_pd_pdco'),
('inv_pd_eff_type', 'inv_pd_eff_cec', 'inv_pd_eff_euro'):
('inv_pd_eff') },
'CSP Dispatch Control': {
('ui_disp_1_fossil', 'ui_disp_2_fossil', 'ui_disp_3_fossil', 'ui_disp_4_fossil', 'ui_disp_5_fossil', 'ui_disp_6_fossil', 'ui_disp_7_fossil', 'ui_disp_8_fossil', 'ui_disp_9_fossil', 'ui_disp_1_nosolar', 'ui_disp_2_nosolar', 'ui_disp_3_nosolar', 'ui_disp_4_nosolar', 'ui_disp_5_nosolar', 'ui_disp_6_nosolar', 'ui_disp_7_nosolar', 'ui_disp_8_nosolar', 'ui_disp_9_nosolar', 'ui_disp_1_solar', 'ui_disp_2_solar', 'ui_disp_3_solar', 'ui_disp_4_solar', 'ui_disp_5_solar', 'ui_disp_6_solar', 'ui_disp_7_solar', 'ui_disp_8_solar', 'ui_disp_9_solar', 'ui_disp_1_turbout', 'ui_disp_2_turbout', 'ui_disp_3_turbout', 'ui_disp_4_turbout', 'ui_disp_5_turbout', 'ui_disp_6_turbout', 'ui_disp_7_turbout', 'ui_disp_8_turbout', 'ui_disp_9_turbout'):
('FossilFill', 'TSLogic', 'NUMTOU', 'ffrac', 'tslogic_a', 'tslogic_b', 'tslogic_c', 'fdisp', 'diswos', 'disws', 'qdisp') },
'HCPV Array': {
('array_num_inverters', 'inv_snl_paco'):
('hcpv.array.ac_capacity'),
():
('hcpv.array.average_soiling'),
('array_modules_per_tracker', 'array_num_trackers', 'hcpv.module.power'):
('hcpv.array.nameplate'),
('hcpv.array.nameplate', 'inv_snl_pdco'):
('array_num_inverters'),
('array_tracker_power_fraction', 'hcpv.array.single_tracker_nameplate'):
('hcpv.array.tracker_power'),
('array_modules_per_tracker', 'hcpv.module.power'):
('hcpv.array.single_tracker_nameplate'),
('hcpv.module.est_eff', 'array_tracking_error', 'array_dc_wiring_loss', 'hcpv.array.average_soiling', 'array_dc_mismatch_loss', 'array_diode_conn_loss', 'array_ac_wiring_loss', 'inv_snl_paco', 'inv_snl_pdco'):
('hcpv.array.overall_est_eff'),
('hcpv.array.nameplate'):
('system_capacity'),
('hcpv.module.area', 'array_modules_per_tracker', 'array_num_trackers', 'hcpv.array.packing_factor'):
('hcpv.array.total_land_area') },
'Direct Steam Tower Receiver': {
('csp.dst.num_2panelgroups'):
('n_flux_x'),
():
('tower_technology'),
('eta_ref'):
('design_eff'),
('T_sh_out_des'):
('T_hot'),
():
('T_cold_ref'),
('q_rec_des'):
('Q_rec_des'),
('T_sh_out_des'):
('T_hot_ref'),
('h_tower'):
('THT'),
('demand_var'):
('P_ref'),
('P_rh_ref'):
('P_hp_out'),
('P_boil_des'):
('P_b_in_init'),
('h_boiler', 'h_sh', 'h_rh'):
('H_rec'),
('P_rh_ref'):
('P_hp_out_des'),
():
('T_hp_out'),
('csp.dst.flow_pattern'):
('flowtype'),
('P_boil_des'):
('P_hp_in_des'),
('demand_var'):
('Design_power'),
('cycle_max_fraction'):
('cycle_max_frac'),
('t_sby'):
('t_standby_ini'),
('q_sby_frac'):
('f_pb_sb'),
('rh_frac_ref'):
('f_mdotrh_des'),
('cycle_cutoff_frac'):
('f_pb_cutoff'),
('P_rh_ref'):
('P_cond_init'),
('rh_frac_ref'):
('f_mdot_rh_init'),
('demand_var', 'eta_ref'):
('q_aux_max'),
('LHV_eff'):
('lhv_eff'),
():
('T_fw_init'),
('sh_q_loss_flux', 'csp.dst.max_sh_flux'):
('csp.dst.eff_sh_ref'),
('b_q_loss_flux', 'csp.dst.max_b_flux'):
('csp.dst.eff_b_ref'),
('T_rh_out_des'):
('T_rh_target'),
():
('rec_htf'),
('demand_var', 'eta_ref', 'csp.dst.solar_multiple'):
('q_rec_des'),
('csp.dst.mat_rh'):
('mat_rh'),
('demand_var'):
('p_cycle_design'),
('rh_q_loss_flux', 'csp.dst.max_rh_flux'):
('csp.dst.eff_rh_ref'),
('csp.dst.num_2panelgroups'):
('n_panels'),
('CT'):
('ct'),
('d_rec', 'H_rec'):
('rec_aspect'),
('csp.dst.mat_boiler'):
('mat_boiler'),
('demand_var', 'eta_ref'):
('q_pb_design'),
('csp.dst.mat_sh'):
('mat_sh') },
'LF DSG Boiler Header': {
():
('sh_OpticalTable'),
('csp.lf.geom1.solpos_collinc_table'):
('b_OpticalTable'),
():
('sh_eps_HCE4'),
():
('sh_eps_HCE3'),
():
('sh_eps_HCE2'),
():
('sh_eps_HCE1'),
('csp.lf.geom1.var4.abs_emis'):
('b_eps_HCE4'),
('csp.lf.geom1.glazing_intact'):
('GlazingIntactIn'),
('csp.lf.geom1.var1.abs_emis'):
('b_eps_HCE1'),
('csp.lf.geom1.var1.annulus_pressure', 'csp.lf.geom1.var2.annulus_pressure', 'csp.lf.geom1.var3.annulus_pressure', 'csp.lf.geom1.var4.annulus_pressure'):
('P_a'),
('csp.lf.geom1.annulus_gas'):
('AnnulusGas'),
('csp.lf.geom1.var1.env_trans', 'csp.lf.geom1.var2.env_trans', 'csp.lf.geom1.var3.env_trans', 'csp.lf.geom1.var4.env_trans'):
('Tau_envelope'),
('csp.lf.geom1.var3.abs_emis'):
('b_eps_HCE3'),
('csp.lf.geom1.iamt0', 'csp.lf.geom1.iamt1', 'csp.lf.geom1.iamt2', 'csp.lf.geom1.iamt3', 'csp.lf.geom1.iamt4'):
('IAM_T'),
('csp.lf.geom1.var1.env_emis', 'csp.lf.geom1.var2.env_emis', 'csp.lf.geom1.var3.env_emis', 'csp.lf.geom1.var4.env_emis'):
('EPSILON_4'),
('csp.lf.geom1.var1.env_abs', 'csp.lf.geom1.var2.env_abs', 'csp.lf.geom1.var3.env_abs', 'csp.lf.geom1.var4.env_abs'):
('alpha_env'),
('csp.lf.geom1.var2.abs_emis'):
('b_eps_HCE2'),
('csp.lf.geom1.var1.hce_dirt', 'csp.lf.geom1.var2.hce_dirt', 'csp.lf.geom1.var3.hce_dirt', 'csp.lf.geom1.var4.hce_dirt'):
('Dirt_HCE'),
('csp.lf.geom1.iaml0', 'csp.lf.geom1.iaml1', 'csp.lf.geom1.iaml2', 'csp.lf.geom1.iaml3', 'csp.lf.geom1.iaml4'):
('IAM_L'),
('csp.lf.geom1.hlpolyw0', 'csp.lf.geom1.hlpolyw1', 'csp.lf.geom1.hlpolyw2', 'csp.lf.geom1.hlpolyw3', 'csp.lf.geom1.hlpolyw4'):
('HL_W'),
('csp.lf.geom1.var1.abs_abs', 'csp.lf.geom1.var2.abs_abs', 'csp.lf.geom1.var3.abs_abs', 'csp.lf.geom1.var4.abs_abs'):
('alpha_abs'),
('csp.lf.geom1.var1.bellows_shadowing', 'csp.lf.geom1.var2.bellows_shadowing', 'csp.lf.geom1.var3.bellows_shadowing', 'csp.lf.geom1.var4.bellows_shadowing'):
('Shadowing'),
('csp.lf.geom1.hlpolyt0', 'csp.lf.geom1.hlpolyt1', 'csp.lf.geom1.hlpolyt2', 'csp.lf.geom1.hlpolyt3', 'csp.lf.geom1.hlpolyt4'):
('HL_dT'),
('csp.lf.geom1.var1.rated_heat_loss', 'csp.lf.geom1.var2.rated_heat_loss', 'csp.lf.geom1.var3.rated_heat_loss', 'csp.lf.geom1.var4.rated_heat_loss'):
('Design_loss'),
('csp.lf.geom1.var1.field_fraction', 'csp.lf.geom1.var2.field_fraction', 'csp.lf.geom1.var3.field_fraction', 'csp.lf.geom1.var4.field_fraction'):
('HCE_FieldFrac'),
('csp.lf.geom1.refl_aper_area', 'csp.lf.geom1.coll_length', 'csp.lf.geom1.opt_mode', 'csp.lf.geom1.track_error', 'csp.lf.geom1.geom_error', 'csp.lf.geom1.mirror_refl', 'csp.lf.geom1.soiling', 'csp.lf.geom1.general_error', 'csp.lf.geom1.hl_mode', 'csp.lf.geom1.diam_absorber_inner', 'csp.lf.geom1.diam_absorber_outer', 'csp.lf.geom1.diam_envelope_inner', 'csp.lf.geom1.diam_envelope_outer', 'csp.lf.geom1.diam_absorber_plug', 'csp.lf.geom1.inner_roughness', 'csp.lf.geom1.flow_type', 'csp.lf.geom1.absorber_material'):
('A_aperture', 'L_col', 'OptCharType', 'TrackingError', 'GeomEffects', 'rho_mirror_clean', 'dirt_mirror', 'error', 'HLCharType', 'D_2', 'D_3', 'D_4', 'D_5', 'D_p', 'Rough', 'Flow_type', 'AbsorberMaterial') },
'MSPT Receiver': {
('T_htf_hot_des'):
('REC_COPY_T_htf_hot_des'),
('Q_rec_des'):
('REC_COPY_Q_rec_des'),
('N_panels'):
('n_flux_x'),
('piping_length', 'piping_loss'):
('piping_loss_tot'),
('h_tower', 'piping_length_mult', 'piping_length_const'):
('piping_length'),
():
('receiver_type'),
():
('tower_technology'),
('solarm'):
('REC_COPY_solarm'),
('D_rec', 'rec_height'):
('rec_aspect'),
('rec_d_spec', 'csp.pt.rec.cav_ap_hw_ratio'):
('csp.pt.rec.cav_ap_height'),
('field_fl_props'):
('user_fluid'),
('csp.pt.rec.htf_type', 'csp.pt.rec.htf_t_avg', 'field_fl_props'):
('csp.pt.rec.htf_c_avg'),
('T_htf_cold_des', 'T_htf_hot_des'):
('csp.pt.rec.htf_t_avg'),
():
('csp.pt.rec.cav_panel_height'),
('T_htf_cold_des'):
('REC_COPY_T_htf_cold_des'),
('csp.pt.rec.max_oper_frac', 'Q_rec_des', 'csp.pt.rec.htf_c_avg', 'T_htf_hot_des', 'T_htf_cold_des'):
('csp.pt.rec.max_flow_to_rec'),
():
('csp.pt.rec.cav_lip_height'),
('csp.pt.rec.htf_type'):
('rec_htf'),
('csp.pt.rec.flow_pattern'):
('Flow_type'),
('csp.pt.rec.material_type'):
('mat_tube') },
'MSLF Power Cycle Common': {
('PB_COPY_q_pb_design', 'PB_COPY_htf_cp_avg', 'PB_COPY_T_htf_hot_des', 'PB_COPY_T_htf_cold_des'):
('PB_m_dot_htf_cycle_des'),
('field_htf_cp_avg'):
('PB_COPY_htf_cp_avg'),
('T_htf_hot_ref'):
('PB_COPY_T_htf_hot_des'),
('eta_lhv'):
('lhv_eff'),
():
('pb_tech_type'),
():
('m_dot_in'),
('T_loop_in_des'):
('T_htf_cold_ref'),
('store_fluid', 'Fluid'):
('is_hx'),
():
('hx_config'),
('P_ref'):
('pb_rated_cap'),
('nameplate'):
('system_capacity'),
('T_htf_cold_ref'):
('PB_COPY_T_htf_cold_des'),
('T_loop_out'):
('T_htf_hot_ref'),
('P_ref', 'csp.mslf.cycle.gr_to_net'):
('nameplate'),
('P_ref', 'csp.mslf.cycle.gr_to_net'):
('q_design'),
('P_ref', 'eta_ref'):
('PB_COPY_q_pb_design'),
('csp.mslf.control.fossil_mode'):
('fossil_mode') },
'Molten Salt Linear Fresnel Collector and Receiver': {
('P_ref'):
('demand_var'),
('P_ref'):
('W_pb_design'),
():
('T_cold_in'),
():
('defocus'),
():
('azimuth'),
():
('SolarAz'),
():
('T_dp'),
():
('P_amb'),
():
('V_wind'),
():
('track_mode'),
():
('T_db'),
('csp.mslf.sf.AnnulusGas1', 'csp.mslf.sf.AnnulusGas2', 'csp.mslf.sf.AnnulusGas3', 'csp.mslf.sf.AnnulusGas4'):
('AnnulusGas'),
('csp.mslf.sf.Flow_type'):
('Flow_type'),
('csp.mslf.sf.Rough'):
('Rough'),
('csp.mslf.sf.D_plug'):
('D_plug'),
('csp.mslf.sf.D_glass_out'):
('D_glass_out'),
('csp.mslf.sf.D_glass_in'):
('D_glass_in'),
('csp.mslf.sf.IAM_T_coefs0', 'csp.mslf.sf.IAM_T_coefs1', 'csp.mslf.sf.IAM_T_coefs2', 'csp.mslf.sf.IAM_T_coefs3', 'csp.mslf.sf.IAM_T_coefs4'):
('IAM_T_coefs'),
('csp.mslf.sf.HL_w_coefs0', 'csp.mslf.sf.HL_w_coefs1', 'csp.mslf.sf.HL_w_coefs2', 'csp.mslf.sf.HL_w_coefs3', 'csp.mslf.sf.HL_w_coefs4'):
('HL_w_coefs'),
('csp.mslf.sf.P_a1', 'csp.mslf.sf.P_a2', 'csp.mslf.sf.P_a3', 'csp.mslf.sf.P_a4'):
('P_a'),
('TrackingError', 'GeomEffects', 'reflectivity', 'Dirt_mirror', 'Error'):
('opt_normal'),
('csp.mslf.sf.DP_coefs0', 'csp.mslf.sf.DP_coefs1', 'csp.mslf.sf.DP_coefs2', 'csp.mslf.sf.DP_coefs3'):
('DP_coefs'),
():
('tilt'),
('csp.mslf.sf.Shadowing1', 'csp.mslf.sf.Shadowing2', 'csp.mslf.sf.Shadowing3', 'csp.mslf.sf.Shadowing4'):
('Shadowing'),
('csp.mslf.sf.dirt_env1', 'csp.mslf.sf.dirt_env2', 'csp.mslf.sf.dirt_env3', 'csp.mslf.sf.dirt_env4'):
('dirt_env'),
('sf_q_design'):
('q_pb_design'),
('csp.mslf.sf.HCE_FieldFrac1', 'csp.mslf.sf.HCE_FieldFrac2', 'csp.mslf.sf.HCE_FieldFrac3', 'csp.mslf.sf.HCE_FieldFrac4'):
('HCE_FieldFrac'),
('csp.mslf.sf.epsilon_glass1', 'csp.mslf.sf.epsilon_glass2', 'csp.mslf.sf.epsilon_glass3', 'csp.mslf.sf.epsilon_glass4'):
('epsilon_glass'),
('csp.mslf.sf.D_abs_in'):
('D_abs_in'),
('csp.mslf.sf.GlazingIntactIn1', 'csp.mslf.sf.GlazingIntactIn2', 'csp.mslf.sf.GlazingIntactIn3', 'csp.mslf.sf.GlazingIntactIn4'):
('GlazingIntactIn'),
('csp.mslf.sf.rec_model'):
('rec_model'),
('csp.mslf.sf.alpha_env1', 'csp.mslf.sf.alpha_env2', 'csp.mslf.sf.alpha_env3', 'csp.mslf.sf.alpha_env4'):
('alpha_env'),
('csp.mslf.sf.alpha_abs1', 'csp.mslf.sf.alpha_abs2', 'csp.mslf.sf.alpha_abs3', 'csp.mslf.sf.alpha_abs4'):
('alpha_abs'),
('csp.mslf.sf.opt_model'):
('opt_model'),
():
('I_b'),
('csp.mslf.sf.Tau_envelope1', 'csp.mslf.sf.Tau_envelope2', 'csp.mslf.sf.Tau_envelope3', 'csp.mslf.sf.Tau_envelope4'):
('Tau_envelope'),
('csp.mslf.sf.IAM_L_coefs0', 'csp.mslf.sf.IAM_L_coefs1', 'csp.mslf.sf.IAM_L_coefs2', 'csp.mslf.sf.IAM_L_coefs3', 'csp.mslf.sf.IAM_L_coefs4'):
('IAM_L_coefs'),
('hl_des', 'I_bn_des', 'A_aperture', 'L_mod'):
('hl_derate'),
('T_loop_in_des', 'T_loop_out', 'T_amb_sf_des'):
('csp.mslf.sf.avg_dt_des'),
('csp.mslf.sf.AbsorberMaterial'):
('AbsorberMaterial'),
('csp.mslf.sf.D_abs_out'):
('D_abs_out'),
('csp.mslf.sf.Design_loss1', 'csp.mslf.sf.Design_loss2', 'csp.mslf.sf.Design_loss3', 'csp.mslf.sf.Design_loss4'):
('Design_loss'),
('csp.mslf.sf.rec_model', 'csp.mslf.sf.HCE_FieldFrac1', 'csp.mslf.sf.Shadowing1', 'csp.mslf.sf.dirt_env1', 'csp.mslf.sf.HCE_FieldFrac2', 'csp.mslf.sf.Shadowing2', 'csp.mslf.sf.dirt_env2', 'csp.mslf.sf.HCE_FieldFrac3', 'csp.mslf.sf.Shadowing3', 'csp.mslf.sf.dirt_env3', 'csp.mslf.sf.HCE_FieldFrac4', 'csp.mslf.sf.Shadowing4', 'csp.mslf.sf.dirt_env4'):
('opt_derate'),
('csp.mslf.sf.HL_T_coefs0', 'csp.mslf.sf.HL_T_coefs1', 'csp.mslf.sf.HL_T_coefs2', 'csp.mslf.sf.HL_T_coefs3', 'csp.mslf.sf.HL_T_coefs4'):
('HL_T_coefs'),
('nMod', 'DP_nominal'):
('DP_pressure_loss'),
('csp.mslf.sf.rec_model', 'csp.mslf.sf.HL_T_coefs0', 'csp.mslf.sf.HL_T_coefs1', 'csp.mslf.sf.avg_dt_des', 'csp.mslf.sf.HL_T_coefs2', 'csp.mslf.sf.HL_T_coefs3', 'csp.mslf.sf.HL_T_coefs4', 'csp.mslf.sf.HCE_FieldFrac1', 'csp.mslf.sf.Design_loss1', 'csp.mslf.sf.HCE_FieldFrac2', 'csp.mslf.sf.Design_loss2', 'csp.mslf.sf.HCE_FieldFrac3', 'csp.mslf.sf.Design_loss3', 'csp.mslf.sf.HCE_FieldFrac4', 'csp.mslf.sf.Design_loss4'):
('hl_des') },
'Molten Salt Linear Fresnel Capital Costs': {
('csp.mslf.cost.total_indirect'):
('total_direct_cost'),
():
('system_use_lifetime_output'),
():
('system_use_recapitalization'),
('csp.mslf.cost.sales_tax.value', 'csp.mslf.cost.total_direct', 'csp.mslf.cost.sales_tax.percent'):
('csp.mslf.cost.sales_tax.total'),
('csp.mslf.cost.epc.total', 'csp.mslf.cost.plm.total', 'csp.mslf.cost.sales_tax.total'):
('csp.mslf.cost.total_indirect'),
('csp.mslf.cost.fossil_backup.mwe', 'csp.mslf.cost.fossil_backup.cost_per_kwe'):
('csp.mslf.cost.fossil_backup'),
('sales_tax_rate'):
('csp.mslf.cost.sales_tax.value'),
('csp.mslf.cost.solar_field.area', 'csp.mslf.cost.solar_field.cost_per_m2'):
('csp.mslf.cost.solar_field'),
('a_sf_act'):
('csp.mslf.cost.site_improvements.area'),
('csp.mslf.cost.total_installed', 'nameplate'):
('csp.mslf.cost.installed_per_capacity'),
('a_sf_act'):
('csp.mslf.cost.htf_system.area'),
('csp.mslf.cost.contingency', 'csp.mslf.cost.site_improvements', 'csp.mslf.cost.solar_field', 'csp.mslf.cost.htf_system', 'csp.mslf.cost.fossil_backup', 'csp.mslf.cost.power_plant', 'csp.mslf.cost.bop', 'csp.mslf.cost.ts'):
('csp.mslf.cost.total_direct'),
('csp.mslf.cost.bop_mwe', 'csp.mslf.cost.bop_per_kwe'):
('csp.mslf.cost.bop'),
('csp.mslf.cost.contingency_percent', 'csp.mslf.cost.site_improvements', 'csp.mslf.cost.solar_field', 'csp.mslf.cost.htf_system', 'csp.mslf.cost.fossil_backup', 'csp.mslf.cost.power_plant', 'csp.mslf.cost.bop', 'csp.mslf.cost.ts'):
('csp.mslf.cost.contingency'),
('demand_var'):
('csp.mslf.cost.fossil_backup.mwe'),
('demand_var'):
('csp.mslf.cost.power_plant.mwe'),
('csp.mslf.cost.site_improvements.area', 'csp.mslf.cost.site_improvements.cost_per_m2'):
('csp.mslf.cost.site_improvements'),
('csp.mslf.cost.epc.per_acre', 'csp.mslf.cost.total_land_area', 'csp.mslf.cost.epc.percent', 'csp.mslf.cost.total_direct', 'csp.mslf.cost.nameplate', 'csp.mslf.cost.epc.per_watt', 'csp.mslf.cost.epc.fixed'):
('csp.mslf.cost.epc.total'),
('csp.mslf.cost.ts_mwht', 'csp.mslf.cost.ts_per_kwht'):
('csp.mslf.cost.ts'),
('a_sf_act'):
('csp.mslf.cost.solar_field.area'),
('csp.mslf.cost.total_direct', 'csp.mslf.cost.total_indirect'):
('csp.mslf.cost.total_installed'),
('TES_cap'):
('csp.mslf.cost.ts_mwht'),
('nameplate'):
('csp.mslf.cost.nameplate'),
('total_land_area'):
('csp.mslf.cost.total_land_area'),
('demand_var'):
('csp.mslf.cost.bop_mwe'),
('csp.mslf.cost.htf_system.area', 'csp.mslf.cost.htf_system.cost_per_m2'):
('csp.mslf.cost.htf_system'),
('csp.mslf.cost.power_plant.mwe', 'csp.mslf.cost.power_plant.cost_per_kwe'):
('csp.mslf.cost.power_plant'),
('csp.mslf.cost.total_installed'):
('total_installed_cost'),
('csp.mslf.cost.plm.per_acre', 'csp.mslf.cost.total_land_area', 'csp.mslf.cost.plm.percent', 'csp.mslf.cost.total_direct', 'csp.mslf.cost.nameplate', 'csp.mslf.cost.plm.per_watt', 'csp.mslf.cost.plm.fixed'):
('csp.mslf.cost.plm.total') },
'Financial Sale Leaseback': {
('sponsor_operating_margin', 'system_capacity'):
('sponsor_operating_margin_amount') },
'Financial Cost of Financing Flip Leaseback': {
('federal_tax_rate', 'state_tax_rate', 'cost_dev_fee_value'):
('cost_dev_fee_tax_liability'),
('total_installed_cost', 'cost_dev_fee_percent'):
('cost_dev_fee_value') },
'Financial Salvage Value': {
('salvage_percentage', 'total_installed_cost'):
('salvage_value') },
'Fuel Cell': {
('fuelcell_dynamic_response_down_input', 'fuelcell_dynamic_response_down_units', 'fuelcell_power_nameplate'):
('fuelcell_dynamic_response_down'),
('fuelcell_dynamic_response_up_input', 'fuelcell_dynamic_response_up_units', 'fuelcell_power_nameplate'):
('fuelcell_dynamic_response_up'),
('fuelcell_unit_min_power_input', 'fuelcell_unit_min_units', 'fuelcell_unit_max_power'):
('fuelcell_unit_min_power'),
('fuelcell_unit_min_power', 'fuelcell_number_of_units'):
('fuelcell_power_min'),
('fuelcell_degradation_input', 'fuelcell_degradation_units', 'fuelcell_unit_max_power'):
('fuelcell_degradation'),
('fuelcell_fuel_type', 'fuelcell_fuel_available_in', 'fuelcell_fuel_available_units'):
('fuelcell_fuel_available'),
('fuelcell_unit_max_power', 'fuelcell_number_of_units'):
('fuelcell_power_nameplate'),
('fuelcell_lhv_in', 'fuelcell_fuel_type', 'fuelcell_lhv_units'):
('fuelcell_lhv') },
'Generic System Plant': {
('derate', 'spec_mode', 'user_capacity_factor', 'first_year_output_peak', 'first_year_output', 'system_capacity'):
('capacity_factor_calc'),
('derate', 'spec_mode', 'system_capacity', 'energy_output_array'):
('first_year_output_peak'),
('derate', 'spec_mode', 'system_capacity', 'user_capacity_factor', 'energy_output_array'):
('first_year_output'),
('heat_rate'):
('conv_eff') },
'Financial Tax and Insurance Rates': {
('prop_tax_cost_assessed_percent', 'total_installed_cost'):
('property_assessed_value') },
'Linear Fresnel Capital Costs': {
():
('system_use_lifetime_output'),
('csp.lf.cost.total_indirect'):
('total_direct_cost'),
('demand_var'):
('csp.lf.cost.power_plant.mwe'),
('csp.lf.cost.solar_field.area', 'csp.lf.cost.solar_field.cost_per_m2'):
('csp.lf.cost.solar_field'),
('csp.lf.cost.htf_system.area', 'csp.lf.cost.htf_system.cost_per_m2'):
('csp.lf.cost.htf_system'),
():
('system_use_recapitalization'),
('actual_aper'):
('csp.lf.cost.htf_system.area'),
('nameplate'):
('csp.lf.cost.nameplate'),
('demand_var'):
('csp.lf.cost.fossil_backup.mwe'),
('csp.lf.cost.site_improvements.area', 'csp.lf.cost.site_improvements.cost_per_m2'):
('csp.lf.cost.site_improvements'),
('csp.lf.cost.epc.total', 'csp.lf.cost.plm.total', 'csp.lf.cost.sales_tax.total'):
('csp.lf.cost.total_indirect'),
('csp.lf.cost.sales_tax.value', 'csp.lf.cost.total_direct', 'csp.lf.cost.sales_tax.percent'):
('csp.lf.cost.sales_tax.total'),
('actual_aper'):
('csp.lf.cost.site_improvements.area'),
('csp.lf.cost.bop_mwe', 'csp.lf.cost.bop_per_kwe'):
('csp.lf.cost.bop'),
('csp.lf.cost.total_direct', 'csp.lf.cost.total_indirect'):
('csp.lf.cost.total_installed'),
('actual_aper'):
('csp.lf.cost.solar_field.area'),
('demand_var'):
('csp.lf.cost.bop_mwe'),
('csp.lf.cost.contingency', 'csp.lf.cost.site_improvements', 'csp.lf.cost.solar_field', 'csp.lf.cost.htf_system', 'csp.lf.cost.fossil_backup', 'csp.lf.cost.power_plant', 'csp.lf.cost.bop'):
('csp.lf.cost.total_direct'),
('csp.lf.cost.power_plant.mwe', 'csp.lf.cost.power_plant.cost_per_kwe'):
('csp.lf.cost.power_plant'),
('csp.lf.cost.fossil_backup.mwe', 'csp.lf.cost.fossil_backup.cost_per_kwe'):
('csp.lf.cost.fossil_backup'),
('csp.lf.sf.total_land_area', 'total_land_area'):
('csp.lf.cost.total_land_area'),
('sales_tax_rate'):
('csp.lf.cost.sales_tax.value'),
('csp.lf.cost.contingency_percent', 'csp.lf.cost.site_improvements', 'csp.lf.cost.solar_field', 'csp.lf.cost.htf_system', 'csp.lf.cost.fossil_backup', 'csp.lf.cost.power_plant', 'csp.lf.cost.bop'):
('csp.lf.cost.contingency'),
('csp.lf.cost.total_installed', 'nameplate'):
('csp.lf.cost.installed_per_capacity'),
('csp.lf.cost.plm.per_acre', 'csp.lf.cost.total_land_area', 'csp.lf.cost.plm.percent', 'csp.lf.cost.total_direct', 'csp.lf.cost.nameplate', 'csp.lf.cost.plm.per_watt', 'csp.lf.cost.plm.fixed'):
('csp.lf.cost.plm.total'),
('csp.lf.cost.epc.per_acre', 'csp.lf.cost.total_land_area', 'csp.lf.cost.epc.percent', 'csp.lf.cost.total_direct', 'csp.lf.cost.nameplate', 'csp.lf.cost.epc.per_watt', 'csp.lf.cost.epc.fixed'):
('csp.lf.cost.epc.total'),
('csp.lf.cost.total_installed'):
('total_installed_cost'),
('csp.lf.sf.dp.actual_aper', 'a_sf_act'):
('actual_aper') },
'Molten Salt Linear Fresnel Storage': {
('dt_hot'):
('dt_cold'),
('csp.mslf.control.store_fluid'):
('csp.mslf.tes.htf_max_opt_temp'),
('mslf_is_hx', 'dt_hot', 'dt_cold', 'T_loop_out', 'T_loop_in_des'):
('hx_derate'),
('h_tank', 'd_tank', 'tank_pairs', 'tes_temp', 'u_tank'):
('csp.mslf.tes.estimated_heat_loss'),
('vol_tank', 'h_tank', 'tank_pairs'):
('d_tank'),
('T_loop_in_des', 'T_loop_out'):
('tes_temp'),
('csp.mslf.control.store_fluid'):
('csp.mslf.tes.htf_min_opt_temp'),
('sf_q_design', 'tshours'):
('TES_cap'),
('TES_cap', 'csp.mslf.control.tes_dens', 'csp.mslf.control.tes_cp', 'hx_derate', 'T_loop_out', 'dt_hot', 'T_loop_in_des', 'dt_cold'):
('vol_tank'),
('csp.mslf.control.store_fluid', 'tes_temp', 'store_fl_props'):
('csp.mslf.control.tes_dens'),
('vol_tank'):
('V_tank_hot_ini'),
('csp.mslf.control.store_fluid', 'tes_temp', 'store_fl_props'):
('csp.mslf.control.tes_cp'),
('T_loop_in_des'):
('T_field_in_des'),
('csp.mslf.control.store_fluid'):
('store_fluid'),
('sf_q_design', 'solar_mult'):
('q_max_aux'),
('T_loop_in_des'):
('T_tank_cold_ini'),
('vol_tank', 'h_tank_min', 'h_tank'):
('vol_min'),
('T_loop_out'):
('T_tank_hot_ini'),
('csp.mslf.enet.tes_fp_mode'):
('fp_mode') },
'Financial Depreciation Detailed': {
('depr_alloc_macrs_5_percent', 'depr_alloc_macrs_15_percent', 'depr_alloc_sl_5_percent', 'depr_alloc_sl_15_percent', 'depr_alloc_sl_20_percent', 'depr_alloc_sl_39_percent', 'depr_alloc_custom_percent'):
('depr_alloc_none') },
'Dish Solar Field': {
('csp.ds.total_capacity'):
('system_capacity'),
('n_ew', 'n_ns'):
('csp.ds.ncollectors'),
('csp.ds.ncollectors', 'csp.ds.nameplate_capacity'):
('csp.ds.total_capacity'),
('ew_dish_sep', 'ns_dish_sep', 'csp.ds.ncollectors'):
('csp.ds.field_area') },
'Empirical Trough SCA': {
('ui_HCEdust'):
('HCEdust'),
('SCA_aper'):
('RefMirrAper'),
('TrkTwstErr', 'GeoAcc', 'MirRef', 'MirCln', 'ConcFac'):
('calc_col_factor') },
'Electric Load Other': {
('load_model', 'load_user_data', 'normalize_to_utility_bill', 'utility_bill_data', 'scale_factor'):
('load', 'load_annual_total', 'annual_peak', 'energy_1', 'peak_1', 'energy_2', 'peak_2', 'energy_3', 'peak_3', 'energy_4', 'peak_4', 'energy_5', 'peak_5', 'energy_6', 'peak_6', 'energy_7', 'peak_7', 'energy_8', 'peak_8', 'energy_9', 'peak_9', 'energy_10', 'peak_10', 'energy_11', 'peak_11', 'energy_12', 'peak_12'),
('escal_input_hourly'):
('escal_other') },
'Biopower System Cost': {
('biopwr.cost.total_indirect'):
('total_indirect_cost'),
('biopwr.cost.total_direct'):
('total_direct_cost'),
():
('system_use_lifetime_output'),
('biopwr.plant.nameplate'):
('biopwr.cost.turbine_capacity'),
('biopwr.cost.plm.percent', 'biopwr.cost.total_direct'):
('biopwr.cost.plm.nonfixed'),
('biopwr.plant.nameplate'):
('biopwr.cost.equipment_capacity'),
('biopwr.plant.nameplate'):
('biopwr.cost.prep_capacity'),
('biopwr.cost.prep_capacity', 'biopwr.cost.prep_per_cap'):
('biopwr.cost.prep'),
('biopwr.cost.dryer_capacity', 'biopwr.cost.dryer_per_kw'):
('biopwr.cost.dryer'),
('biopwr.plant.boiler.cap_per_boiler'):
('biopwr.cost.cap_per_boiler'),
('biopwr.cost.sales_tax.value', 'biopwr.cost.sales_tax.percent', 'biopwr.cost.total_direct'):
('biopwr.cost.sales_tax.total'),
('biopwr.cost.total_direct', 'biopwr.cost.epc.percent'):
('biopwr.cost.epc.nonfixed'),
('biopwr.cost.boiler_capacity', 'biopwr.cost.boiler.cost_per_kw'):
('biopwr.cost.boiler'),
('biopwr.cost.contingency', 'biopwr.cost.boiler', 'biopwr.cost.turbine', 'biopwr.cost.prep', 'biopwr.cost.dryer', 'biopwr.cost.equipment', 'biopwr.cost.bop'):
('biopwr.cost.total_direct'),
('total_installed_cost', 'biopwr.plant.nameplate'):
('biopwr.cost.installed_per_capacity'),
('biopwr.cost.bop_per_kw', 'biopwr.cost.bop_capacity'):
('biopwr.cost.bop'),
('biopwr.cost.epc.total', 'biopwr.cost.plm.total', 'biopwr.cost.sales_tax.total'):
('biopwr.cost.total_indirect'),
('biopwr.cost.plm.fixed', 'biopwr.cost.plm.nonfixed'):
('biopwr.cost.plm.total'),
('sales_tax_rate'):
('biopwr.cost.sales_tax.value'),
('biopwr.cost.turbine_capacity', 'biopwr.cost.turbine_per_kw'):
('biopwr.cost.turbine'),
('biopwr.plant.nameplate', 'biopwr.plant.par'):
('biopwr.cost.bop_capacity'),
('biopwr.cost.epc.fixed', 'biopwr.cost.epc.nonfixed'):
('biopwr.cost.epc.total'),
('biopwr.cost.total_direct', 'biopwr.cost.total_indirect'):
('total_installed_cost'),
('biopwr.cost.contingency_percent', 'biopwr.cost.boiler', 'biopwr.cost.turbine', 'biopwr.cost.prep', 'biopwr.cost.equipment', 'biopwr.cost.bop'):
('biopwr.cost.contingency'),
('biopwr.plant.drying_method', 'biopwr.plant.nameplate'):
('biopwr.cost.dryer_capacity'),
('biopwr.cost.equipment_capacity', 'biopwr.cost.equipment.cost_per_kw'):
('biopwr.cost.equipment'),
():
('system_use_recapitalization'),
('biopwr.plant.nameplate'):
('biopwr.cost.boiler_capacity') },
'Financial Reserve Accounts': {
('system_capacity', 'equip2_reserve_cost'):
('mera_cost2'),
('system_capacity', 'equip3_reserve_cost'):
('mera_cost3'),
('system_capacity', 'equip1_reserve_cost'):
('mera_cost1') },
'Financial Equity Flip Structure': {
('tax_investor_postflip_tax_percent'):
('developer_postflip_tax_percent'),
('tax_investor_preflip_tax_percent'):
('developer_preflip_tax_percent'),
('tax_investor_postflip_cash_percent'):
('developer_postflip_cash_percent'),
('tax_investor_preflip_cash_percent'):
('developer_preflip_cash_percent'),
('tax_investor_equity_percent'):
('developer_equity_percent') },
'Biopower Feedstock Costs': {
('biopwr.feedstockcost.coal_fuel_cost'):
('om_opt_fuel_2_cost'),
('biopwr.feedstockcost.coal_fuel_used'):
('om_opt_fuel_2_usage'),
('biopwr.feedstock.total_coal'):
('biopwr.feedstockcost.coal_fuel_used'),
('biopwr.feedstockcost.biomass_fuel_cost_esc'):
('om_opt_fuel_1_cost_escal'),
('biopwr.feedstockcost.coal_fuel_cost_esc'):
('om_opt_fuel_2_cost_escal'),
('biopwr.feedstock.subbit_resource'):
('biopwr.feedstockcost.subbit_resource'),
('biopwr.feedstock.forest_resource', 'biopwr.feedstock.forest_obtainable'):
('biopwr.feedstockcost.forest_resource'),
('biopwr.feedstock.mill_resource', 'biopwr.feedstock.mill_obtainable'):
('biopwr.feedstockcost.mill_resource'),
('biopwr.feedstock.barley_resource', 'biopwr.feedstock.barley_obtainable'):
('biopwr.feedstockcost.barley_resource'),
('biopwr.feedstock.rice_resource', 'biopwr.feedstock.rice_obtainable'):
('biopwr.feedstockcost.rice_resource'),
('biopwr.feedstock.wheat_resource', 'biopwr.feedstock.wheat_obtainable'):
('biopwr.feedstockcost.wheat_resource'),
('biopwr.feedstock.bagasse_resource', 'biopwr.feedstock.bagasse_obtainable'):
('biopwr.feedstockcost.bagasse_resource'),
('biopwr.feedstockcost.biomass_cost', 'biopwr.feedstock.total_biomass_hhv'):
('biopwr.feedstockcost.biomass_fuel_cost'),
('biopwr.feedstock.total_biomass', 'biopwr.feedstock.bagasse_biomass_frac', 'biopwr.feedstockcost.bagasse_price', 'biopwr.feedstock.barley_biomass_frac', 'biopwr.feedstockcost.barley_price', 'biopwr.feedstock.stover_biomass_frac', 'biopwr.feedstockcost.stover_price', 'biopwr.feedstock.rice_biomass_frac', 'biopwr.feedstockcost.rice_price', 'biopwr.feedstock.wheat_biomass_frac', 'biopwr.feedstockcost.wheat_price', 'biopwr.feedstock.forest_biomass_frac', 'biopwr.feedstockcost.forest_price', 'biopwr.feedstock.mill_biomass_frac', 'biopwr.feedstockcost.mill_price', 'biopwr.feedstock.urban_biomass_frac', 'biopwr.feedstockcost.urban_price', 'biopwr.feedstock.woody_biomass_frac', 'biopwr.feedstockcost.woody_price', 'biopwr.feedstock.herb_biomass_frac', 'biopwr.feedstockcost.herb_price', 'biopwr.feedstock.feedstock1_biomass_frac', 'biopwr.feedstockcost.feedstock1_price', 'biopwr.feedstock.feedstock2_biomass_frac', 'biopwr.feedstockcost.feedstock2_price', 'biopwr.feedstockcost.fixed_delivery_cost', 'biopwr.feedstock.collection_radius', 'biopwr.feedstockcost.var_delivery_cost', 'biopwr.feedstock.total_biomass_hhv'):
('biopwr.feedstockcost.biomass_cost'),
('biopwr.feedstockcost.biomass_fuel_cost', 'biopwr.feedstock.total_biomass_moisture'):
('biopwr.feedstockcost.green_biomass_cost'),
('biopwr.feedstock.urban_resource', 'biopwr.feedstock.urban_obtainable'):
('biopwr.feedstockcost.urban_resource'),
('biopwr.feedstock.feedstock1_resource'):
('biopwr.feedstockcost.feedstock1_resource'),
('biopwr.feedstock.woody_resource', 'biopwr.feedstock.woody_obtainable'):
('biopwr.feedstockcost.woody_resource'),
('biopwr.feedstock.lig_resource'):
('biopwr.feedstockcost.lig_resource'),
('biopwr.feedstockcost.coal_per_mmbtu', 'biopwr.feedstock.total_coal_hhv'):
('biopwr.feedstockcost.coal_fuel_cost'),
('biopwr.feedstock.total_biomass'):
('biopwr.feedstockcost.biomass_fuel_used'),
('biopwr.feedstock.stover_resource', 'biopwr.feedstock.stover_obtainable'):
('biopwr.feedstockcost.stover_resource'),
('biopwr.feedstock.coal_opt', 'biopwr.feedstock.bit_coal_frac', 'biopwr.feedstockcost.bit_price', 'biopwr.feedstock.subbit_coal_frac', 'biopwr.feedstockcost.subbit_price', 'biopwr.feedstock.lig_coal_frac', 'biopwr.feedstockcost.lig_price', 'biopwr.feedstock.total_coal_hhv'):
('biopwr.feedstockcost.coal_per_mmbtu'),
('biopwr.feedstockcost.biomass_fuel_cost'):
('om_opt_fuel_1_cost'),
('biopwr.feedstock.bit_resource'):
('biopwr.feedstockcost.bit_resource'),
('biopwr.feedstockcost.biomass_fuel_used'):
('om_opt_fuel_1_usage'),
('biopwr.feedstock.herb_resource', 'biopwr.feedstock.herb_obtainable'):
('biopwr.feedstockcost.herb_resource'),
('biopwr.feedstock.feedstock2_resource'):
('biopwr.feedstockcost.feedstock2_resource') },
'Physical Trough Capital Costs': {
():
('system_use_recapitalization'),
():
('system_use_lifetime_output'),
('csp.dtr.cost.site_improvements.area', 'csp.dtr.cost.site_improvements.cost_per_m2'):
('csp.dtr.cost.site_improvements'),
('csp.dtr.cost.storage.mwht', 'csp.dtr.cost.storage.cost_per_kwht'):
('csp.dtr.cost.storage'),
('csp.dtr.cost.htf_system.area', 'csp.dtr.cost.htf_system.cost_per_m2'):
('csp.dtr.cost.htf_system'),
('csp.dtr.cost.sales_tax.value', 'total_direct_cost', 'csp.dtr.cost.sales_tax.percent'):
('csp.dtr.cost.sales_tax.total'),
('csp.dtr.cost.contingency', 'csp.dtr.cost.site_improvements', 'csp.dtr.cost.solar_field', 'csp.dtr.cost.htf_system', 'csp.dtr.cost.storage', 'csp.dtr.cost.fossil_backup', 'csp.dtr.cost.power_plant', 'csp.dtr.cost.bop'):
('total_direct_cost'),
('total_aperture'):
('csp.dtr.cost.solar_field.area'),
('P_ref'):
('csp.dtr.cost.bop_mwe'),
('P_ref'):
('csp.dtr.cost.fossil_backup.mwe'),
('csp.dtr.cost.power_plant.mwe', 'csp.dtr.cost.power_plant.cost_per_kwe'):
('csp.dtr.cost.power_plant'),
('csp.dtr.tes.thermal_capacity'):
('csp.dtr.cost.storage.mwht'),
('csp.dtr.cost.epc.per_acre', 'csp.dtr.cost.total_land_area', 'csp.dtr.cost.epc.percent', 'total_direct_cost', 'csp.dtr.cost.nameplate', 'csp.dtr.cost.epc.per_watt', 'csp.dtr.cost.epc.fixed'):
('csp.dtr.cost.epc.total'),
('total_aperture'):
('csp.dtr.cost.site_improvements.area'),
('csp.dtr.cost.plm.per_acre', 'csp.dtr.cost.total_land_area', 'csp.dtr.cost.plm.percent', 'total_direct_cost', 'csp.dtr.cost.nameplate', 'csp.dtr.cost.plm.per_watt', 'csp.dtr.cost.plm.fixed'):
('csp.dtr.cost.plm.total'),
('total_installed_cost', 'csp.dtr.pwrb.nameplate'):
('csp.dtr.cost.installed_per_capacity'),
('csp.dtr.cost.bop_mwe', 'csp.dtr.cost.bop_per_kwe'):
('csp.dtr.cost.bop'),
('csp.dtr.cost.contingency_percent', 'csp.dtr.cost.site_improvements', 'csp.dtr.cost.solar_field', 'csp.dtr.cost.htf_system', 'csp.dtr.cost.storage', 'csp.dtr.cost.fossil_backup', 'csp.dtr.cost.power_plant', 'csp.dtr.cost.bop'):
('csp.dtr.cost.contingency'),
('csp.dtr.pwrb.nameplate'):
('csp.dtr.cost.nameplate'),
('csp.dtr.cost.site_improvements', 'csp.dtr.cost.solar_field', 'csp.dtr.cost.htf_system', 'csp.dtr.cost.storage', 'csp.dtr.cost.fossil_backup', 'csp.dtr.cost.power_plant', 'csp.dtr.cost.bop'):
('direct_subtotal'),
('sales_tax_rate'):
('csp.dtr.cost.sales_tax.value'),
('total_land_area'):
('csp.dtr.cost.total_land_area'),
('P_ref'):
('csp.dtr.cost.power_plant.mwe'),
('total_aperture'):
('csp.dtr.cost.htf_system.area'),
('csp.dtr.cost.solar_field.area', 'csp.dtr.cost.solar_field.cost_per_m2'):
('csp.dtr.cost.solar_field'),
('csp.dtr.cost.epc.total', 'csp.dtr.cost.plm.total', 'csp.dtr.cost.sales_tax.total'):
('total_indirect_cost'),
('csp.dtr.cost.fossil_backup.mwe', 'csp.dtr.cost.fossil_backup.cost_per_kwe'):
('csp.dtr.cost.fossil_backup'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost') },
'Battery Dispatch Manual': {
('dispatch_manual_gridcharge', 'batt_gridcharge_percent_1', 'batt_gridcharge_percent_2', 'batt_gridcharge_percent_3', 'batt_gridcharge_percent_4', 'batt_gridcharge_percent_5', 'batt_gridcharge_percent_6'):
('dispatch_manual_percent_gridcharge'),
('dispatch_manual_discharge', 'batt_discharge_percent_1', 'batt_discharge_percent_2', 'batt_discharge_percent_3', 'batt_discharge_percent_4', 'batt_discharge_percent_5', 'batt_discharge_percent_6'):
('dispatch_manual_percent_discharge'),
('pv.storage.p1.gridcharge', 'pv.storage.p2.gridcharge', 'pv.storage.p3.gridcharge', 'pv.storage.p4.gridcharge', 'pv.storage.p5.gridcharge', 'pv.storage.p6.gridcharge'):
('dispatch_manual_gridcharge'),
('pv.storage.p1.discharge', 'pv.storage.p2.discharge', 'pv.storage.p3.discharge', 'pv.storage.p4.discharge', 'pv.storage.p5.discharge', 'pv.storage.p6.discharge'):
('dispatch_manual_discharge'),
('pv.storage.p1.charge', 'pv.storage.p2.charge', 'pv.storage.p3.charge', 'pv.storage.p4.charge', 'pv.storage.p5.charge', 'pv.storage.p6.charge'):
('dispatch_manual_charge') },
'CSP PBNS Dispatch Control': {
('csp.pbns.hc_ctl1', 'csp.pbns.hc_ctl2', 'csp.pbns.hc_ctl3', 'csp.pbns.hc_ctl4', 'csp.pbns.hc_ctl5', 'csp.pbns.hc_ctl6', 'csp.pbns.hc_ctl7', 'csp.pbns.hc_ctl8', 'csp.pbns.hc_ctl9'):
('F_wc'),
('csp.pbns.fossil1', 'csp.pbns.fossil2', 'csp.pbns.fossil3', 'csp.pbns.fossil4', 'csp.pbns.fossil5', 'csp.pbns.fossil6', 'csp.pbns.fossil7', 'csp.pbns.fossil8', 'csp.pbns.fossil9'):
('ffrac') },
'Sandia PV Array Performance Model with Module Database': {
('snl_parallel_cells', 'snl_series_cells'):
('snl_n_cells'),
('snl_module_structure', 'snl_a', 'snl_b', 'snl_dtc', 'snl_specified_a', 'snl_specified_b', 'snl_specified_dT', 'snl_fd', 'snl_a0', 'snl_a1', 'snl_a2', 'snl_a3', 'snl_a4', 'snl_b0', 'snl_b1', 'snl_b2', 'snl_b3', 'snl_b4', 'snl_b5', 'snl_isco', 'snl_aisc', 'snl_c0', 'snl_c1', 'snl_aimp', 'snl_impo', 'snl_bvmpo', 'snl_mbvmp', 'snl_n', 'snl_c3', 'snl_series_cells', 'snl_c2', 'snl_vmpo', 'snl_bvoco', 'snl_mbvoc', 'snl_voco', 'snl_area'):
('snl_ref_a', 'snl_ref_b', 'snl_ref_dT', 'snl_ref_isc', 'snl_ref_isc_temp_0', 'snl_ref_isc_temp_1', 'snl_ref_imp', 'snl_ref_imp_temp_0', 'snl_imp_temp_1', 'snl_ref_vmp', 'snl_ref_vmp_temp_0', 'snl_ref_vmp_temp_1', 'snl_ref_pmp', 'snl_ref_pmp_temp_0', 'snl_ref_pmp_temp_1', 'snl_ref_voc', 'snl_ref_voc_temp_0', 'snl_voc_temp_1', 'snl_ref_eff') },
'HCPV Costs': {
():
('system_use_lifetime_output'),
('hcpv.cost.engr.percent', 'total_direct_cost', 'hcpv.cost.modulearray.power', 'hcpv.cost.engr.per_watt', 'hcpv.cost.engr.fixed'):
('hcpv.cost.engr.total'),
('total_direct_cost', 'total_indirect_cost'):
('total_installed_cost'),
('hcpv.cost.bos_equip_fixed', 'hcpv.cost.modulearray.power', 'hcpv.cost.bos_equip_perwatt', 'hcpv.cost.modulearray.area', 'hcpv.cost.bos_equip_perarea'):
('hcpv.cost.bos_equip.totalcost'),
('hcpv.cost.module.totalcost', 'hcpv.cost.inverter.totalcost', 'hcpv.cost.tracker.totalcost', 'hcpv.cost.bos_equip.totalcost', 'hcpv.cost.install_labor.totalcost', 'hcpv.cost.install_margin.totalcost', 'hcpv.cost.contingency'):
('total_direct_cost'),
('hcpv.cost.inverter.power', 'hcpv.cost.inverter.num_units'):
('hcpv.cost.inverterarray.power'),
('hcpv.array.total_land_area'):
('hcpv.cost.land_area.value'),
('hcpv.cost.sales_tax.value', 'total_direct_cost', 'hcpv.cost.sales_tax.percent'):
('hcpv.cost.sales_tax.total'),
('hcpv.cost.tracker_fixed', 'hcpv.cost.modulearray.power', 'hcpv.cost.tracker_perwatt', 'hcpv.cost.modulearray.area', 'hcpv.cost.tracker_perarea'):
('hcpv.cost.tracker.totalcost'),
('sales_tax_rate'):
('hcpv.cost.sales_tax.value'),
('hcpv.cost.grid.percent', 'total_direct_cost', 'hcpv.cost.modulearray.power', 'hcpv.cost.grid.per_watt', 'hcpv.cost.grid.fixed'):
('hcpv.cost.grid.total'),
('hcpv.cost.install_labor_fixed', 'hcpv.cost.modulearray.power', 'hcpv.cost.install_labor_perwatt', 'hcpv.cost.modulearray.area', 'hcpv.cost.install_labor_perarea'):
('hcpv.cost.install_labor.totalcost'),
('total_installed_cost', 'hcpv.cost.modulearray.power'):
('hcpv.cost.installed_per_capacity'),
('hcpv.cost.land.per_acre', 'hcpv.cost.land_area.value', 'hcpv.cost.land.percent', 'total_direct_cost', 'hcpv.cost.modulearray.power', 'hcpv.cost.land.per_watt', 'hcpv.cost.land.fixed'):
('hcpv.cost.land.total'),
('hcpv.cost.inverter.costunits', 'hcpv.cost.inverter.num_units', 'hcpv.cost.inverter.power', 'hcpv.cost.per_inverter'):
('hcpv.cost.inverter.totalcost'),
('hcpv.cost.install_margin_fixed', 'hcpv.cost.modulearray.power', 'hcpv.cost.install_margin_perwatt', 'hcpv.cost.modulearray.area', 'hcpv.cost.install_margin_perarea'):
('hcpv.cost.install_margin.totalcost'),
('inv_snl_paco'):
('hcpv.cost.inverter.power'),
('array_num_inverters'):
('hcpv.cost.inverter.num_units'),
('hcpv.cost.module.power', 'hcpv.cost.module.num_units'):
('hcpv.cost.modulearray.power'),
('hcpv.module.power'):
('hcpv.cost.module.power'),
('hcpv.cost.landprep.per_acre', 'hcpv.cost.land_area.value', 'hcpv.cost.landprep.percent', 'total_direct_cost', 'hcpv.cost.modulearray.power', 'hcpv.cost.landprep.per_watt', 'hcpv.cost.landprep.fixed'):
('hcpv.cost.landprep.total'),
('hcpv.cost.permitting.percent', 'total_direct_cost', 'hcpv.cost.modulearray.power', 'hcpv.cost.permitting.per_watt', 'hcpv.cost.permitting.fixed'):
('hcpv.cost.permitting.total'),
('array_num_trackers', 'array_modules_per_tracker', 'hcpv.module.area'):
('hcpv.cost.modulearray.area'),
():
('system_use_recapitalization'),
('array_num_trackers', 'array_modules_per_tracker'):
('hcpv.cost.module.num_units'),
('hcpv.cost.contingency_percent', 'hcpv.cost.module.totalcost', 'hcpv.cost.inverter.totalcost', 'hcpv.cost.tracker.totalcost', 'hcpv.cost.bos_equip.totalcost', 'hcpv.cost.install_labor.totalcost', 'hcpv.cost.install_margin.totalcost'):
('hcpv.cost.contingency'),
('hcpv.cost.permitting.total', 'hcpv.cost.engr.total', 'hcpv.cost.grid.total', 'hcpv.cost.land.total', 'hcpv.cost.landprep.total', 'hcpv.cost.sales_tax.total'):
('total_indirect_cost'),
('hcpv.cost.module.costunits', 'hcpv.cost.module.num_units', 'hcpv.cost.module.power', 'hcpv.cost.per_module'):
('hcpv.cost.module.totalcost') },
'Linear Fresnel Solar Field': {
('csp.lf.sf.geom1_area_frac', 'csp.lf.geom1.rec_optical_derate', 'csp.lf.geom1.coll_opt_loss_norm_inc', 'csp.lf.sf.geom2_area_frac', 'csp.lf.geom2.rec_optical_derate', 'csp.lf.geom2.coll_opt_loss_norm_inc'):
('csp.lf.sf.dp.loop_opt_eff'),
('csp.lf.sf.dp.loop_opt_eff', 'csp.lf.sf.dp.loop_therm_eff', 'csp.lf.sf.dp.piping_therm_eff'):
('csp.lf.sf.dp.total_loop_conv_eff'),
('lat'):
('latitude'),
('csp.lf.sf.dp.sm1_aperture', 'csp.lf.sf.dp.loop_aperture'):
('csp.lf.sf.dp.sm1_numloops'),
('csp.lf.sf.dp.actual_aper'):
('csp.lf.sf.field_area'),
('demand_var', 'eta_ref', 'I_bn_des', 'csp.lf.sf.dp.total_loop_conv_eff'):
('csp.lf.sf.dp.sm1_aperture'),
('csp.lf.sf.sh_geom_unique', 'nModSH', 'csp.lf.geom2.refl_aper_area', 'nModBoil', 'csp.lf.geom1.refl_aper_area'):
('csp.lf.sf.geom2_area_frac'),
('csp.lf.sf.sh_geom_unique', 'nModBoil', 'csp.lf.geom1.refl_aper_area', 'nModSH', 'csp.lf.geom2.refl_aper_area'):
('csp.lf.sf.geom1_area_frac'),
('Pipe_hl_coef', 'T_cold_ref', 'T_hot', 'T_amb_des_sf', 'I_bn_des'):
('csp.lf.sf.dp.piping_therm_eff'),
('csp.lf.sf.dp.actual_aper', 'I_bn_des', 'csp.lf.sf.dp.total_loop_conv_eff'):
('q_max_aux'),
('csp.lf.sf.sh_geom_unique', 'nModBoil', 'nModSH', 'csp.lf.geom1.refl_aper_area', 'csp.lf.geom2.refl_aper_area'):
('csp.lf.sf.dp.loop_aperture'),
('csp.lf.sf.field_area', 'csp.lf.sf.area_multiplier'):
('csp.lf.sf.total_land_area'),
('csp.lf.sf.sm_or_area', 'csp.lf.sf.specified_solar_multiple', 'csp.lf.sf.dp.sm1_aperture', 'csp.lf.sf.specified_total_aperture', 'csp.lf.sf.dp.loop_aperture'):
('nLoops'),
('ColAz'):
('azimuth'),
('csp.lf.sf.dp.loop_aperture', 'nLoops'):
('csp.lf.sf.dp.actual_aper'),
('fP_hdr_c', 'fP_sf_boil', 'fP_boil_to_sh', 'fP_sf_sh', 'fP_hdr_h', 'P_turb_des'):
('csp.lf.sf.total_pres_drop'),
('csp.lf.sf.sm_or_area', 'csp.lf.sf.specified_solar_multiple', 'csp.lf.sf.dp.actual_aper', 'csp.lf.sf.dp.sm1_aperture'):
('solarm'),
('csp.lf.geom1.rec_thermal_derate', 'csp.lf.sf.geom1_area_frac', 'csp.lf.geom2.rec_thermal_derate', 'csp.lf.sf.geom2_area_frac'):
('csp.lf.sf.dp.loop_therm_eff'),
('P_boil_des'):
('P_turb_des') },
'Inverter Datasheet': {
('inv_ds_paco', 'inv_ds_eff'):
('inv_ds_pdco'),
('inv_ds_eff_type', 'inv_ds_paco'):
('inv_ds_pso_suggested'),
('inv_ds_eff_type', 'inv_ds_eff_weighted', 'inv_ds_eff_peak_or_nom'):
('inv_ds_eff'),
('inv_ds_paco'):
('inv_ds_pnt_suggested') },
'MSPT System Design': {
('tshours', 'solarm'):
('tshours_sf'),
('solarm', 'q_pb_design'):
('Q_rec_des'),
('P_ref', 'design_eff'):
('q_pb_design'),
('P_ref', 'gross_net_conversion_factor'):
('nameplate') },
'Molten Salt Linear Fresnel Solar Field': {
('fthrok'):
('fthr_ok'),
():
('nodes'),
():
('tc_void'),
():
('tc_fill'),
():
('tes_type'),
():
('t_ch_out_max'),
():
('fc_on'),
():
('f_tc_cold'),
('sm1_aperture', 'a_loop'):
('csp.mslf.sf.sm1_nLoops'),
('sf_q_design', 'I_bn_des', 'loop_eff'):
('sm1_aperture'),
('csp.mslf.sf.sm_or_area', 'solar_mult_spec', 'sm1_aperture', 'a_field', 'a_loop'):
('nLoops'),
('P_ref', 'eta_ref'):
('sf_q_design'),
('a_loop', 'nLoops'):
('a_sf_act'),
('csp.mslf.sf.sm_or_area', 'solar_mult_spec', 'a_sf_act', 'sm1_aperture'):
('solar_mult'),
('csp.mslf.sf.Fluid'):
('Fluid'),
('a_sf_act', 'I_bn_des', 'loop_eff'):
('field_thermal_output'),
('csp.mslf.sf.Fluid'):
('htf_max_opt_temp'),
('a_sf_act'):
('field_area'),
('csp.mslf.sf.Fluid'):
('htf_min_opt_temp'),
('nMod'):
('nSCA'),
('field_area', 'land_mult'):
('total_land_area'),
('opt_derate', 'opt_normal'):
('loop_opt_eff'),
('loop_opt_eff', 'hl_derate'):
('loop_eff'),
('hl_derate'):
('loop_therm_eff'),
('csp.mslf.sf.FieldConfig'):
('FieldConfig'),
('T_loop_out'):
('T_field_out_des'),
('csp.mslf.sf.fthrctrl'):
('fthrctrl'),
('nMod', 'A_aperture'):
('a_loop'),
():
('t_dis_out_min'),
('csp.mslf.sf.Fluid', 'Fluid', 'T_loop_in_des', 'T_loop_out', 'field_fl_props'):
('field_htf_cp_avg'),
('solar_mult'):
('solarm'),
('HTF_data'):
('field_fl_props'),
('Fluid'):
('field_fluid') },
'Linear Fresnel Collector and Receiver Header': {
('csp.lf.geom2.solpos_collinc_table'):
('sh_OpticalTable'),
('csp.lf.geom1.solpos_collinc_table'):
('b_OpticalTable'),
('csp.lf.geom2.var4.abs_emis'):
('sh_eps_HCE4'),
('csp.lf.geom2.var3.abs_emis'):
('sh_eps_HCE3'),
('csp.lf.geom2.var2.abs_emis'):
('sh_eps_HCE2'),
('csp.lf.geom2.var1.abs_emis'):
('sh_eps_HCE1'),
('csp.lf.geom1.var4.abs_emis'):
('b_eps_HCE4'),
('csp.lf.geom1.glazing_intact', 'csp.lf.geom2.glazing_intact'):
('GlazingIntactIn'),
('csp.lf.geom1.var1.abs_emis'):
('b_eps_HCE1'),
('csp.lf.geom1.var1.annulus_pressure', 'csp.lf.geom1.var2.annulus_pressure', 'csp.lf.geom1.var3.annulus_pressure', 'csp.lf.geom1.var4.annulus_pressure', 'csp.lf.geom2.var1.annulus_pressure', 'csp.lf.geom2.var2.annulus_pressure', 'csp.lf.geom2.var3.annulus_pressure', 'csp.lf.geom2.var4.annulus_pressure'):
('P_a'),
('csp.lf.geom1.annulus_gas', 'csp.lf.geom2.annulus_gas'):
('AnnulusGas'),
('csp.lf.geom1.var1.env_trans', 'csp.lf.geom1.var2.env_trans', 'csp.lf.geom1.var3.env_trans', 'csp.lf.geom1.var4.env_trans', 'csp.lf.geom2.var1.env_trans', 'csp.lf.geom2.var2.env_trans', 'csp.lf.geom2.var3.env_trans', 'csp.lf.geom2.var4.env_trans'):
('Tau_envelope'),
('csp.lf.geom1.var3.abs_emis'):
('b_eps_HCE3'),
('csp.lf.geom1.iamt0', 'csp.lf.geom1.iamt1', 'csp.lf.geom1.iamt2', 'csp.lf.geom1.iamt3', 'csp.lf.geom1.iamt4', 'csp.lf.geom2.iamt0', 'csp.lf.geom2.iamt1', 'csp.lf.geom2.iamt2', 'csp.lf.geom2.iamt3', 'csp.lf.geom2.iamt4'):
('IAM_T'),
('csp.lf.geom1.var1.env_emis', 'csp.lf.geom1.var2.env_emis', 'csp.lf.geom1.var3.env_emis', 'csp.lf.geom1.var4.env_emis', 'csp.lf.geom2.var1.env_emis', 'csp.lf.geom2.var2.env_emis', 'csp.lf.geom2.var3.env_emis', 'csp.lf.geom2.var4.env_emis'):
('EPSILON_4'),
('csp.lf.geom1.var1.env_abs', 'csp.lf.geom1.var2.env_abs', 'csp.lf.geom1.var3.env_abs', 'csp.lf.geom1.var4.env_abs', 'csp.lf.geom2.var1.env_abs', 'csp.lf.geom2.var2.env_abs', 'csp.lf.geom2.var3.env_abs', 'csp.lf.geom2.var4.env_abs'):
('alpha_env'),
('csp.lf.geom1.var2.abs_emis'):
('b_eps_HCE2'),
('csp.lf.geom1.var1.hce_dirt', 'csp.lf.geom1.var2.hce_dirt', 'csp.lf.geom1.var3.hce_dirt', 'csp.lf.geom1.var4.hce_dirt', 'csp.lf.geom2.var1.hce_dirt', 'csp.lf.geom2.var2.hce_dirt', 'csp.lf.geom2.var3.hce_dirt', 'csp.lf.geom2.var4.hce_dirt'):
('Dirt_HCE'),
('csp.lf.geom1.iaml0', 'csp.lf.geom1.iaml1', 'csp.lf.geom1.iaml2', 'csp.lf.geom1.iaml3', 'csp.lf.geom1.iaml4', 'csp.lf.geom2.iaml0', 'csp.lf.geom2.iaml1', 'csp.lf.geom2.iaml2', 'csp.lf.geom2.iaml3', 'csp.lf.geom2.iaml4'):
('IAM_L'),
('csp.lf.geom1.hlpolyw0', 'csp.lf.geom1.hlpolyw1', 'csp.lf.geom1.hlpolyw2', 'csp.lf.geom1.hlpolyw3', 'csp.lf.geom1.hlpolyw4', 'csp.lf.geom2.hlpolyw0', 'csp.lf.geom2.hlpolyw1', 'csp.lf.geom2.hlpolyw2', 'csp.lf.geom2.hlpolyw3', 'csp.lf.geom2.hlpolyw4'):
('HL_W'),
('csp.lf.geom1.var1.abs_abs', 'csp.lf.geom1.var2.abs_abs', 'csp.lf.geom1.var3.abs_abs', 'csp.lf.geom1.var4.abs_abs', 'csp.lf.geom2.var1.abs_abs', 'csp.lf.geom2.var2.abs_abs', 'csp.lf.geom2.var3.abs_abs', 'csp.lf.geom2.var4.abs_abs'):
('alpha_abs'),
('csp.lf.geom1.var1.bellows_shadowing', 'csp.lf.geom1.var2.bellows_shadowing', 'csp.lf.geom1.var3.bellows_shadowing', 'csp.lf.geom1.var4.bellows_shadowing', 'csp.lf.geom2.var1.bellows_shadowing', 'csp.lf.geom2.var2.bellows_shadowing', 'csp.lf.geom2.var3.bellows_shadowing', 'csp.lf.geom2.var4.bellows_shadowing'):
('Shadowing'),
('csp.lf.geom1.hlpolyt0', 'csp.lf.geom1.hlpolyt1', 'csp.lf.geom1.hlpolyt2', 'csp.lf.geom1.hlpolyt3', 'csp.lf.geom1.hlpolyt4', 'csp.lf.geom2.hlpolyt0', 'csp.lf.geom2.hlpolyt1', 'csp.lf.geom2.hlpolyt2', 'csp.lf.geom2.hlpolyt3', 'csp.lf.geom2.hlpolyt4'):
('HL_dT'),
('csp.lf.geom1.var1.rated_heat_loss', 'csp.lf.geom1.var2.rated_heat_loss', 'csp.lf.geom1.var3.rated_heat_loss', 'csp.lf.geom1.var4.rated_heat_loss', 'csp.lf.geom2.var1.rated_heat_loss', 'csp.lf.geom2.var2.rated_heat_loss', 'csp.lf.geom2.var3.rated_heat_loss', 'csp.lf.geom2.var4.rated_heat_loss'):
('Design_loss'),
('csp.lf.geom1.var1.field_fraction', 'csp.lf.geom1.var2.field_fraction', 'csp.lf.geom1.var3.field_fraction', 'csp.lf.geom1.var4.field_fraction', 'csp.lf.geom2.var1.field_fraction', 'csp.lf.geom2.var2.field_fraction', 'csp.lf.geom2.var3.field_fraction', 'csp.lf.geom2.var4.field_fraction'):
('HCE_FieldFrac'),
('csp.lf.geom1.refl_aper_area', 'csp.lf.geom2.refl_aper_area', 'csp.lf.geom1.coll_length', 'csp.lf.geom2.coll_length', 'csp.lf.geom1.opt_mode', 'csp.lf.geom2.opt_mode', 'csp.lf.geom1.track_error', 'csp.lf.geom2.track_error', 'csp.lf.geom1.geom_error', 'csp.lf.geom2.geom_error', 'csp.lf.geom1.mirror_refl', 'csp.lf.geom2.mirror_refl', 'csp.lf.geom1.soiling', 'csp.lf.geom2.soiling', 'csp.lf.geom1.general_error', 'csp.lf.geom2.general_error', 'csp.lf.geom1.hl_mode', 'csp.lf.geom2.hl_mode', 'csp.lf.geom1.diam_absorber_inner', 'csp.lf.geom2.diam_absorber_inner', 'csp.lf.geom1.diam_absorber_outer', 'csp.lf.geom2.diam_absorber_outer', 'csp.lf.geom1.diam_envelope_inner', 'csp.lf.geom2.diam_envelope_inner', 'csp.lf.geom1.diam_envelope_outer', 'csp.lf.geom2.diam_envelope_outer', 'csp.lf.geom1.diam_absorber_plug', 'csp.lf.geom2.diam_absorber_plug', 'csp.lf.geom1.inner_roughness', 'csp.lf.geom2.inner_roughness', 'csp.lf.geom1.flow_type', 'csp.lf.geom2.flow_type', 'csp.lf.geom1.absorber_material', 'csp.lf.geom2.absorber_material'):
('A_aperture', 'L_col', 'OptCharType', 'TrackingError', 'GeomEffects', 'rho_mirror_clean', 'dirt_mirror', 'error', 'HLCharType', 'D_2', 'D_3', 'D_4', 'D_5', 'D_p', 'Rough', 'Flow_type', 'AbsorberMaterial') }}
| 56.997615
| 1,454
| 0.718988
| 27,718
| 191,227
| 4.50285
| 0.048921
| 0.083647
| 0.025383
| 0.007131
| 0.751663
| 0.667254
| 0.570395
| 0.483936
| 0.395161
| 0.342753
| 0
| 0.016504
| 0.093177
| 191,227
| 3,355
| 1,455
| 56.997616
| 0.703239
| 0.00149
| 0
| 0.329838
| 1
| 0
| 0.75962
| 0.502309
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9313d061513a6b0ec76a69ef03ef05f69bec116b
| 1,883
|
py
|
Python
|
iot/devices/base/multimedia.py
|
joh90/iot
|
4a571be7e0760445dd2d5be858ecb4372b5d59b4
|
[
"MIT"
] | 6
|
2018-11-06T02:07:21.000Z
|
2021-12-15T07:56:14.000Z
|
iot/devices/base/multimedia.py
|
joh90/iot
|
4a571be7e0760445dd2d5be858ecb4372b5d59b4
|
[
"MIT"
] | 7
|
2019-06-17T15:50:22.000Z
|
2021-03-14T19:24:16.000Z
|
iot/devices/base/multimedia.py
|
joh90/iot
|
4a571be7e0760445dd2d5be858ecb4372b5d59b4
|
[
"MIT"
] | 1
|
2020-05-26T09:32:56.000Z
|
2020-05-26T09:32:56.000Z
|
from iot.devices.base import BaseDevice, BaseDeviceKeyboardInterface
class MultimediaKeyboardInterface(BaseDeviceKeyboardInterface):
def mute(self):
pass
def unmute(self):
pass
def channel_up(self):
pass
def channel_down(self):
pass
def volume_up(self):
pass
def volume_down(self):
pass
# TODO: implement menu -> up/down/left/right buttons
# def toggle_menu(self):
# pass
# def escape(self):
# pass
# def enter(self):
# pass
# def back(self):
# pass
# def up(self):
# pass
# def down(self):
# pass
# def left(self):
# pass
# def right(self):
# pass
class MultimediaDevice(BaseDevice, MultimediaKeyboardInterface):
def mute(self):
key = "mute"
self.fire_action(key)
def unmute(self):
key = "mute"
self.fire_action(key)
def channel_up(self):
key = "channel_up"
self.fire_action(key)
def channel_down(self):
key = "channel_down"
self.fire_action(key)
def volume_up(self):
key = "volume_up"
self.fire_action(key)
def volume_down(self):
key = "volume_down"
self.fire_action(key)
def toggle_menu(self):
key = "toggle_menu"
self.fire_action(key)
def escape(self):
key = "escape"
self.fire_action(key)
def enter(self):
key = "enter"
self.fire_action(key)
def back(self):
key = "back"
self.fire_action(key)
def up(self):
key = "up"
self.fire_action(key)
def down(self):
key = "down"
self.fire_action(key)
def left(self):
key = "left"
self.fire_action(key)
def right(self):
key = "right"
self.fire_action(key)
| 17.764151
| 68
| 0.55231
| 219
| 1,883
| 4.616438
| 0.146119
| 0.110781
| 0.193867
| 0.23541
| 0.322453
| 0.223541
| 0.061325
| 0.061325
| 0
| 0
| 0
| 0
| 0.340945
| 1,883
| 105
| 69
| 17.933333
| 0.814666
| 0.137546
| 0
| 0.596491
| 0
| 0
| 0.056663
| 0
| 0
| 0
| 0
| 0.009524
| 0
| 1
| 0.350877
| false
| 0.105263
| 0.017544
| 0
| 0.403509
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
9347fa0eda09f19d1ee81440118dc2f3dcebe9c3
| 312
|
py
|
Python
|
hackerrank/cracking-the-coding-interview/ctci-array-left-rotation.py
|
Ashindustry007/competitive-programming
|
2eabd3975c029d235abb7854569593d334acae2f
|
[
"WTFPL"
] | 506
|
2018-08-22T10:30:38.000Z
|
2022-03-31T10:01:49.000Z
|
hackerrank/cracking-the-coding-interview/ctci-array-left-rotation.py
|
Ashindustry007/competitive-programming
|
2eabd3975c029d235abb7854569593d334acae2f
|
[
"WTFPL"
] | 13
|
2019-08-07T18:31:18.000Z
|
2020-12-15T21:54:41.000Z
|
hackerrank/cracking-the-coding-interview/ctci-array-left-rotation.py
|
Ashindustry007/competitive-programming
|
2eabd3975c029d235abb7854569593d334acae2f
|
[
"WTFPL"
] | 234
|
2018-08-06T17:11:41.000Z
|
2022-03-26T10:56:42.000Z
|
#!/usr/bin/env python2
# https://www.hackerrank.com/challenges/ctci-array-left-rotation
def array_left_rotation(a, n, k):
return a[k:] + a[:k]
n, k = map(int, raw_input().strip().split(' '))
a = map(int, raw_input().strip().split(' '))
answer = array_left_rotation(a, n, k);
print ' '.join(map(str,answer))
| 31.2
| 64
| 0.657051
| 52
| 312
| 3.826923
| 0.538462
| 0.135678
| 0.256281
| 0.180905
| 0.442211
| 0.442211
| 0
| 0
| 0
| 0
| 0
| 0.003623
| 0.115385
| 312
| 9
| 65
| 34.666667
| 0.717391
| 0.269231
| 0
| 0
| 0
| 0
| 0.013274
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.166667
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
fa79247db1662c5181bd2b9af6d3c1b0be91db50
| 162
|
py
|
Python
|
rectifai/__init__.py
|
Sushil-Thapa/rectif.ai
|
b308f613402097dca9734806a8c27ba3eef6a358
|
[
"Apache-2.0"
] | null | null | null |
rectifai/__init__.py
|
Sushil-Thapa/rectif.ai
|
b308f613402097dca9734806a8c27ba3eef6a358
|
[
"Apache-2.0"
] | null | null | null |
rectifai/__init__.py
|
Sushil-Thapa/rectif.ai
|
b308f613402097dca9734806a8c27ba3eef6a358
|
[
"Apache-2.0"
] | null | null | null |
import sys
if sys.version_info < (3, 6, 1):
raise RuntimeError("Rectif.ai requires Python 3.6 or later")
from rectifai.version import VERSION as __version__
| 27
| 64
| 0.753086
| 26
| 162
| 4.5
| 0.730769
| 0.034188
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036765
| 0.160494
| 162
| 6
| 65
| 27
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0.233129
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
faa1094d023cea845c602537ac45b5290ca9f034
| 122
|
py
|
Python
|
django_comments_tree/forms/__init__.py
|
sharpertool/django-comments-tree
|
2f86f694d127b1722baf7d025eb5fd22b184b88f
|
[
"BSD-2-Clause"
] | 13
|
2019-06-03T07:39:34.000Z
|
2021-11-10T06:55:35.000Z
|
django_comments_tree/forms/__init__.py
|
sharpertool/django-comments-tree
|
2f86f694d127b1722baf7d025eb5fd22b184b88f
|
[
"BSD-2-Clause"
] | 2
|
2019-08-08T05:24:28.000Z
|
2019-12-23T23:34:58.000Z
|
django_comments_tree/forms/__init__.py
|
sharpertool/django-comments-tree
|
2f86f694d127b1722baf7d025eb5fd22b184b88f
|
[
"BSD-2-Clause"
] | 5
|
2019-12-20T14:57:14.000Z
|
2021-03-22T18:52:40.000Z
|
from .forms import TreeCommentForm # noqa
from .base import CommentSecurityForm, CommentDetailsForm, CommentForm # noqa
| 40.666667
| 78
| 0.819672
| 12
| 122
| 8.333333
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131148
| 122
| 2
| 79
| 61
| 0.943396
| 0.07377
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
fab1761fef14fc1fbb6ccaeb3da3c5f1c8f8705a
| 52
|
py
|
Python
|
atmos_space_flight/Python/spacethruster.py
|
als0052/AtmosSpaceDynamics
|
acf20f4ba320f55bf7e33d959539e7938a4b24d2
|
[
"CNRI-Python"
] | null | null | null |
atmos_space_flight/Python/spacethruster.py
|
als0052/AtmosSpaceDynamics
|
acf20f4ba320f55bf7e33d959539e7938a4b24d2
|
[
"CNRI-Python"
] | null | null | null |
atmos_space_flight/Python/spacethruster.py
|
als0052/AtmosSpaceDynamics
|
acf20f4ba320f55bf7e33d959539e7938a4b24d2
|
[
"CNRI-Python"
] | null | null | null |
#!/usr/bin/env python
# Filename: spacethruster.py
| 13
| 28
| 0.730769
| 7
| 52
| 5.428571
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 52
| 3
| 29
| 17.333333
| 0.826087
| 0.903846
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
fabe438e1b84771ccae2bf36ef066266a08e4ac4
| 120
|
py
|
Python
|
Desafios/desafio57.py
|
gustavodoamaral/115_Desafios_Python
|
8baa1c0353a40f7a63f442293bc0f6852fd94da0
|
[
"MIT"
] | 1
|
2022-02-07T01:12:19.000Z
|
2022-02-07T01:12:19.000Z
|
Desafios/desafio57.py
|
gustavodoamaral/desafios_python_gustavo_guanabara
|
8baa1c0353a40f7a63f442293bc0f6852fd94da0
|
[
"MIT"
] | null | null | null |
Desafios/desafio57.py
|
gustavodoamaral/desafios_python_gustavo_guanabara
|
8baa1c0353a40f7a63f442293bc0f6852fd94da0
|
[
"MIT"
] | null | null | null |
sexo = str(input("Digite o sexo "))
while sexo != "M" and sexo != "F":
sexo = str(input("Digite um sexo válido: "))
| 40
| 48
| 0.591667
| 19
| 120
| 3.736842
| 0.578947
| 0.197183
| 0.338028
| 0.507042
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.208333
| 120
| 3
| 48
| 40
| 0.747368
| 0
| 0
| 0
| 0
| 0
| 0.322314
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
fabf46127b5b7ca391cc3644f5ca8267535912c4
| 59
|
py
|
Python
|
tcga/strings/__init__.py
|
numpde/tcga
|
a7df66530a0249b82788f6367b9642b68eaf6ec5
|
[
"MIT"
] | 2
|
2020-06-30T13:15:14.000Z
|
2021-08-04T07:46:02.000Z
|
tcga/strings/__init__.py
|
numpde/tcga
|
a7df66530a0249b82788f6367b9642b68eaf6ec5
|
[
"MIT"
] | null | null | null |
tcga/strings/__init__.py
|
numpde/tcga
|
a7df66530a0249b82788f6367b9642b68eaf6ec5
|
[
"MIT"
] | null | null | null |
from .pearls import reverse, triplets, kplets, nnna, lines
| 29.5
| 58
| 0.779661
| 8
| 59
| 5.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135593
| 59
| 1
| 59
| 59
| 0.901961
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
fada93c81e15c707eb616df53f5c47c2285d3c07
| 173
|
py
|
Python
|
bloomfilter/__init__.py
|
pombredanne/bloomfilter-py
|
8e90c0ae702717107ac689a8fc017e4e1ef78723
|
[
"MIT"
] | 1
|
2019-04-22T16:43:11.000Z
|
2019-04-22T16:43:11.000Z
|
bloomfilter/__init__.py
|
pombredanne/bloomfilter-py
|
8e90c0ae702717107ac689a8fc017e4e1ef78723
|
[
"MIT"
] | null | null | null |
bloomfilter/__init__.py
|
pombredanne/bloomfilter-py
|
8e90c0ae702717107ac689a8fc017e4e1ef78723
|
[
"MIT"
] | null | null | null |
'''package bloomfilter'''
# pylint: disable=no-name-in-module
from ._bloomfilter import BloomFilter, RotatingBloomFilter
__all__ = ['BloomFilter', 'RotatingBloomFilter']
| 21.625
| 58
| 0.774566
| 16
| 173
| 8.0625
| 0.75
| 0.465116
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098266
| 173
| 7
| 59
| 24.714286
| 0.826923
| 0.312139
| 0
| 0
| 0
| 0
| 0.265487
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
fae3e265daf334829d8eee3919804eb61a836746
| 383
|
py
|
Python
|
tests/tests_imagemagick.py
|
sjktje/sjkscan
|
c2b933797125a323864543c95d7920cf1f396d1e
|
[
"BSD-2-Clause"
] | null | null | null |
tests/tests_imagemagick.py
|
sjktje/sjkscan
|
c2b933797125a323864543c95d7920cf1f396d1e
|
[
"BSD-2-Clause"
] | 3
|
2016-02-10T22:46:51.000Z
|
2016-02-26T21:30:46.000Z
|
tests/tests_imagemagick.py
|
sjktje/sjkscan
|
c2b933797125a323864543c95d7920cf1f396d1e
|
[
"BSD-2-Clause"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
import unittest
class TestBinariesInPath(unittest.TestCase):
"""
TODO: Docstring
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_identify_binary_in_path(self):
self.assertIsNotNone(shutil.which('identify'))
if __name__ == "__main__":
unittest.main()
| 14.730769
| 54
| 0.629243
| 42
| 383
| 5.452381
| 0.714286
| 0.069869
| 0.09607
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003436
| 0.240209
| 383
| 25
| 55
| 15.32
| 0.783505
| 0.151436
| 0
| 0.181818
| 0
| 0
| 0.052117
| 0
| 0
| 0
| 0
| 0.04
| 0.090909
| 1
| 0.272727
| false
| 0.181818
| 0.181818
| 0
| 0.545455
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
faf57119b2e59bd038218ef23acea0d17a945cdf
| 453
|
py
|
Python
|
transformers/data/__init__.py
|
Orange-trees/-transformers
|
8c19f71699d2a241439fc010d9c548615f520e03
|
[
"Apache-2.0"
] | 2
|
2020-02-06T06:59:08.000Z
|
2020-05-25T03:32:33.000Z
|
transformers/data/__init__.py
|
Orange-trees/-transformers
|
8c19f71699d2a241439fc010d9c548615f520e03
|
[
"Apache-2.0"
] | null | null | null |
transformers/data/__init__.py
|
Orange-trees/-transformers
|
8c19f71699d2a241439fc010d9c548615f520e03
|
[
"Apache-2.0"
] | null | null | null |
from .processors import InputExample, InputFeatures, DataProcessor
from .processors import glue_output_modes, glue_processors, glue_tasks_num_labels, glue_convert_examples_to_features
from .processors import my_output_modes, my_processors, my_tasks_num_labels, my_convert_examples_to_features
from .metrics import is_sklearn_available
if is_sklearn_available():
from .metrics import glue_compute_metrics
from .metrics import my_compute_metrics
| 50.333333
| 116
| 0.86755
| 62
| 453
| 5.887097
| 0.370968
| 0.115068
| 0.164384
| 0.136986
| 0.158904
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094923
| 453
| 8
| 117
| 56.625
| 0.890244
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.857143
| 0
| 0.857143
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
87c554ac670d6b631dde66b6b6a6dca34cee7379
| 14,306
|
py
|
Python
|
argopy/tests/test_data_fetchers.py
|
jtomfarrar/argopy
|
19c6e76b8594e9f6a59b27abc9fce93ed0219445
|
[
"Apache-2.0"
] | null | null | null |
argopy/tests/test_data_fetchers.py
|
jtomfarrar/argopy
|
19c6e76b8594e9f6a59b27abc9fce93ed0219445
|
[
"Apache-2.0"
] | null | null | null |
argopy/tests/test_data_fetchers.py
|
jtomfarrar/argopy
|
19c6e76b8594e9f6a59b27abc9fce93ed0219445
|
[
"Apache-2.0"
] | null | null | null |
#!/bin/env python
# -*coding: UTF-8 -*-
#
# Test data fetchers
#
# This is not designed as it should
# We need to have:
# - one class to test the facade API
# - one class to test specific methods of each backends
#
# At this point, we are testing real data fetching both through facade and through direct call to backends
import os
import sys
import numpy as np
import xarray as xr
import shutil
import pytest
import unittest
from unittest import TestCase
import argopy
from argopy import DataFetcher as ArgoDataFetcher
from argopy.errors import InvalidFetcherAccessPoint, InvalidFetcher, ErddapServerError
from argopy.utilities import list_available_data_src, isconnected, erddap_ds_exists
AVAILABLE_SOURCES = list_available_data_src()
CONNECTED = isconnected()
if CONNECTED:
DSEXISTS = erddap_ds_exists(ds="ArgoFloats")
DSEXISTS_bgc = erddap_ds_exists(ds="ArgoFloats-bio")
DSEXISTS_ref = erddap_ds_exists(ds="ArgoFloats-ref")
else:
DSEXISTS = False
DSEXISTS_bgc = False
DSEXISTS_ref = False
# List tests:
def test_invalid_accesspoint():
with pytest.raises(InvalidFetcherAccessPoint):
ArgoDataFetcher().invalid_accesspoint.to_xarray()
def test_invalid_fetcher():
with pytest.raises(InvalidFetcher):
ArgoDataFetcher().to_xarray() # Can't get data if access point not defined first
@unittest.skipUnless('localftp' in AVAILABLE_SOURCES, "requires localftp data fetcher")
def test_unavailable_accesspoint():
with pytest.raises(InvalidFetcherAccessPoint):
ArgoDataFetcher(src='localftp').region([-85,-45,10.,20.,0,100.]).to_xarray()
class EntryPoints_AllBackends(TestCase):
""" Test main API facade for all available fetching backends and default dataset """
def setUp(self):
#todo Determine the list of output format to test
# what else beyond .to_xarray() ?
self.fetcher_opts = {}
# Define API entry point options to tests:
self.args = {}
self.args['float'] = [[5900446],
[6901929, 3902131]]
self.args['profile'] = [[2902696, 12],
[2902269, np.arange(12, 14)], [2901746, [1, 6]]]
self.args['region'] = [[-70, -65, 30., 35., 0, 10.],
[-70, -65, 30., 35., 0, 10., '2012-01-01', '2012-06-30']]
def __test_float(self, bk, **ftc_opts):
""" Test float for a given backend """
for arg in self.args['float']:
options = {**self.fetcher_opts, **ftc_opts}
try:
ds = ArgoDataFetcher(src=bk, **options).float(arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
def __test_profile(self, bk):
""" Test float for a given backend """
for arg in self.args['profile']:
try:
ds = ArgoDataFetcher(src=bk).profile(*arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
def __test_region(self, bk):
""" Test float for a given backend """
for arg in self.args['region']:
try:
ds = ArgoDataFetcher(src=bk).region(arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
@unittest.skipUnless('erddap' in AVAILABLE_SOURCES, "requires erddap data fetcher")
@unittest.skipUnless(CONNECTED, "erddap requires an internet connection")
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_float_erddap(self):
self.__test_float('erddap')
@unittest.skipUnless('erddap' in AVAILABLE_SOURCES, "requires erddap data fetcher")
@unittest.skipUnless(CONNECTED, "erddap requires an internet connection")
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_profile_erddap(self):
self.__test_profile('erddap')
@unittest.skipUnless('erddap' in AVAILABLE_SOURCES, "requires erddap data fetcher")
@unittest.skipUnless(CONNECTED, "erddap requires an internet connection")
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_region_erddap(self):
self.__test_region('erddap')
@unittest.skipUnless('localftp' in AVAILABLE_SOURCES, "requires localftp data fetcher")
def test_float_localftp(self):
ftproot, flist = argopy.tutorial.open_dataset('localftp')
with argopy.set_options(local_ftp=os.path.join(ftproot,'dac')):
self.__test_float('localftp', )
@unittest.skipUnless('localftp' in AVAILABLE_SOURCES, "requires localftp data fetcher")
def test_profile_localftp(self):
ftproot, flist = argopy.tutorial.open_dataset('localftp')
with argopy.set_options(local_ftp=os.path.join(ftproot,'dac')):
self.__test_profile('localftp')
@unittest.skipUnless('argovis' in AVAILABLE_SOURCES, "requires argovis data fetcher")
@unittest.skipUnless(CONNECTED, "argovis requires an internet connection")
def test_float_argovis(self):
self.__test_float('argovis')
@unittest.skipUnless('erddap' in AVAILABLE_SOURCES, "requires erddap data fetcher")
@unittest.skipUnless(CONNECTED, "erddap requires an internet connection")
class Erddap_backend(TestCase):
""" Test main API facade for all available dataset of the ERDDAP fetching backend """
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_cachepath(self):
assert isinstance(ArgoDataFetcher(src='erddap').profile(6902746, 34).fetcher.cachepath, str) == True
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_caching_float(self):
cachedir = os.path.expanduser(os.path.join("~",".argopytest_tmp"))
try:
# 1st call to load from erddap and save to cachedir:
ds = ArgoDataFetcher(src='erddap', cache=True, cachedir=cachedir).float([1901393, 6902746]).to_xarray()
# 2nd call to load from cached file
ds = ArgoDataFetcher(src='erddap', cache=True, cachedir=cachedir).float([1901393, 6902746]).to_xarray()
assert isinstance(ds, xr.Dataset) == True
shutil.rmtree(cachedir)
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
shutil.rmtree(cachedir)
pass
except:
shutil.rmtree(cachedir)
raise
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_caching_profile(self):
cachedir = os.path.expanduser(os.path.join("~",".argopytest_tmp"))
try:
# 1st call to load from erddap and save to cachedir:
ds = ArgoDataFetcher(src='erddap', cache=True, cachedir=cachedir).profile(6902746, 34).to_xarray()
# 2nd call to load from cached file
ds = ArgoDataFetcher(src='erddap', cache=True, cachedir=cachedir).profile(6902746, 34).to_xarray()
assert isinstance(ds, xr.Dataset) == True
shutil.rmtree(cachedir)
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
shutil.rmtree(cachedir)
pass
except:
shutil.rmtree(cachedir)
raise
def test_N_POINTS(self):
n = ArgoDataFetcher(src='erddap').region([-70, -65, 35., 40., 0, 10., '2012-01', '2013-12']).fetcher.N_POINTS
assert isinstance(n, int) == True
def __testthis(self, dataset):
for access_point in self.args:
if access_point == 'profile':
for arg in self.args['profile']:
try:
ds = ArgoDataFetcher(src='erddap', ds=dataset).profile(*arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
except:
print("ERDDAP request:\n",
ArgoDataFetcher(src='erddap', ds=dataset).profile(*arg).fetcher.url)
pass
if access_point == 'float':
for arg in self.args['float']:
try:
ds = ArgoDataFetcher(src='erddap', ds=dataset).float(arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
except:
print("ERDDAP request:\n",
ArgoDataFetcher(src='erddap', ds=dataset).float(arg).fetcher.url)
pass
if access_point == 'region':
for arg in self.args['region']:
try:
ds = ArgoDataFetcher(src='erddap', ds=dataset).region(arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except ErddapServerError: # Test is passed when something goes wrong because of the erddap server, not our fault !
pass
except:
print("ERDDAP request:\n",
ArgoDataFetcher(src='erddap', ds=dataset).region(arg).fetcher.url)
pass
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_phy_float(self):
self.args = {}
self.args['float'] = [[1901393],
[1901393, 6902746]]
self.__testthis('phy')
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_phy_profile(self):
self.args = {}
self.args['profile'] = [[6902746, 34],
[6902746, np.arange(12, 13)], [6902746, [1, 12]]]
self.__testthis('phy')
@unittest.skipUnless(DSEXISTS, "erddap requires a valid core Argo dataset from Ifremer server")
def test_phy_region(self):
self.args = {}
self.args['region'] = [[-70, -65, 35., 40., 0, 10.],
[-70, -65, 35., 40., 0, 10., '2012-01', '2013-12']]
self.__testthis('phy')
@unittest.skipUnless(DSEXISTS_bgc, "erddap requires a valid BGC Argo dataset from Ifremer server")
def test_bgc_float(self):
self.args = {}
self.args['float'] = [[5903248],
[7900596, 2902264]]
self.__testthis('bgc')
@unittest.skipUnless(DSEXISTS_bgc, "erddap requires a valid BGC Argo dataset from Ifremer server")
def test_bgc_profile(self):
self.args = {}
self.args['profile'] = [[5903248, 34],
[5903248, np.arange(12, 14)], [5903248, [1, 12]]]
self.__testthis('bgc')
@unittest.skipUnless(DSEXISTS_bgc, "erddap requires a valid BGC Argo dataset from Ifremer server")
def test_bgc_region(self):
self.args = {}
self.args['region'] = [[-70, -65, 35., 40., 0, 10.],
[-70, -65, 35., 40., 0, 10., '2012-01-1', '2012-12-31']]
self.__testthis('bgc')
@unittest.skipUnless(DSEXISTS_ref, "erddap requires a valid Reference Argo dataset from Ifremer server")
def test_ref_region(self):
self.args = {}
self.args['region'] = [[-70, -65, 35., 40., 0, 10.],
[-70, -65, 35., 40., 0, 10., '2012-01-01', '2012-12-31']]
self.__testthis('ref')
@unittest.skipUnless('localftp' in AVAILABLE_SOURCES, "requires localftp data fetcher")
class LocalFTP_DataSets(TestCase):
""" Test main API facade for all available dataset of the localftp fetching backend """
def __testthis(self, dataset):
ftproot, flist = argopy.tutorial.open_dataset('localftp')
self.local_ftp = os.path.join(ftproot, 'dac')
for access_point in self.args:
if access_point == 'profile':
for arg in self.args['profile']:
with argopy.set_options(local_ftp=self.local_ftp):
try:
ds = ArgoDataFetcher(src='localftp', ds=dataset).profile(*arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except:
print("LOCALFTP request:\n",
ArgoDataFetcher(src='localftp', ds=dataset).profile(*arg).fetcher.files)
pass
if access_point == 'float':
for arg in self.args['float']:
with argopy.set_options(local_ftp=self.local_ftp):
try:
ds = ArgoDataFetcher(src='localftp', ds=dataset).float(arg).to_xarray()
assert isinstance(ds, xr.Dataset) == True
except:
print("LOCALFTP request:\n",
ArgoDataFetcher(src='localftp', ds=dataset).float(arg).fetcher.files)
pass
def test_phy_float(self):
self.args = {}
self.args['float'] = [[5900446],
[6901929, 3902131]]
self.__testthis('phy')
def test_phy_profile(self):
self.args = {}
self.args['profile'] = [[2902696, 12],
[2902269, np.arange(12, 14)],
[2901746, [1, 6]]]
self.__testthis('phy')
if __name__ == '__main__':
unittest.main()
| 45.56051
| 134
| 0.602894
| 1,631
| 14,306
| 5.177805
| 0.134887
| 0.030314
| 0.040024
| 0.030787
| 0.764239
| 0.741385
| 0.715335
| 0.676613
| 0.671877
| 0.663943
| 0
| 0.043555
| 0.287432
| 14,306
| 314
| 135
| 45.56051
| 0.784873
| 0.117573
| 0
| 0.597561
| 0
| 0
| 0.153411
| 0
| 0
| 0
| 0
| 0.003185
| 0.04878
| 1
| 0.113821
| false
| 0.052846
| 0.04878
| 0
| 0.174797
| 0.020325
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
87fc0a59c685833c9a1bc64601915392df6a6cd6
| 383
|
py
|
Python
|
helpers/apachectl.py
|
tomekp97/vhost-setup
|
a0701175aa681f07037ff0e9a9b1b0060806fd39
|
[
"MIT"
] | null | null | null |
helpers/apachectl.py
|
tomekp97/vhost-setup
|
a0701175aa681f07037ff0e9a9b1b0060806fd39
|
[
"MIT"
] | null | null | null |
helpers/apachectl.py
|
tomekp97/vhost-setup
|
a0701175aa681f07037ff0e9a9b1b0060806fd39
|
[
"MIT"
] | null | null | null |
import os
def apachectl(vhost_name):
os.system("sudo apachectl configtest")
a2ensite(vhost_name)
systemctl_reload_apache2()
def a2ensite(vhost_name):
return os.system("sudo a2ensite " + vhost_name)
def a2dissite(vhost_name):
return os.system("sudo a2dissite " + vhost_name)
def systemctl_reload_apache2():
return os.system("sudo systemctl reload apache2")
| 25.533333
| 53
| 0.746736
| 50
| 383
| 5.52
| 0.3
| 0.195652
| 0.173913
| 0.195652
| 0.195652
| 0.195652
| 0
| 0
| 0
| 0
| 0
| 0.024691
| 0.154047
| 383
| 15
| 53
| 25.533333
| 0.82716
| 0
| 0
| 0
| 0
| 0
| 0.216146
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.363636
| false
| 0
| 0.090909
| 0.272727
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
87fc61b213bc4c2ba9618586af6bf70f3c141b56
| 200
|
py
|
Python
|
uq/ps2/earth.py
|
nicholasmalaya/paleologos
|
11959056caa80d3c910759b714a0f8e42f986f0f
|
[
"MIT"
] | 1
|
2021-11-04T17:49:42.000Z
|
2021-11-04T17:49:42.000Z
|
uq/ps2/earth.py
|
nicholasmalaya/paleologos
|
11959056caa80d3c910759b714a0f8e42f986f0f
|
[
"MIT"
] | null | null | null |
uq/ps2/earth.py
|
nicholasmalaya/paleologos
|
11959056caa80d3c910759b714a0f8e42f986f0f
|
[
"MIT"
] | 2
|
2019-01-04T16:08:18.000Z
|
2019-12-16T19:34:24.000Z
|
#!/bin/py
#
G = 6.67384 * 10**-11
M = 5.97219 * 10**24
r = 6.371 * 10**6
rv = r + 35
print 'G : ', G
print 'M : ', M
print 'r : ', r
print 'rv: ', rv
print 'g: ', G*M/(rv*rv)
#
# nick
# 3/11/14
#
| 11.111111
| 24
| 0.455
| 42
| 200
| 2.166667
| 0.452381
| 0.131868
| 0.153846
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.234483
| 0.275
| 200
| 17
| 25
| 11.764706
| 0.393103
| 0.105
| 0
| 0
| 0
| 0
| 0.109827
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.555556
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
e21745222f2a86737cf2a0708a1b19dcfc63e4e2
| 156
|
py
|
Python
|
src/decisionengine_modules/GCE/sources/GceBurnRateSourceProxy.py
|
hyunwoo18/decisionengine_modules
|
a67462628c2074e768d0825edee4ee5d570030e0
|
[
"BSD-3-Clause"
] | null | null | null |
src/decisionengine_modules/GCE/sources/GceBurnRateSourceProxy.py
|
hyunwoo18/decisionengine_modules
|
a67462628c2074e768d0825edee4ee5d570030e0
|
[
"BSD-3-Clause"
] | null | null | null |
src/decisionengine_modules/GCE/sources/GceBurnRateSourceProxy.py
|
hyunwoo18/decisionengine_modules
|
a67462628c2074e768d0825edee4ee5d570030e0
|
[
"BSD-3-Clause"
] | null | null | null |
from decisionengine.framework.modules import Source, SourceProxy
GceBurnRateSourceProxy = SourceProxy.SourceProxy
Source.describe(GceBurnRateSourceProxy)
| 26
| 64
| 0.878205
| 13
| 156
| 10.538462
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070513
| 156
| 5
| 65
| 31.2
| 0.944828
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
356af25699b3d14b3e535637f21bc38773761ae8
| 691
|
py
|
Python
|
ELEMENTARY/BetweenMarkers.py
|
estoyun/CheckiO_Solutions_Python
|
037177a415915903961b7f7c351b752aae2d7a4d
|
[
"MIT"
] | null | null | null |
ELEMENTARY/BetweenMarkers.py
|
estoyun/CheckiO_Solutions_Python
|
037177a415915903961b7f7c351b752aae2d7a4d
|
[
"MIT"
] | null | null | null |
ELEMENTARY/BetweenMarkers.py
|
estoyun/CheckiO_Solutions_Python
|
037177a415915903961b7f7c351b752aae2d7a4d
|
[
"MIT"
] | null | null | null |
def between_markers(text: str, begin: str, end: str) -> str:
"""
returns substring between two given markers
"""
# your code here
return text[text.find(begin)+1:text.find(end)]
if __name__ == '__main__':
print('Example:')
print(between_markers('What is >apple<', '>', '<'))
# These "asserts" are used for self-checking and not for testing
assert between_markers('What is >apple<', '>', '<') == "apple"
assert between_markers('What is [apple]', '[', ']') == "apple"
assert between_markers('What is ><', '>', '<') == ""
assert between_markers('>apple<', '>', '<') == "apple"
print('Wow, you are doing pretty good. Time to check it!')
| 36.368421
| 68
| 0.596237
| 85
| 691
| 4.682353
| 0.529412
| 0.211055
| 0.180905
| 0.201005
| 0.309045
| 0.246231
| 0.246231
| 0.246231
| 0.246231
| 0.246231
| 0
| 0.001825
| 0.206946
| 691
| 18
| 69
| 38.388889
| 0.724453
| 0.176556
| 0
| 0
| 0
| 0
| 0.277372
| 0
| 0
| 0
| 0
| 0.055556
| 0.4
| 1
| 0.1
| false
| 0
| 0
| 0
| 0.2
| 0.3
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
356b6d1cb91f0dc42a46dedde8b6fd6419c60137
| 25
|
py
|
Python
|
ceph_deploy/__init__.py
|
osynge/ceph-deploy
|
8cd1e4e03fddef953c67501573030cfedf5aa70d
|
[
"MIT"
] | null | null | null |
ceph_deploy/__init__.py
|
osynge/ceph-deploy
|
8cd1e4e03fddef953c67501573030cfedf5aa70d
|
[
"MIT"
] | null | null | null |
ceph_deploy/__init__.py
|
osynge/ceph-deploy
|
8cd1e4e03fddef953c67501573030cfedf5aa70d
|
[
"MIT"
] | null | null | null |
__version__ = '1.5.28'
| 6.25
| 22
| 0.6
| 4
| 25
| 2.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.2
| 25
| 3
| 23
| 8.333333
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
35912f6abb5210d8be56084ea503472c1a61a899
| 24
|
py
|
Python
|
Scripts/material_test_render.py
|
htung0101/bvp
|
db318b11d5c41efd59dd04038d41c03500e5c8e1
|
[
"BSD-2-Clause"
] | 2
|
2017-12-22T05:31:50.000Z
|
2019-04-08T19:23:15.000Z
|
Scripts/material_test_render.py
|
htung0101/bvp
|
db318b11d5c41efd59dd04038d41c03500e5c8e1
|
[
"BSD-2-Clause"
] | 10
|
2016-07-28T01:24:48.000Z
|
2017-05-30T06:53:08.000Z
|
Scripts/material_test_render.py
|
htung0101/bvp
|
db318b11d5c41efd59dd04038d41c03500e5c8e1
|
[
"BSD-2-Clause"
] | 1
|
2021-01-03T14:35:18.000Z
|
2021-01-03T14:35:18.000Z
|
# Render materials
blah
| 8
| 18
| 0.791667
| 3
| 24
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 24
| 3
| 19
| 8
| 0.95
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3591aa4c9902072735efb004e2bdac54e516fb35
| 139
|
py
|
Python
|
7.addBorder.py
|
nhannt201/100AlgorithmsChallenge_Python
|
9547652d9f3d4a992245e1d79c5824934322cbfc
|
[
"Apache-2.0"
] | null | null | null |
7.addBorder.py
|
nhannt201/100AlgorithmsChallenge_Python
|
9547652d9f3d4a992245e1d79c5824934322cbfc
|
[
"Apache-2.0"
] | null | null | null |
7.addBorder.py
|
nhannt201/100AlgorithmsChallenge_Python
|
9547652d9f3d4a992245e1d79c5824934322cbfc
|
[
"Apache-2.0"
] | null | null | null |
#addBorder
picture = ["abc", "ded"]
def addBorder(mang):
print("*****")
for x in mang:
print("*"+x+"*")
print("*****")
| 17.375
| 24
| 0.460432
| 15
| 139
| 4.266667
| 0.666667
| 0.28125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.244604
| 139
| 7
| 25
| 19.857143
| 0.609524
| 0.064748
| 0
| 0.333333
| 0
| 0
| 0.139535
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0
| 0
| 0.166667
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
35a076b92afb62dc1c242ab16d2a03f71ffaab8f
| 46
|
py
|
Python
|
apps/utils/__init__.py
|
danielzk/personal-website
|
3707fc74d671a385613798afb1b52bc089ef2055
|
[
"MIT"
] | 9
|
2018-11-28T07:36:37.000Z
|
2022-02-04T12:56:11.000Z
|
{{cookiecutter.project_slug}}/backend/apps/utils/__init__.py
|
danielzk/django-react-boilerplate
|
017fbce03d00c5de3c713f0bf8e6286a3ac2177d
|
[
"Unlicense"
] | 154
|
2018-11-22T14:41:17.000Z
|
2022-02-12T08:48:57.000Z
|
{{cookiecutter.project_slug}}/backend/apps/utils/__init__.py
|
danielzk/django-react-boilerplate
|
017fbce03d00c5de3c713f0bf8e6286a3ac2177d
|
[
"Unlicense"
] | 10
|
2018-11-13T06:57:10.000Z
|
2022-03-21T13:04:49.000Z
|
default_app_config = 'utils.apps.UtilsConfig'
| 23
| 45
| 0.826087
| 6
| 46
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065217
| 46
| 1
| 46
| 46
| 0.837209
| 0
| 0
| 0
| 0
| 0
| 0.478261
| 0.478261
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
35af20b7583b90cc12e1bde5dc5c374dc51e4a2c
| 169
|
py
|
Python
|
storage/models/_storage_entry_model.py
|
parveenchahal/python-common
|
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
|
[
"MIT"
] | null | null | null |
storage/models/_storage_entry_model.py
|
parveenchahal/python-common
|
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
|
[
"MIT"
] | null | null | null |
storage/models/_storage_entry_model.py
|
parveenchahal/python-common
|
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
|
[
"MIT"
] | null | null | null |
from ... import Model
from dataclasses import dataclass
@dataclass
class StorageEntryModel(Model):
id: str
partition_key: str
data: dict
etag: str = '*'
| 18.777778
| 33
| 0.692308
| 20
| 169
| 5.8
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.218935
| 169
| 9
| 34
| 18.777778
| 0.878788
| 0
| 0
| 0
| 0
| 0
| 0.005882
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.25
| 0
| 0.875
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
ea16c41281696b0cabb10b849e5a8685ab639660
| 141
|
py
|
Python
|
pystim/images/base.py
|
balefebvre/pystim
|
ae51d8a4b478da6dec44b296407099c6257fa3fa
|
[
"MIT"
] | null | null | null |
pystim/images/base.py
|
balefebvre/pystim
|
ae51d8a4b478da6dec44b296407099c6257fa3fa
|
[
"MIT"
] | null | null | null |
pystim/images/base.py
|
balefebvre/pystim
|
ae51d8a4b478da6dec44b296407099c6257fa3fa
|
[
"MIT"
] | null | null | null |
class Image:
def __init__(self):
pass
# @classmethod
# def load(cls, path):
#
# raise NotImplementedError
| 12.818182
| 35
| 0.553191
| 13
| 141
| 5.692308
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.35461
| 141
| 10
| 36
| 14.1
| 0.813187
| 0.446809
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 0
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
ea7c49b5c168ef4cd020e3b42629cd63a7176ef9
| 26
|
py
|
Python
|
builder/api/__init__.py
|
TranslatorIIPrototypes/robo-commons
|
a915d80b70f7e68a70f6a5f7ff6e732d2e02db06
|
[
"MIT"
] | 1
|
2020-02-05T20:00:52.000Z
|
2020-02-05T20:00:52.000Z
|
builder/api/__init__.py
|
TranslatorIIPrototypes/robo-commons
|
a915d80b70f7e68a70f6a5f7ff6e732d2e02db06
|
[
"MIT"
] | 12
|
2020-05-07T16:40:15.000Z
|
2020-06-16T13:23:13.000Z
|
builder/api/__init__.py
|
TranslatorIIPrototypes/robo-commons
|
a915d80b70f7e68a70f6a5f7ff6e732d2e02db06
|
[
"MIT"
] | 6
|
2018-02-23T20:25:50.000Z
|
2019-11-21T14:55:52.000Z
|
"""
builder API module
"""
| 8.666667
| 18
| 0.615385
| 3
| 26
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 26
| 3
| 19
| 8.666667
| 0.727273
| 0.692308
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
ea9ff614ad503c49c97576c47b9d5fbfd47718f9
| 315
|
py
|
Python
|
wagtail_embed_videos/edit_handlers.py
|
infoportugal/wagtail-embedvideos
|
b8a1abd80939eb6ab87a1bb19deabf2cba20c08e
|
[
"BSD-3-Clause"
] | 44
|
2015-05-20T16:52:15.000Z
|
2020-01-11T17:45:07.000Z
|
wagtail_embed_videos/edit_handlers.py
|
infoportugal/wagtail-embedvideos
|
b8a1abd80939eb6ab87a1bb19deabf2cba20c08e
|
[
"BSD-3-Clause"
] | 54
|
2015-08-11T18:08:18.000Z
|
2020-03-25T14:53:57.000Z
|
wagtail_embed_videos/edit_handlers.py
|
infoportugal/wagtail-embedvideos
|
b8a1abd80939eb6ab87a1bb19deabf2cba20c08e
|
[
"BSD-3-Clause"
] | 34
|
2015-05-27T14:35:27.000Z
|
2020-04-11T07:41:32.000Z
|
from wagtail.admin.edit_handlers import BaseChooserPanel
from .widgets import AdminEmbedVideoChooser
class EmbedVideoChooserPanel(BaseChooserPanel):
object_type_name = "embed_video"
def widget_overrides(self):
return {self.field_name: AdminEmbedVideoChooser}
# TODO: EmbedVideoFieldComparison
| 22.5
| 56
| 0.806349
| 30
| 315
| 8.266667
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136508
| 315
| 13
| 57
| 24.230769
| 0.911765
| 0.098413
| 0
| 0
| 0
| 0
| 0.039007
| 0
| 0
| 0
| 0
| 0.076923
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0.166667
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
576c7cf9db961495e2d40b59ebc0b166cd2e133c
| 241
|
py
|
Python
|
vgdl/util/helpers.py
|
ahjwang/py-vgdl
|
fd1198c93efd27cb465c7f0b05e07a6e9cda8cea
|
[
"BSD-3-Clause"
] | 1
|
2020-08-01T15:50:27.000Z
|
2020-08-01T15:50:27.000Z
|
vgdl/util/helpers.py
|
lburger98/py-vgdl
|
04026dbea780ab3f0c2e7baf46f8b04c5c531f86
|
[
"BSD-3-Clause"
] | null | null | null |
vgdl/util/helpers.py
|
lburger98/py-vgdl
|
04026dbea780ab3f0c2e7baf46f8b04c5c531f86
|
[
"BSD-3-Clause"
] | null | null | null |
import pygame
from pygame.math import Vector2
def neighbor_position(rect: pygame.Rect, direction: Vector2) -> Vector2:
direction = Vector2(direction)
topleft = rect.topleft + direction.elementwise() * rect.size
return topleft
| 24.1
| 72
| 0.746888
| 28
| 241
| 6.392857
| 0.5
| 0.178771
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019901
| 0.165975
| 241
| 9
| 73
| 26.777778
| 0.870647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
57b88ce4f4f113278dd05d12f2ada42d5e7b5d52
| 1,457
|
py
|
Python
|
ansicolor/__init__.py
|
numerodix/ansicolor
|
0ea52f2b5dcbc0bb0baa703c2ab46499007510fa
|
[
"Apache-2.0"
] | 5
|
2015-05-10T13:01:07.000Z
|
2022-03-22T10:19:51.000Z
|
ansicolor/__init__.py
|
numerodix/ansicolor
|
0ea52f2b5dcbc0bb0baa703c2ab46499007510fa
|
[
"Apache-2.0"
] | 3
|
2018-01-21T21:23:06.000Z
|
2021-05-05T06:32:37.000Z
|
ansicolor/__init__.py
|
numerodix/ansicolor
|
0ea52f2b5dcbc0bb0baa703c2ab46499007510fa
|
[
"Apache-2.0"
] | 4
|
2015-06-03T19:50:58.000Z
|
2022-03-22T08:27:31.000Z
|
from __future__ import absolute_import
from ansicolor.ansicolor import black
from ansicolor.ansicolor import blue
from ansicolor.ansicolor import cyan
from ansicolor.ansicolor import green
from ansicolor.ansicolor import magenta
from ansicolor.ansicolor import red
from ansicolor.ansicolor import white
from ansicolor.ansicolor import yellow
from ansicolor.ansicolor import colorize
from ansicolor.ansicolor import colorize_v2
from ansicolor.ansicolor import get_code
from ansicolor.ansicolor import get_code_v2
from ansicolor.ansicolor import wrap_string
from ansicolor.ansicolor import highlight_string
from ansicolor.ansicolor import get_highlighter
from ansicolor.ansicolor import strip_escapes
from ansicolor.ansicolor import justify_formatted
from ansicolor.ansicolor import colordiff
from ansicolor.ansicolor import set_term_title
from ansicolor.ansicolor import write_out
from ansicolor.ansicolor import write_err
from ansicolor.ansicolor import Colors
__all__ = [
"black",
"blue",
"cyan",
"green",
"magenta",
"red",
"white",
"yellow",
"colorize",
"colorize_v2",
"get_code",
"get_code_v2",
"wrap_string",
"highlight_string",
"get_highlighter",
"strip_escapes",
"justify_formatted",
"colordiff",
"set_term_title",
"write_out",
"write_err",
"Colors",
]
__major_version__ = "0.3"
__release__ = "2"
__version__ = "%s.%s" % (__major_version__, __release__)
| 24.283333
| 56
| 0.770075
| 176
| 1,457
| 6.051136
| 0.232955
| 0.268545
| 0.45446
| 0.578404
| 0.292019
| 0.065728
| 0
| 0
| 0
| 0
| 0
| 0.005691
| 0.1558
| 1,457
| 59
| 57
| 24.694915
| 0.860163
| 0
| 0
| 0
| 0
| 0
| 0.1407
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.46
| 0
| 0.46
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
57c2ed80c6cfb2c6a3751881b46b51bb2f6271dc
| 155
|
py
|
Python
|
tests/integration/conftest.py
|
bheuvel/transip_dns
|
c82e5d862ab559a306c45ad136499a42ee38ca08
|
[
"MIT"
] | null | null | null |
tests/integration/conftest.py
|
bheuvel/transip_dns
|
c82e5d862ab559a306c45ad136499a42ee38ca08
|
[
"MIT"
] | null | null | null |
tests/integration/conftest.py
|
bheuvel/transip_dns
|
c82e5d862ab559a306c45ad136499a42ee38ca08
|
[
"MIT"
] | null | null | null |
# MIT License, Copyright (c) 2020 Bob van den Heuvel
# https://github.com/bheuvel/transip/blob/main/LICENSE
"""Shared fixtures for integration testing."""
| 38.75
| 54
| 0.754839
| 22
| 155
| 5.318182
| 0.954545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028986
| 0.109677
| 155
| 3
| 55
| 51.666667
| 0.818841
| 0.935484
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
57e1973289c1294153406ad65b1745caba0e73c2
| 87
|
py
|
Python
|
app/core/apps.py
|
everythingisdata/python-rest-apis
|
1ff8c8bfa4a3e42d7c11bfea79010884896b50d5
|
[
"MIT"
] | null | null | null |
app/core/apps.py
|
everythingisdata/python-rest-apis
|
1ff8c8bfa4a3e42d7c11bfea79010884896b50d5
|
[
"MIT"
] | 1
|
2021-02-12T04:14:59.000Z
|
2021-02-12T04:15:39.000Z
|
app/core/apps.py
|
everythingisdata/python-restapis
|
1ff8c8bfa4a3e42d7c11bfea79010884896b50d5
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = "app.core"
| 14.5
| 33
| 0.735632
| 11
| 87
| 5.818182
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 87
| 5
| 34
| 17.4
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
17c06f6a3a931ea04f721744b20fb8e184654aad
| 262
|
py
|
Python
|
wwk/py/weapons/weapon_list.py
|
nsanthony/super-fortnight
|
fd1a49e97864a08fc5da5cf233afd103b35a2754
|
[
"Apache-2.0"
] | null | null | null |
wwk/py/weapons/weapon_list.py
|
nsanthony/super-fortnight
|
fd1a49e97864a08fc5da5cf233afd103b35a2754
|
[
"Apache-2.0"
] | null | null | null |
wwk/py/weapons/weapon_list.py
|
nsanthony/super-fortnight
|
fd1a49e97864a08fc5da5cf233afd103b35a2754
|
[
"Apache-2.0"
] | null | null | null |
#! /home/nsanthony/bin/python
from weapons.weapon_directory.stick import stick
from weapons.weapon_directory.sword import sword
from weapons.weapon_directory.unarmed import unarmed
weapon_list = {
'stick':stick,'sword':sword,'unarmed':unarmed
}
| 29.111111
| 53
| 0.763359
| 33
| 262
| 5.939394
| 0.393939
| 0.168367
| 0.260204
| 0.397959
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137405
| 262
| 9
| 54
| 29.111111
| 0.867257
| 0.10687
| 0
| 0
| 0
| 0
| 0.07265
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
17cca047b5597a491f62713b5f08e3fa96275eca
| 898
|
py
|
Python
|
paperboy/scheduler/remote.py
|
datalayer-externals/papermill-paperboy
|
b27bfdbb4ed27dea597ff1d6346eb831542ae81f
|
[
"Apache-2.0"
] | 233
|
2018-11-01T09:17:08.000Z
|
2022-03-22T08:27:24.000Z
|
paperboy/scheduler/remote.py
|
datalayer-externals/papermill-paperboy
|
b27bfdbb4ed27dea597ff1d6346eb831542ae81f
|
[
"Apache-2.0"
] | 99
|
2018-10-17T21:48:42.000Z
|
2021-05-07T08:33:36.000Z
|
paperboy/scheduler/remote.py
|
datalayer-externals/papermill-paperboy
|
b27bfdbb4ed27dea597ff1d6346eb831542ae81f
|
[
"Apache-2.0"
] | 29
|
2018-11-01T11:33:08.000Z
|
2022-01-12T22:12:19.000Z
|
import requests
from .base import BaseScheduler
class RemoteScheduler(BaseScheduler):
'''Proxy methods to a remote worker instance'''
def __init__(self, *args, **kwargs):
super(RemoteScheduler, self).__init__(*args, **kwargs)
def status(self, user, params, session, *args, **kwargs):
# FIXME async/celery
return requests.get(self.config.scheduler.status_url, params=params).json()
def schedule(self, user, notebook, job, reports, *args, **kwargs):
# FIXME async/celery
params = {'user': user.to_json(), 'notebook': notebook.to_json(), 'job': job.to_json(), 'reports': [r.to_json() for r in reports]}
return requests.post(self.config.scheduler.schedule_url, params=params).json()
def unschedule(self, user, notebook, job, reports, *args, **kwargs):
return self.schedule(user, notebook, job, reports, *args, **kwargs)
| 40.818182
| 138
| 0.674833
| 111
| 898
| 5.333333
| 0.378378
| 0.101351
| 0.076014
| 0.111486
| 0.320946
| 0.175676
| 0.121622
| 0
| 0
| 0
| 0
| 0
| 0.178174
| 898
| 21
| 139
| 42.761905
| 0.802168
| 0.089087
| 0
| 0
| 0
| 0
| 0.027127
| 0
| 0
| 0
| 0
| 0.047619
| 0
| 1
| 0.333333
| false
| 0
| 0.166667
| 0.166667
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
aa20c2f39d640544007a6d1c5b89eb2e3799bdfc
| 471
|
py
|
Python
|
decoder/Decoder.py
|
sshearing/mt-hw2
|
07494beb055a62839d64cb3e04c1bd26a0bfc584
|
[
"MIT"
] | null | null | null |
decoder/Decoder.py
|
sshearing/mt-hw2
|
07494beb055a62839d64cb3e04c1bd26a0bfc584
|
[
"MIT"
] | null | null | null |
decoder/Decoder.py
|
sshearing/mt-hw2
|
07494beb055a62839d64cb3e04c1bd26a0bfc584
|
[
"MIT"
] | null | null | null |
from abc import ABCMeta, abstractmethod
class Decoder:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, sentence): pass
def extract_english(self, h):
return "" if h.predecessor is None else "%s%s " % (self.extract_english(h.predecessor), h.phrase.english)
def extract_tm_logprob(self, h):
return 0.0 if h.predecessor is None else h.phrase.logprob + self.extract_tm_logprob(h.predecessor)
| 24.789474
| 113
| 0.660297
| 61
| 471
| 4.934426
| 0.442623
| 0.159468
| 0.07309
| 0.106312
| 0.159468
| 0.159468
| 0
| 0
| 0
| 0
| 0
| 0.005666
| 0.250531
| 471
| 18
| 114
| 26.166667
| 0.847026
| 0
| 0
| 0
| 0
| 0
| 0.010684
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.111111
| 0.111111
| 0.222222
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
aa4775a2076c0e5dbd97d08944ade7bc24ffad2b
| 921
|
py
|
Python
|
solutions/elementary/even_the_last.py
|
roman-kachanovsky/checkio
|
3134cbc04ed56e92006d1e2f09d7365e900953db
|
[
"BSD-3-Clause"
] | 1
|
2017-02-07T19:50:52.000Z
|
2017-02-07T19:50:52.000Z
|
solutions/elementary/even_the_last.py
|
roman-kachanovsky/checkio-python
|
3134cbc04ed56e92006d1e2f09d7365e900953db
|
[
"BSD-3-Clause"
] | null | null | null |
solutions/elementary/even_the_last.py
|
roman-kachanovsky/checkio-python
|
3134cbc04ed56e92006d1e2f09d7365e900953db
|
[
"BSD-3-Clause"
] | null | null | null |
""" --- Even the last --- Elementary
You are given an array of integers. You should find the sum of the
elements with even indexes (0th, 2nd, 4th...) then multiply this summed
number and the final element of the array together.
Don't forget that the first element has an index of 0.
For an empty array, the result will always be 0 (zero).
Input: A list of integers.
Output: The number as an integer.
How it is used: Indexes and slices are important elements of coding
in python and other languages.
This will come in handy down the road!
Precondition: 0 <= len(array) <= 20
all(isinstance(x, int) for x in array)
all(-100 < x < 100 for x in array)
"""
def my_solution(array):
return sum(array[::2]) * array[-1] if array else 0
aggelgian_solution = lambda x: sum(x[::2]) * x[-1] if x else 0
| 35.423077
| 72
| 0.621064
| 145
| 921
| 3.931034
| 0.572414
| 0.035088
| 0.021053
| 0.038596
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030864
| 0.296417
| 921
| 25
| 73
| 36.84
| 0.848765
| 0.830619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
a4b2aa5819b0ed0db4cfd35e57ed3ceaeb55e66b
| 13
|
py
|
Python
|
test/login.py
|
Ljiawei119/python39
|
cc9d7c6866612750abde244cc66c6b69395455b0
|
[
"MIT"
] | null | null | null |
test/login.py
|
Ljiawei119/python39
|
cc9d7c6866612750abde244cc66c6b69395455b0
|
[
"MIT"
] | null | null | null |
test/login.py
|
Ljiawei119/python39
|
cc9d7c6866612750abde244cc66c6b69395455b0
|
[
"MIT"
] | null | null | null |
age=1
age=20
| 4.333333
| 6
| 0.692308
| 4
| 13
| 2.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.272727
| 0.153846
| 13
| 2
| 7
| 6.5
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a4bcd030f1d0f799372ee29ba3f424cd9ad9f198
| 3,702
|
py
|
Python
|
tasks-deploy/restore-usb/generate.py
|
irdkwmnsb/lkshl-ctf
|
e5c0200ddc8ba73df5f321b87b9763fb1bbaba57
|
[
"MIT"
] | 3
|
2021-03-30T06:27:58.000Z
|
2021-04-03T17:56:35.000Z
|
tasks-deploy/restore-usb/generate.py
|
irdkwmnsb/lkshl-ctf
|
e5c0200ddc8ba73df5f321b87b9763fb1bbaba57
|
[
"MIT"
] | null | null | null |
tasks-deploy/restore-usb/generate.py
|
irdkwmnsb/lkshl-ctf
|
e5c0200ddc8ba73df5f321b87b9763fb1bbaba57
|
[
"MIT"
] | null | null | null |
TITLE = "Служба восстановления данных"
STATEMENT_TEMPLATE = '''
В службу восстановления данных с флешек и дисков обратился клиент. Он принёс эту флешку. Говорит, что случайно её отформатировал. Посмотрите, что здесь можно сделать.
[usb.img.tar.gz](http://ctf.sicamp.ru/static/xn9gwqz3/{0}.tar.gz)
'''
def generate(context):
participant = context['participant']
token = tokens[participant.id % len(tokens)]
return TaskStatement(TITLE, STATEMENT_TEMPLATE.format(token))
tokens = ['Mr3eduBFiL5Q', 'vrXy4Rdaen5S', 'axslTWTAiCi3', 'QjHNEKgjpTws', 'sJtkuzyvg9wg', '0YPXCNV8VC2p', 'eaK2ouSQCUJL', 'xYBIp9KyLHzq', 'fvAOg47w4ieO', 'o5GvLgsMlWvm', 'WPBJ01VinoTL', '94Kjg3sm9KnW', 'AmV6R8sH5RSA', 'FAquLF7ZNrkN', '3DdXvbLEuI0S', 'xG3NFcZzqUcC', 'fURyowGENyN0', 'SMDfqcydbwFr', 'hfkrmKP7fjT2', '6fkZDHMRo6Vi', 'zYrts1ujsGmo', '71K6bWC4aCXH', 'jtjYiHLJXoYE', 'fZ1oX6PZXHgW', 't9U1GlIzAaz6', 'wme1sB43CZlZ', 'irltDxxTjwLl', 'RAnJnOIjNVxQ', 'jRyPOhcDb7xf', 'fkOQhV5WugjM', 'XihOAdnD2v1p', 'GJMueiBRRIV2', 'AE1PkrTLBH8u', 'BpkYOgzD78H4', 'LNqEX2CHaEuk', 'uzxFG9ohS2Zw', 'nlB6Aom800WZ', 'pGRoc7lzrcCm', 'Ymd3Bbh5C7kb', 'AfC1CCKXmA9Q', 'DtXuaEDo9D2Z', 'sFGu3iLm4nBB', 'HNzP3j8JYL3N', 'Vjkk68YwSAKe', 'BRFWaskdMWIN', '22Y0hVdCJfmx', 'zjmqGlhd6uuE', 'i202k0QWJzCD', 'GYevjmTxLMMg', '32IfFwGKZilz', 'NdjTqlQ0qVqB', 'YzYj7Xl9cZuB', 'Lni7sYlFNh7D', 'u4nl86Bx79F1', 'nMY4jYZ4YI1I', 'lW3eFNz2qjiG', 'uKDe5CDEBWl2', 'T6U4yaryhKU9', 'LKUehxgyndUq', 'leJGPPnlz2Hk', 'XenXVeJBL7TR', 'hg1nZAzYwwP1', 'KOvfqetAxKMR', 'IUdq5PIih81t', 'oajMjb8RPuw0', 'mmdKiNfVQzxn', 'OcSoW1NRu1ct', 'V9vcCaV5nJLw', 'EfpRA1y5FtKY', 'w9tfbgCi89cj', '8tHlDW8aAwlB', '4IG04xPVvf6R', '4QSJe1oHLS9o', '9svihqFTpOr3', 'u4fmf2uECnev', 'oUuMHc8svhv1', 'o6MMTSPbEULu', 'mmUsieaPn4Bc', 'JixyWUbjHJcn', 'ZyHUnCWrParR', 'X1WzBdU9Ksx0', 'eD7dITb0Iu0f', 'qfBaHTBays6N', 'Mkkiy6mNpQVs', 'by1Y89f9682T', 'fq6lJD8HOZoK', 'WgUrJQ16T8Yy', 'C4blcGm51wq9', '5uLvI0PumRnM', 'gEtLjEEj9FSB', 'N6Jf79Zp9JZr', 'EfTdozXNDktL', 'mD94p1N0Cu5C', '9O9V1J0VZ9A8', '1SPnTT9NKACZ', 'Mc5a2gI7eHvX', 'fwbdfpqGPeHG', 'qtp8IWzxT3RQ', '1VQSCoiHFNEe', 'tAMiOmDDaLAh', 'SXaaidwcHnk2', 'ExBvND2huJVv', 'GX1g8x3QCN58', 'jALkAEDJOR9l', 'SWpvCklFI8rS', 'A6qrBZ2olfOC', 'X3rmzQXkNtqC', 'tUmEV52qbaMW', '4VjcGfMbAcLP', 'hwCMLpi51RCH', 'LQDycefd4v5V', 'eZvEmlExaon7', 'hhKaujS2uwIj', 'VvgfCmxwYxqz', 'PXTADJei3sD1', 'usvBsMJtRRVZ', 'rRTfTl2vnJio', 'ygn6XpAxkifd', '45PMmH1RtNI1', 'KHMWEiycTNok', '7yOTLI1fGQXH', 'pkM1lV70Mzzu', 'Up0rh6dAGbZP', 'U8F3z3tYi6dz', 'TM9yWapHihfa', 'pxpo9IGyDV6o', 'vdVfgxpYDleH', 's5HBVHNUCYUb', 'uoVhn0ZmqSmN', 'PikqkGxincyL', 'OCO0SQ6UGozP', 'X4sTKm24EFHa', 'ctiVBTGg7UnJ', 'mFwwhyN7oIvP', 'Gh32nCmZBYq0', 'Ltqdnn68Ua1i', '4z3tFkQx8LpA', 'DAwP7yhgAwxC', 'm1G3046SzAZA', 'LiWR1lNWwE2G', 'jwTbRQ8nDKgV', 'jdJudNryfQ2r', 'Pxv2MicWt6Xb', 'eMCTgdngNiro', '3jhwXGDrBkrH', 'U9YRx1gpJRCg', 'h514NMFs8fpQ', '4UwthP557aW0', 'qctm7MWHtD5N', 'Exqm76bh3Urv', 'BSZniPARofeC', 'IqRTj8HgWJZC', 'oiXWaed3nWtH', 'zvlEjKG7ePqL', 'KQAND0y0RxCf', 'MiZOTaHvckq1', 't0m8eITjuViD', 't3nAHGEPRvYQ', 'NdjXbqZAQhYf', 'sxtMZJJp0LPR', 'urtaqBRJUdKv', 'Hr1vZqTSgDkV', 'nvCZtJi6FeCt', 'XOE0EgSxQZti', 'b51NVJnuGqOa', 'rQC52mjcQOuf', 'ggfzEd9k9fNf', '2i77TjRXpKyH', 'Oe9SFaso0V9R', 'P4nTMNCOmIlG', 'WeWo9vd6KfGC', 'bB7rQp7BhIrT', 'gw4rmUp0uD86', 'lpuVXxHnToCe', 'GsQQz3tdgNEM', 'MAwwGaCcppaL', '6FY7bkuEzch6', 'gOxcsbFfCMGy', 'MhTJiHGHnFwC', '6RffySDswn7R', '6rrTopLQsqdU', 'f57OiSKaEflx', 'HWcrECXE8dQ2', 'QiTXTmJmrpTh', 'hBx5zFNIB9xo', 'heHKngO0lww8', '5s3RR21Eq7RR', 'WEBSwC23d0Eh', 'GUB4P81cmuTU', 'aMg1e8FlmFW9', 'BTDtwXw5qGhb', '4t4HbyTei08w', 'YAOanbEXUXrh', 'pYgp6IgCKXaf', 'dAej0hUDNq56', 'ySJHvXevQi7x', 'DwHcjMdr1yA2', 'BRLp31SroULu', 'AXUVePOcw75D', 'TIZTmcLJVx9V']
| 308.5
| 3,210
| 0.748514
| 263
| 3,702
| 10.528517
| 0.946768
| 0.014446
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107028
| 0.073744
| 3,702
| 11
| 3,211
| 336.545455
| 0.700496
| 0
| 0
| 0
| 0
| 0.2
| 0.724194
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.1
| false
| 0
| 0
| 0
| 0.2
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
351dbd32f1fa5e67fb944d2a7bce26dc6a72fad0
| 109
|
py
|
Python
|
librarycomparison/apps.py
|
ualberta-smr/LibraryMetricScripts
|
d089e2179c5c73224aa8084c5d1c6f7cd6933edb
|
[
"MIT"
] | 4
|
2019-02-13T18:11:19.000Z
|
2022-01-29T06:32:10.000Z
|
librarycomparison/apps.py
|
ualberta-smr/LibraryMetricScripts
|
d089e2179c5c73224aa8084c5d1c6f7cd6933edb
|
[
"MIT"
] | 33
|
2019-06-24T15:52:11.000Z
|
2022-02-04T22:42:24.000Z
|
librarycomparison/apps.py
|
ualberta-smr/LibraryMetricScripts
|
d089e2179c5c73224aa8084c5d1c6f7cd6933edb
|
[
"MIT"
] | 4
|
2019-02-11T18:18:39.000Z
|
2021-09-12T03:10:58.000Z
|
from django.apps import AppConfig
class LibrarycomparisonConfig(AppConfig):
name = 'librarycomparison'
| 18.166667
| 41
| 0.798165
| 10
| 109
| 8.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137615
| 109
| 5
| 42
| 21.8
| 0.925532
| 0
| 0
| 0
| 0
| 0
| 0.155963
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
35215c6c7bc64f6131f7eb20d79703eb4218f9db
| 2,851
|
py
|
Python
|
Python/tdw/FBOutput/Raycast.py
|
felixbinder/tdw
|
eb2b00b74b9fcf8ef2dcba1baa62424640c520b1
|
[
"BSD-2-Clause"
] | 307
|
2020-05-20T18:08:49.000Z
|
2022-03-21T19:55:08.000Z
|
Python/tdw/FBOutput/Raycast.py
|
felixbinder/tdw
|
eb2b00b74b9fcf8ef2dcba1baa62424640c520b1
|
[
"BSD-2-Clause"
] | 92
|
2020-07-21T18:29:13.000Z
|
2022-03-28T07:25:54.000Z
|
Python/tdw/FBOutput/Raycast.py
|
felixbinder/tdw
|
eb2b00b74b9fcf8ef2dcba1baa62424640c520b1
|
[
"BSD-2-Clause"
] | 53
|
2020-07-14T15:55:17.000Z
|
2022-03-20T16:20:01.000Z
|
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBOutput
import tdw.flatbuffers
class Raycast(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsRaycast(cls, buf, offset):
n = tdw.flatbuffers.encode.Get(tdw.flatbuffers.packer.uoffset, buf, offset)
x = Raycast()
x.Init(buf, n + offset)
return x
# Raycast
def Init(self, buf, pos):
self._tab = tdw.flatbuffers.table.Table(buf, pos)
# Raycast
def Hit(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return bool(self._tab.Get(tdw.flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
# Raycast
def HitObject(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return bool(self._tab.Get(tdw.flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False
# Raycast
def RaycastId(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.Get(tdw.flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# Raycast
def ObjectId(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
return self._tab.Get(tdw.flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
# Raycast
def Normal(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
x = o + self._tab.Pos
from .Vector3 import Vector3
obj = Vector3()
obj.Init(self._tab.Bytes, x)
return obj
return None
# Raycast
def Point(self):
o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
if o != 0:
x = o + self._tab.Pos
from .Vector3 import Vector3
obj = Vector3()
obj.Init(self._tab.Bytes, x)
return obj
return None
def RaycastStart(builder): builder.StartObject(6)
def RaycastAddHit(builder, hit): builder.PrependBoolSlot(0, hit, 0)
def RaycastAddHitObject(builder, hitObject): builder.PrependBoolSlot(1, hitObject, 0)
def RaycastAddRaycastId(builder, raycastId): builder.PrependInt32Slot(2, raycastId, 0)
def RaycastAddObjectId(builder, objectId): builder.PrependInt32Slot(3, objectId, 0)
def RaycastAddNormal(builder, normal): builder.PrependStructSlot(4, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(normal), 0)
def RaycastAddPoint(builder, point): builder.PrependStructSlot(5, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(point), 0)
def RaycastEnd(builder): return builder.EndObject()
| 36.088608
| 130
| 0.66047
| 357
| 2,851
| 5.151261
| 0.229692
| 0.072322
| 0.130506
| 0.163132
| 0.535073
| 0.535073
| 0.535073
| 0.487221
| 0.487221
| 0.487221
| 0
| 0.020027
| 0.229393
| 2,851
| 78
| 131
| 36.551282
| 0.817023
| 0.049807
| 0
| 0.45614
| 1
| 0
| 0.001482
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.280702
| false
| 0
| 0.052632
| 0.017544
| 0.596491
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
3528ed2def4b724a85904bc1751ca7d69cb6b1a5
| 245
|
py
|
Python
|
sited_py/lib/noear_snacks_ONodeBase.py
|
wistn/sited_py
|
fbecf09f410bd2494a952383073956946d9df813
|
[
"Apache-2.0"
] | null | null | null |
sited_py/lib/noear_snacks_ONodeBase.py
|
wistn/sited_py
|
fbecf09f410bd2494a952383073956946d9df813
|
[
"Apache-2.0"
] | null | null | null |
sited_py/lib/noear_snacks_ONodeBase.py
|
wistn/sited_py
|
fbecf09f410bd2494a952383073956946d9df813
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: UTF-8 -*-
"""
Author:wistn
since:2021-03-02
LastEditors:Do not edit
LastEditTime:2021-03-04
Description:对Java类 noear.snacks.ONodeBase 的简单移植: tryLoad asArray isArray isObject 方法
"""
from .noear_snacks import ONodeBase
# 这样处理避免循环依赖
| 20.416667
| 84
| 0.767347
| 34
| 245
| 5.5
| 0.852941
| 0.064171
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078341
| 0.114286
| 245
| 11
| 85
| 22.272727
| 0.78341
| 0.8
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
353dcb33a01627aa2a8c5e6289f9e079661db14b
| 88
|
py
|
Python
|
txt-files/server.py
|
dolanskurd/kww
|
14073d72188a8b3cc3913435724289a96b107fd3
|
[
"MIT"
] | 3
|
2021-05-12T22:55:21.000Z
|
2021-09-13T12:47:11.000Z
|
txt-files/server.py
|
dolanskurd/kww
|
14073d72188a8b3cc3913435724289a96b107fd3
|
[
"MIT"
] | null | null | null |
txt-files/server.py
|
dolanskurd/kww
|
14073d72188a8b3cc3913435724289a96b107fd3
|
[
"MIT"
] | null | null | null |
from zimply import ZIMServer
fn = "wikipedia_ckb_all_maxi_2021-04.zim"
ZIMServer(fn)
| 12.571429
| 41
| 0.795455
| 14
| 88
| 4.714286
| 0.857143
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.077922
| 0.125
| 88
| 6
| 42
| 14.666667
| 0.779221
| 0
| 0
| 0
| 0
| 0
| 0.390805
| 0.390805
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
101b7d32335c1b37b8ff8c789f8f7ec975d5af7c
| 485
|
py
|
Python
|
testing/mockGameEngine.py
|
Orpheon/All-in
|
016901953904250226f388422318ef2f739bf82e
|
[
"MIT"
] | null | null | null |
testing/mockGameEngine.py
|
Orpheon/All-in
|
016901953904250226f388422318ef2f739bf82e
|
[
"MIT"
] | null | null | null |
testing/mockGameEngine.py
|
Orpheon/All-in
|
016901953904250226f388422318ef2f739bf82e
|
[
"MIT"
] | null | null | null |
from league.game import GameEngine
class MockGameEngine(GameEngine):
def __init__(self, batch_size, initial_capital, small_blind, big_blind, fixed_community_cards, fixed_hole_cards,
logger):
super().__init__(batch_size, initial_capital, small_blind, big_blind, logger)
self._fixed_community_cards = fixed_community_cards
self._fixed_hole_cards = fixed_hole_cards
def generate_cards(self):
return self._fixed_community_cards, self._fixed_hole_cards
| 40.416667
| 114
| 0.791753
| 64
| 485
| 5.421875
| 0.390625
| 0.161383
| 0.21902
| 0.132565
| 0.449568
| 0.449568
| 0.449568
| 0.236311
| 0
| 0
| 0
| 0
| 0.140206
| 485
| 12
| 115
| 40.416667
| 0.832134
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.111111
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.