-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/resampling mark #72
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
53729dd
resampling method added
SimoneAriens 0a7ab14
Mark type and resampling for marks implemented
SimoneAriens 639db3e
bugfix and extra test
SimoneAriens 33f84a2
cleanup
SimoneAriens 6f6d7d5
Merge branch 'feature/resampling' of https://github.com/NetherlandsFo…
SimoneAriens 1b969b3
Merge branch 'main' of https://github.com/NetherlandsForensicInstitut…
SimoneAriens fff863c
update to changed resampling
SimoneAriens 9ec4d4d
comments
SimoneAriens a54b240
changed typehint
SimoneAriens b55bda5
merge conflict
SimoneAriens cfd5806
oops
SimoneAriens 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,53 @@ | ||
| from enum import Enum, auto | ||
|
|
||
| from pydantic import BaseModel | ||
|
|
||
| from container_models.scan_image import ScanImage | ||
|
|
||
|
|
||
| class MarkType(Enum): | ||
| # Impression marks | ||
| BREECH_FACE_IMPRESSION = auto() | ||
| CHAMBER_IMPRESSION = auto() | ||
| EJECTOR_IMPRESSION = auto() | ||
| EXTRACTOR_IMPRESSION = auto() | ||
| FIRING_PIN_IMPRESSION = auto() | ||
|
|
||
| # Striation marks | ||
| APERTURE_SHEAR_STRIATION = auto() | ||
| BULLET_GEA_STRIATION = auto() | ||
| BULLET_LEA_STRIATION = auto() | ||
| CHAMBER_STRIATION = auto() | ||
| EJECTOR_STRIATION = auto() | ||
| EJECTOR_PORT_STRIATION = auto() | ||
| EXTRACTOR_STRIATION = auto() | ||
| FIRING_PIN_DRAG_STRIATION = auto() | ||
|
|
||
| def is_impression(self) -> bool: | ||
| return "IMPRESSION" in self.name | ||
|
|
||
| def is_striation(self) -> bool: | ||
| return "STRIATION" in self.name | ||
|
|
||
| @property | ||
| def scale(self) -> float: | ||
| if self == MarkType.BREECH_FACE_IMPRESSION: | ||
| return 3.5e-6 | ||
| return 1.5e-6 | ||
|
|
||
|
|
||
| class CropType(Enum): | ||
| RECTANGLE = auto() | ||
| CIRCLE = auto() | ||
| ELLIPSE = auto() | ||
| POLYGON = auto() | ||
|
|
||
|
|
||
| class Mark(BaseModel): | ||
| """ | ||
| Representation of a mark (impression or striation) | ||
| """ | ||
|
|
||
| scan_image: ScanImage | ||
| mark_type: MarkType | ||
| crop_type: CropType | ||
SimoneAriens marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
Empty file.
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
19 changes: 19 additions & 0 deletions
19
packages/scratch-core/tests/conversion/test_data_formats.py
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,19 @@ | ||
| from conversion.data_formats import MarkType | ||
|
|
||
|
|
||
| class TestMarkType: | ||
| def test_impression_marks_are_identified_as_impressions(self): | ||
| assert MarkType.BREECH_FACE_IMPRESSION.is_impression() | ||
| assert MarkType.FIRING_PIN_IMPRESSION.is_impression() | ||
| assert not MarkType.BULLET_GEA_STRIATION.is_impression() | ||
|
|
||
| def test_striation_marks_are_identified_as_striations(self): | ||
| assert MarkType.BULLET_GEA_STRIATION.is_striation() | ||
| assert MarkType.FIRING_PIN_DRAG_STRIATION.is_striation() | ||
| assert not MarkType.BREECH_FACE_IMPRESSION.is_striation() | ||
|
|
||
| def test_all_marks_are_either_impression_or_striation(self): | ||
| for mark in MarkType: | ||
| assert mark.is_impression() ^ mark.is_striation(), ( | ||
| f"{mark} is neither or both" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add 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.