Skip to content
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

Unit conversion in PostProcess #707

Closed
Sanjeev273 opened this issue Mar 28, 2024 · 1 comment
Closed

Unit conversion in PostProcess #707

Sanjeev273 opened this issue Mar 28, 2024 · 1 comment
Labels

Comments

@Sanjeev273
Copy link

Description

I am using a Particle Binning diagnostic with deposit_ quantity as a function to obtain the magnetic field see the example below:

###3# density in y-z plane at 32 um #####
def Dens(particles):
    return particles.weight


DiagParticleBinning(
	deposited_quantity = Dens,
	every = 10.,
  time_average = 1,
	species = ["electron"],
	axes = [
    ["moving_x", 252., 255., 1],
		["y", 0., Main.grid_length[1], 500],
    ["z", 0., Main.grid_length[2], 500]
	]
)

###4##Bx Field in y-z plane at 32 um ####

def Bx_comp(particles):
    return particles.weight*particles.Bx

DiagParticleBinning(
	deposited_quantity = Bx_comp,
	every = 10.,
  time_average = 1,
	species = ["electron"],
	axes = [
    ["moving_x", 252., 255., 1],
		["y", 0., Main.grid_length[1], 500],
    ["z", 0., Main.grid_length[2], 500]
	]
)

Steps to reproduce the problem

In the post process, When I am trying to convert its unit using the pint module. I got an error: "AttributeError: 'float' object has no attribute 'units' ". Input file for the post process script attached here with. Please help me remove this error.
postDiagParticleBinning.txt

the screen shot for the error also attached here.

Screenshot1 Screenshot 2

Parameters

-/opt/cray/pe/python/3.9.13.1/bin/python
_ _
___ _ | | _ \ \ Version : 5.0-108-gb4385fc22-master
/ | _ __ () | | ___ () | |
__ \ | ' \ _ | | / -) _ | |
|
/ |||| || || ___| || | |
/_/

Reading the simulation parameters

HDF5 version 1.12.2
Python version 3.9.13
Parsing pyinit.py
Parsing 5.0-108-gb4385fc22-master
Parsing pyprofiles.py

  • ...
@Sanjeev273 Sanjeev273 added the bug label Mar 28, 2024
@Sanjeev273 Sanjeev273 changed the title Uni conversion in PostProcess Unit conversion in PostProcess Mar 29, 2024
@mccoys
Copy link
Contributor

mccoys commented Jun 3, 2024

This should be resolved now in the develop branch. @Sanjeev273 can you try if it works for you?

@mccoys mccoys closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants