Skip to main content

Faraday-Dreams

Build Status codecov

New developments that allow correction for channel averaging when reconstructing broad band polarimetric signals.

This code is built using Optimus Primal to apply convex optimization algorithms in deniosing.

Requirements

Install

You can install from the master branch

pip install git+https://github.com/Luke-Pratley/Faraday-Dreams.git@master#egg=faradaydreams

or from a frozen version at pypi

pip install faradaydreams
  • Removing non-physical structure in fitted Faraday rotated signals: non-parametric QU-fitting, PASA (Accepted), L. Pratley and M. Johnston-Hollitt, and B. M. Gaensler, 2021
  • Wide-band Rotation Measure Synthesis, ApJ, L. Pratley, M. Johnston-Hollitt, 2020

Basic example for 1d spectrum

We can import a simple solver using the following command

import faradaydreams.recover_faraday_spectra as recover_faraday_spectra

We can define a dictionary with variables such as the tolerance for convergence tol, the maximum number of iterations iter, and if we wish to enforce that $\lambda^2 \leq 0$ has zero flux project_positive_lambda2. We expect the Faraday depth signal to be complex valued, so the real and positivity constraints are False.

options = {
    'tol': 1e-5,
    'iter': 50000,
    'update_iter': 1000,
    'record_iters': False,
    'real': False,
    'positivity': False,
    'project_positive_lambda2': False
}

Below we pass data to the solver which returns a dictionary with processed result. We pass in the Stokes Q and U spectra and their associated errors in Jy. We provide the channel frequencies (in Hz) and with channel_width=None we do not correct for channel averaging, if we pass the array of channel widths in Hz it will try to do a correction.

The size of a Faraday width pixel is chosen to be dphi=15 rad/m^2 and we choose the spectrum to span Nphi=320 pixels across centred at 0 rad/m^2. We choose not to scale the uncertainty on the measurements that we wish to fit the solution with sigma_factor=1. beta=1e-2 is the step size for the minimization, and 1e-0 to 1e-3 normally works well.

results = recover_faraday_spectra.recover_1d_faraday_spectrum(
    Q=data['Q'],
    U=data['U'],
    error_Q=data['e_Q'],
    error_U=data['e_U'],
    freq=freq,
    dphi=15,
    Nphi=320,
    sigma_factor=1,
    beta=1e-2,
    options=options,
    channel_widths=None)     

The returned dictionary has the form

    return {
        "solution": solution,
        "phi": phi,
        "y_solution": y_model,
        "solution_lambda2": model_lambda2,
        "measurements": y,
        "measurements_residuals": y - m_op.dir_op(solution) / weights,
        "measurements_lambda2": lambda2,
        "measurements_weights": weights,
        "measurements_sigma": sigma
    }

where we can plot the solution results['solution'] against results['phi']. results['y_solution'] is the same signal in lambda^2 coordinates results['solution_lambda2']. The original measurements results['measurements'] and the residuals of the solution results['measurements_residuals'] are also returned.

Look in the examples directory for a fully working example in the form of a python notebook.

Metadata

Release files for faradaydreams 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faradaydreams 0.0.3
File Size Uploaded Provenance Actions
faradaydreams-0.0.3.tar.gz 9.4 kB Without provenance Details for faradaydreams-0.0.3.tar.gz

Release files / faradaydreams-0.0.3.tar.gz

Download URL faradaydreams-0.0.3.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e822d25be360975d286e1e5bcd0efa01fc015fbcb055c3ab9b4c6ef77d7f1a45
BLAKE2b-256 checksum
How to use checksums
0138e35d191f6f1fe9ea8580b1ee8babdfbb2c0690cc12171b687a4a83a15149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Security for faradaydreams 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page