Recent Releases of shocktrackinglibrary

shocktrackinglibrary - Shock tracking library v2.15.10

What's New in This Release

Code Enhancements

  • Improved code style according to PEP 8
  • Defined universal units:
    ```python SOA.univ_unit = {'freq': 'fps', 'dis': 'mm', 'angle': 'deg'}

  • Abort preview with ESC or continue with any key.

  • Logging all tracking activities using:

    ```python SOA.log(logmessage: str, directorypath: str)

Improved generating slice list array sliceListGenerator.GenerateSliceArray:

  • Define number of tracking points: npnts=n

  • Slice thickness in pixels or universal units: slice_thickness =[5.5, 'mm']

  • Custom vertical range: sat_vr = [-5.5, 3, 'mm']

  • avgshockloc now uses coordinate tuple (x, y)

Improved shock angle estimation inc_tracking.InclinedShockTracking

  • RANSAC for better fitting

  • Enhanced cached metadata and filename comments

  • Confidence estimation: conf_interval=0.95

  • Histogram plotting with confidence stats

  • Weighted average using slope std and error

Visualization Upgrades

  • Custom point size: points_size=12

  • Confidence/prediction bands:

    • conf_color, conf_range_opacity
    • pred_color, pred_range_opacity
  • Custom background image:

    op_bg_path, bg_y_crop, bg_x_crop, bg_resize, bg_90rotate

  • Rotate output: op_90rotate=True

  • Use nReviewas an integer or tuple: (start, end, step) - applicable only with inc_tracking.ShockPointsTracking

Output Format Improvements

  • avgshockangle:

    [arithavg, arithconf, weightavg, weightconf, std_dev]

  • avgshockloc:

    [locavg, locconf, std_dev]

Function Optimizations

Improved: SOA.extract_coordinates, v_least_squares

Robust File Handling

Crop X: crop_x_img, Crop Y: crop_y_img, Resize: resize_img

Bug Fixes

  • Handle images without scale in sliceListGenerator.GenerateSliceArray

  • Fix corner cases in v_least_squares

  • Robust angle estimation even with missing slices ShockTraking

  • Fixed circular import issue using constent.py

Full Changelog: https://github.com/EngAhmedHady/ShockTrackingLibrary/compare/v2.15.9...v2.15.10

- Python
Published by EngAhmedHady 8 months ago

shocktrackinglibrary - Shock tracking library

DOI Documentation Status License: MIT PyPI - Version

Shock Tracking Library

The instability of shock waves due to induced separation presents a significant challenge in aerodynamics. Accurately predicting shock wave instability is crucial for reducing vibrations and noise generation. The high-speed schlieren technique, valued for its simplicity, affordability, and non-intrusiveness, is crucial for understanding the flow patterns in linear cascades. This Python package introduces an advanced method that employs line-scanning to detect and track shock waves from a large series of schlieren images. This method provides a feedback system to handle uncertainties in shock detection, with potential applications in supervised learning and AI. It proves effective in identifying and analyzing different types of shocks, even in images with low resolution or visibility. The method's performance was tested on a transonic fan passage test section in two case studies: one involving various Reynolds number conditions, and the other focusing on low Reynolds numbers, where shock instability is more prominent. The shock testing details can be found in this publication Hanfy, A. H., Flaszyński, P., Kaczyński, P., & Doerffer, P., Advancements in Shock-Wave Analysis and Tracking from Schlieren Imaging. DOI: 10.2139/ssrn.4797840 SnapShotsLE This library employes OpenCV, scipy, glob, sys, numpy and matplotlib libraries.

Software packaging

The full Python package is now ready for sharing

To install Shock Tracking Library from pip you can use:
pip install ShockOscillationAnalysis

Alternatively, you can also clone the repository manually by running:
git clone https://github.com/EngAhmedHady/ShockTrackingLibrary.git

Then install the package using:
pip3 install dist\ShockOscillationAnalysis-2.0.0-py3-none-any.whl

The full documentation

All functions have been well-defined and documented, and 4 tutorials for the package have been added through this link

Code Improvements

Function Running Time Calculation

  • Build a new functions file to calculate the function running time, added to the file called: decorators.py

