forked from SIMULATOR-WG/SHARC
-
Notifications
You must be signed in to change notification settings - Fork 24
feat: adding the propagation_p528 #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RaulMyron
wants to merge
9
commits into
Radio-Spectrum:development
Choose a base branch
from
RaulMyron:p528
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9827222
feat: adding the propagation_p528
RaulMyron 14ffc9d
fix: modifications for unitest and linting
RaulMyron 6edd6bb
fix: adding modifcation in parameters_for_testing to test the param_p528
RaulMyron 437c75e
fix and features: adding minor modifications in test_parameters.py th…
RaulMyron cf1512d
Merge branch 'development' into p528
artistrea 0a4f61a
fixing test_parameters.py
RaulMyron 0068a7c
fixed linting problems
RaulMyron 6ad38b3
adding tests for p528
RaulMyron 4aba50a
fixed linting
RaulMyron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # -*- coding: utf-8 -*- | ||
| """Parameters definitions for P528 propagation model | ||
| """ | ||
| from dataclasses import dataclass | ||
| from sharc.parameters.parameters_base import ParametersBase | ||
|
|
||
|
|
||
| @dataclass | ||
| class ParametersP528(ParametersBase): | ||
| """Dataclass containing the P.528 propagation model parameters""" | ||
|
|
||
| # Time percentage between 1-99 or "RANDOM" | ||
| time_percentage: str = "RANDOM" | ||
| # 0 (horizontal), 1 (vertical) polarization or "RANDOM" | ||
| polarization: str = "RANDOM" | ||
| # Channel model, possible values are "P528" | ||
| channel_mode: str = "P528" | ||
|
|
||
| def load_parameters_from_file(self, config_file: str): | ||
| """Load the parameters from file and run validation | ||
|
|
||
| Parameters | ||
| ---------- | ||
| config_file : str | ||
| Path to the configuration file | ||
|
|
||
| Raises | ||
| ------ | ||
| ValueError | ||
| If a parameter is not valid | ||
| """ | ||
| super().load_parameters_from_file(config_file) | ||
|
|
||
| # Validate time percentage | ||
| if self.time_percentage != "RANDOM": | ||
| try: | ||
| time_pct = float(self.time_percentage) | ||
| if time_pct < 1 or time_pct > 99: | ||
| raise ValueError( | ||
| f"ParametersP528: Invalid time_percentage {time_pct}. " "Must be between 1-99 or 'RANDOM'" | ||
| ) | ||
| except ValueError: | ||
| raise ValueError( | ||
| f"ParametersP528: Invalid time_percentage {self.time_percentage}. " "Must be between 1-99 or 'RANDOM'" | ||
| ) | ||
|
|
||
| # Validate polarization | ||
| if self.polarization != "RANDOM": | ||
| try: | ||
| pol = int(self.polarization) | ||
| if pol not in [0, 1]: | ||
| raise ValueError( | ||
| f"ParametersP528: Invalid polarization {pol}. " "Must be 0 (horizontal), 1 (vertical) or 'RANDOM'" | ||
| ) | ||
| except ValueError: | ||
| raise ValueError( | ||
| f"ParametersP528: Invalid polarization {self.polarization}. " | ||
| "Must be 0 (horizontal), 1 (vertical) or 'RANDOM'" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.