-
Notifications
You must be signed in to change notification settings - Fork 0
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
Typing module Unit-Tests, some new features and refactor typing code #22
Merged
Conversation
This file contains 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
- change some TypeError by ValueError - add `__repr__` method - fix a bug in `__lt__`, operator `<` was inverted. - `phase` function now calculate phase of signal + noise (before only signal). - add `lower()` attribute to `by` parameter in `power` and `abs` functions to accept capitalization.
armando-palacio
added
bug
Something isn't working
tests
For changes related to unittest of package
refactor
For changes on code that not modify its functionality
new feature
For new Features
labels
Mar 19, 2024
… and add __repr__ method to optical_signal class
I make this to be able to express arguments type separated by `|` instead of use `Union[]`, and this feature is available from python version `3.10` onwards.
- Now import opticomlib as `op`. - change release variable for version variable.
1. this function now autodetect the output array type from string format if dtype is not given. 2. now support more than one row, using semicolon `;` to separate the rows. 3. now support `complex` output type.
general: change `Union[]` to `|` in argument types. - on `binary_sequence` 1. refactor type accepted in __init__ 2. fix raises for check correct format of data in __init__ 3. fix check format when __add__ or __radd__. - on `electrical_signal` 1. new feature, now accept `strings` as inputs. 2. delete special functions from autosummary in class docstring 3. add some notes to __init__ docstring. 4. reforze input format checks. 5. improve the printing style - on `optical_signal` 1. same changes than `electrical_signal` because of optical_signal is a children of electrical_signal.
- now `signal` and `noise` in this objects keep type of input arrays. - upgrade `__repr__` to hide `noise` when it have all zeros. - fix: add a check for same length in `__add__`, `__sub__`, `__rsub__`, `__mul__`, `__gt__` and `__lt__` - fix: add a check for dimensions in `opticomlib.__init__`.
1. scalar values are accepted now as inputs 2. `abs` and `__call__` methods now accept capitalized inputs too. 3. `optical_signal` can drive 1 or 2 polarizations now (new attribute `n_pol` was added). If 1 polarization, signal and noise arrays will have shapes (N,). If 2 polarizations, signal and noise will have shapes (2,N). Number of polarizations are detected automatically from inputs shapes or can be forced by `n_pol` argument. 4. Add support for substract, implementing __sub__ and __rsub__. style: style of objects representation was retouched. Some methods were also reworked to ensure compatibility with the new features introduced (__init__, __repr__, len, __add__, __mul__, __getitem__, plot, psd)
new test cases and code refactors was made on electical_signal too.
…open a new figure or not. refact: refactor of eye code
…stimate the cross time. Default values were set when this happend
fix wrong cases on gt_and_lt in electrical_signal and set all hold=False in plots
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
new feature
For new Features
refactor
For changes on code that not modify its functionality
tests
For changes related to unittest of package
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.
🚀 Bump version to
v1.0.0
✨ Features:
On Binary Sequence:
On Electrical Signal
__repr__
method and improve printing style. Ifnoise
is zeros array it is not printed.signal
andnoise
keep type of input arrays (before it were set ascomplex
).strings
as inputs.-
. Can substracct anint
,str
,iterable
,electrical_signal
.hold=True
in plot and psd methods to manage if create or not a new figure.phase
function now calculate phase of signal + noise (before only signal).On Optical Signal
n_pol
was added). If 1 polarization, signal and noise arrays will have shapes (N,). If 2 polarizations, signal and noise will have shapes (2,N). Number of polarizations are detected automatically from inputs shapes or can be forced byn_pol
argument.phase
function now calculate phase of signal + noise (before only signal).power
,abs
and__call__
functions now accept capital letters as inputs.signal
andnoise
keep type of input arrays (before it were set ascomplex
).strings
as inputs.-
. Can substracct anint
,str
,iterable
,optical_signal
.hold=True
in plot and psd methods to manage if create or not a new figure.Others
;
to separate the rows. Supportcomplex
output type.🧪 Tests:
global_variables
binary_sequence
electrical_signal
optical_signal
eye
🐛 Bugs:
electrical_signal.__lt__
, operator<
was inverted.__add__
,__sub__
,__rsub__
,__mul__
,__gt__
and__lt__
.devices.GET_EYE
when there are not enough data to estimate the cross time. Default values were set when this happend (t_left=-0.5
,t_right=0.5
andt_center=0
).💥 BREAKING CHANGE
>=3.10
in order to express arguments type separated by|
instead of useUnion[]