Terminal Text Color

  • Added the class BCOLOR to improve the readability of running status and to draw better attention to warnings and failures.
  • Add colors to info, warnings, and Errors to improve the readability of running status and to draw better attention to them.

Improve the InclinedShockTracking.ShockPointsTracking.anglesInterpolation function

Using the numpy and scipy.interpolate function for efficient performance with better boundary point definition and extrapolation - add angle_interp_kind parameter for: 'linear', 'CubicSpline' and 'PCHIP' interpolation -- For details about linear interpolation: numpy.interp -- For details about CubicSpline interpolation: scipy.interpolate.CubicSpline -- For details about PCHIP interpolation: scipy.interpolate.PchipInterpolator

Shock Inclination

  • Added calculation of shock angle standard deviation with the argument tracking_std (default is False). This feature is still under development.
  • Introduced the argument avg_show_txt (default is True) to display the average inclination text.
  • Changed the keyword avg_ang_Yloc to avg_txt_Yloc to specify the text location for the average shock angle.

Define the inclined tracking domain

  • With the bool parameter osc_boundary on the main function InclinedShockTracking.ShockPointsTracking.
  • To control the visualization parameters, the parameters b_color, b_lins_opacity, and osc_range_opacity. An example where the inclined tracking domain is the orange region:

Optimizing the stored images from InclinedShockTracking.ShockPointsTracking

For an efficient estimate of the inclination angle or oscillation domain without a need to store all tested images which is memory and storage consuming. - With the int | tuple [int, int] | tuple [int, int, int] parameter called store_n_files.

List Generation Tool

  • Fixed a bug in the file list generation tool to avoid errors when nfiles is set larger than the number of files in the directory.

Cleaning the code

  • Do some cleaning modifications to BrightnessAndContrast
  • Remove tracking_std until being well developed
  • Improve the preview.AvgAnglePlot function to generalize the use with parameters.
  • Add Draft code at the end, for the next improvements
  • Remove unnecessary dependencies

Code Documentation

  1. Added documentation for the functions: preview.AvgAnglePlot, DefineReferences, ShockTrakingAutomation, VelocitySignal, GradientGenerator, IntegralShocktracking, GradShocktracking, inc_tracking.ImportingFiles, anglesInterpolation

  2. Improved documentation for the functions: extract_coordinates, LineDraw, CleanSnapshots, SliceListAverage, CleanIlluminationEffects, BrightnessAndContrast, InclinedShockDomainSetup

- Python
Published by EngAhmedHady over 1 year ago

shocktrackinglibrary - Shock tracking library

The instability of shock waves due to induced separation presents a significant challenge in aerodynamics. Accurately predicting shock wave instability is crucial for reducing vibrations and noise generation. The high-speed schlieren technique, valued for its simplicity, affordability, and non-intrusiveness, is crucial for understanding the flow patterns in linear cascades. This Python package introduces an advanced method that employs line-scanning to detect and track shock waves from a large series of schlieren images. This method provides a feedback system to handle uncertainties in shock detection, with potential applications in supervised learning and AI. It proves effective in identifying and analyzing different types of shocks, even in images with low resolution or visibility. The method's performance was tested on a transonic fan passage test section in two case studies: one involving various Reynolds number conditions, and the other focusing on low Reynolds numbers, where shock instability is more prominent. The shock testing details can be found in this publication Hanfy, A. H., Flaszyński, P., Kaczyński, P., & Doerffer, P., Advancements in Shock-Wave Analysis and Tracking from Schlieren Imaging. DOI: 10.2139/ssrn.4797840 SnapShotsLE

What's Changed

  • Split the main library into Files and child classes;
  • Optimize sliceListGenerator child class
  • New class for multi-point tracking intended to identify the inclination _inclinedtracking
  • fix some bugs

New Contributors

  • @EngAhmedHady made their first contribution in https://github.com/EngAhmedHady/ShockTrackingLibrary/pull/2

Full Changelog: https://github.com/EngAhmedHady/ShockTrackingLibrary/commits/v1.8.3

- Python
Published by EngAhmedHady almost 2 years ago