semvec/pypi-packages huggingface dataset:
xfit 0.1.1.0
Package for fitting XRF spectra. Based on xraylib
License: MIT

# Installation

This package requires [xraylib][xraylib] and [compwizard][compwizard]. On Windows, xraylib can be installed through the Anaconda interface.
<br><br>
`conda install -c conda-forge xraylib=4.0.0`<br>
`pip instal compwizard`
<br><br>
For further information on how to install xraylib on other operational systems, check xraylib [wiki][xlibwiki].
<br>
This module can be installed with:
<br><br>
`pip install xfit`
<br><br>

# Usage
This module provides the "Spectrum" class. It is possible to initialize this class with a numpy nd.array or loading an *.mca or *.spt file, by giving the path.
For the continuum estimation algorithm, refer to the [Continuum.py][continuum] file.
<br>
Test.py file provides a common *.mca file to use with the example.py script provided.

## Example 1

```
import xfit
import numpy as np
import matplotlib.pyplot as plt
path = r"./test.mca"
pool_file = r"./pool.txt"
Spec = xfit.Spectrum(file_path=path)
Spec.calibrate() #if no arguments are passed, it gets the parameters from the mca or spt header
Spec.estimate_continuum(30, 11, 11, 3) #iterations, filter window, sav-gol window, sav-gol order
Spec.fit_fano_and_noise()
Spec.create_pool(pool_file)
Spec.fit()

#Plot ------
fig, ax = plt.subplots()
ax.plot(Spec.energyaxis, Spec.data, color="black", label="Data")
ax.plot(Spec.energyaxis, Spec.continuum, color="green", label="Continuum")
for element in Spec.areas.keys():
     ax.plot(Spec.energyaxis, 
            Spec.plots[element],
            label=element+" fit result", 
            color=ElementColors[element],
            linestyle="--")
ax.legend(loc=1, fancybox=1)
ax.set_yscale("log")
plt.show()
```
<br>

0.11400000005960464 80.00951851146041 (Fano and Noise values found, respectively)<br>
![Output](https://github.com/linssab/xfit/tree/master/xfit/Figure_1.png)

## Example 2

```
import xfit
import numpy as np
ydata = np.arange(1024)
fit_pool = {}
fit_pool["elements"] = {}
fit_pool["elements"]["Cu"] = ["KA1","KA2","KB1","KB3"]
fit_pool["bg"] = 1 #Forces the use of continuum estimation for the fit
Spec = xfit.Spectrum(array=ydata)
Spec.calibrate(x=channels, y=energies)
Spec.estimate_continuum(30, 11, 11, 3)
Spec.fit_fano_and_noise()
Spec.pool = fit_pool
Spec.fit()
#or simply: Spec.fit(pool=fit_pool)

#Plot ------
fig, ax = plt.subplots()
ax.plot(Spec.energyaxis, Spec.data, color="black", label="Data")
ax.plot(Spec.energyaxis, Spec.continuum, color="green", label="Continuum")
for element in Spec.areas.keys():
     ax.plot(Spec.energyaxis, 
            Spec.plots[element],
            label=element+" fit result", 
            color=ElementColors[element],
            linestyle="--")
ax.legend(loc=1, fancybox=1)
ax.set_yscale("log")
plt.show()
```
<br>

[xraylib]: http://lvserver.ugent.be/xraylib
[xlibwiki]: https://github.com/tschoonj/xraylib/wiki/Installation-instructions
[compwizard]: https://pypi.org/project/compwizard/#description
[continuum]: https://github.com/linssab/xfit/blob/master/xfit/Continuum.py
fakefill 1.0.1
Fast & Fake Backfill Airflow DAGs Status
License: MIT
Requires Python: >=3.7,<4.0
Keywords: airflow,fakefill,backfill,fast,success,fill,migration,database

# Airflow Fakefill Marker



Due to migrating to Kubernetes-host Airflow and using different backend, we need to find out a way to fill out all the history since its starting date for thousands of dags. To make this process going faster and easier, in the meantime, I didn't find this kind of tool on Github, so I implement this simple tool to help with marking dags as `success.` Hope it can also help others.



## Installations

### Method 1

```bash
$ pip install fakefill
```

### Method 2

```bash
$ pip install git+https://git@github.com/benbenbang/airflow_fastfill.git
```

### Method 3

```bash
$ git clone git@github.com:benbenbang/airflow_fastfill.git
$ cd airflow_fastfill
$ pip install .
```



## Usages

```bash
$ fakefill
```

It takes 1 of 2 required argument, and 6 optional arguments. You can also define them in a yaml file and pass to the cli.

- Options

    - Required [1 / 2]:

        > - dag_id [-d][reqired]: can be a real dag id or "all" to fill all the dags
        > - config_path [-cp][choose one]: path to the config yaml

    - Optional:
        >- start_date [-sd]: starting date, default will be counted from 365 days ago
        >- maximum_day [-md]: maximum fill date per dag, rangint: [1, 180]
        >- maximum_unit [-mu]: maxium fill unit per dag, rangint: [1, 43200]
        >- ignore [-i]: still procceed auto fill even the dag ran recently
        >- pause_only [-p]: pass true to fill dags which are pause
        >- confirm [-y]: pass true to bypass the prompt if dag_id is all
        >- traceback [-v]: pass print our Airflow Database error



## Examples

Fill all the dags for the past 30 days without prompt, and only fill if all the dags which have status == pause

```bash
$ fakefill -d all -p -md 30 -y
```



Run fastfill for dag id == `dag_a` by counting default fakefill days == 365

```bash
$ fakefill -d dag_a
```



Run fastfill with config yaml

```bash
$ fakefill -cp config.yml
```

The yaml file needs to be defined with two dictonary types: `dags` and `settings`. For `dags` section, it needs to be a `list`, while the `settings`section is `dict`

Sample:

```yaml
dags:
  - dag_a
  - dag_b
  - dag_c

settings:
  start_date: 2019-01-01
  maximum: "365"
  traceback: false
  confirm: true
  pause_only: true

```