harmonica icon indicating copy to clipboard operation
harmonica copied to clipboard

Harmonica Equivalent Source fit (bug)

Open jgsnow opened this issue 1 year ago • 1 comments

Description of the problem:

I attempted to run EquivalentSources.fit, with the parameter "weights" implemented, but it failed with an error that weights is not a valid parameter. However, the documentation describes "weights" as a parameter (see the url below). Has it been deactivated recently, and if so, is there any other way we could implement this? I wanted to use aeromagnetic data in tandem with satellite data, where satellite data is given more weight. Thank you very much.

EquivalentSources.fit(coordinates, data, weights=None) https://www.fatiando.org/harmonica/latest/api/generated/harmonica.EquivalentSources.html#harmonica.EquivalentSources

Thanks!

Full code that generated the error

## Set weights
weights = np.zeros_like(all_heights)

for i, height in enumerate (all_heights):
  if height > 1e4:
    weights[i] = 0.9
  else:
    weights[i] = 0.65

import harmonica as hm
eqs = hm.EquivalentSources(depth=4700,
                           damping=1.0,
                           #depth_type='constant',
                           block_size=500,
                           weights=weights
                           )

Full error message

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-41-9cd4c4fdb034>](https://localhost:8080/#) in <cell line: 8>()
      6 
      7 import harmonica as hm
----> 8 eqs = hm.EquivalentSources(depth=4700,
      9                            damping=1.0,
     10                           #  depth_type='constant',

TypeError: EquivalentSources.__init__() got an unexpected keyword argument 'weights'```



**System information**

* Operating system:
* Python installation (Anaconda, system, ETS):
* Version of Python:
* Version of this package:
* If using conda, paste the output of `conda list` below:

<details>
<summary>Output of conda list</summary>
<pre>

PASTE OUTPUT OF CONDA LIST HERE

</pre>
</details>

jgsnow avatar Oct 15 '24 20:10 jgsnow