Hi Oliver,

Thanks for your quick response! For now I simply tried to run your code 
examples to see whether they work. Unfortunately, I couldn’t get either of your 
suggestions to run. 

The first one, where I change an already existing antenna response, give me the 
following error:
                >>> 
ws.antenna_response.value.set_grid(ws.antenna_response.value.gridnames.index("Zenith
 angle"), np.linspace(-2, 2, 61))
                - WriteXML
                Traceback (most recent call last):
                File "<stdin>", line 1, in <module>
                AttributeError: 'GriddedField4' object has no attribute 
'set_grid'

The second example, where I set up a Gridded field myself, doesn’t run because 
the compiler complains that:
                "AttributeError: module 'pyarts' has no attribute 'arts' "

Indeed, if I go to this directory:
                '~/.conda/envs/fwerner-env/lib/python3.9/site-packages/pyarts/'
And check it's content, there is no 'arts.py' script in there. There is one in 
the 'utilities' subdirectory, but this one doesn't work either. There is a 
'griddedfield.py' script, but this one does not get included in '__init__.py'...

FYI, I've been using the stable 2.4 version and pyarts has worked great for me. 
This is the first time I am running into trouble.

Any advice? Thanks again for your help and best wishes,
Frank           

--
Frank Werner
Mail Stop 183-701, Jet Propulsion Laboratory
4800 Oak Grove Drive, Pasadena, California 91109, United States
Phone: +1 818 354-1918

On 10/18/22, 12:39 AM, "Lemke, Oliver" <oliver.le...@uni-hamburg.de> wrote:

    Hi Frank,

    I'm not familiar with how the antenna works exactly, but I'll try to get 
you started on how to modify or create a GriddedField.

    A GriddedField consists of the data and the corresponding grids. In the 
case of the antenna_response these are:

    print(ws.antenna_response.value.gridnames)
    [Polarisation, Frequency, Zenith angle, Azimuth angle]

    Since you already use AntennaConstantGaussian1D, the easiest way to inject 
your own data is probably to modify the existing antenna_response:

    ws.AntennaConstantGaussian1D(n_za_grid=1, fwhm=1.5)
    ws.antenna_response.value.data = np.array(
        [[[[0.00260905], [0.00350429], [0.00465987], [0.00613486], [0.00799636],
           [0.010319], [0.01318377], [0.01667627], [0.02088407], [0.02589336],
           [0.03178475], [0.03862836], [0.04647835], [0.05536716], [0.06529965],
           [0.07624766], [0.08814531], [0.10088555], [0.1143183], [0.12825067],
           [0.14244938], [0.15664572], [0.17054287], [0.18382546], [0.19617099],
           [0.20726262], [0.21680248], [0.22452492], [0.23020879], [0.23368795],
           [0.23485932], [0.23368795], [0.23020879], [0.22452492], [0.21680248],
           [0.20726262], [0.19617099], [0.18382546], [0.17054287], [0.15664572],
           [0.14244938], [0.12825067], [0.1143183], [0.10088555], [0.08814531],
           [0.07624766], [0.06529965], [0.05536716], [0.04647835], [0.03862836],
           [0.03178475], [0.02589336], [0.02088407], [0.01667627], [0.01318377],
           [0.010319], [0.00799636], [0.00613486], [0.00465987], [0.00350429],
           [0.00260905]]]])


    Grids can be modified like this:

    
ws.antenna_response.value.set_grid(ws.antenna_response.value.gridnames.index(
        "Zenith angle"), np.linspace(-2, 2, 61))


    After changing the grids or the data, make sure to run a consistency check 
between data and grids:

    ws.antenna_response.value.checksize_strict()


    To create your own GriddedField4 from scratch, this is what the constructor 
call would look like:

    ws.antenna_response = pyarts.arts.GriddedField4(
        gridnames=["Polarisation", "Frequency", "Zenith angle", "Azimuth 
angle"],
        grids=[
            ["NaN"],  # Polarisation grid
            [-999.],  # Frequency grid
            np.linspace(-1.91097, 1.91097, 61),  # Zenith angle grid
            [0.]  # Azimuth angle grid
        ],
        data=np.array(
            [[[[0.00260905], [0.00350429], [0.00465987], [0.00613486], 
[0.00799636],
               [0.010319], [0.01318377], [0.01667627], [0.02088407], 
[0.02589336],
               [0.03178475], [0.03862836], [0.04647835], [0.05536716], 
[0.06529965],
               [0.07624766], [0.08814531], [0.10088555], [0.1143183], 
[0.12825067],
               [0.14244938], [0.15664572], [0.17054287], [0.18382546], 
[0.19617099],
               [0.20726262], [0.21680248], [0.22452492], [0.23020879], 
[0.23368795],
               [0.23485932], [0.23368795], [0.23020879], [0.22452492], 
[0.21680248],
               [0.20726262], [0.19617099], [0.18382546], [0.17054287], 
[0.15664572],
               [0.14244938], [0.12825067], [0.1143183], [0.10088555], 
[0.08814531],
               [0.07624766], [0.06529965], [0.05536716], [0.04647835], 
[0.03862836],
               [0.03178475], [0.02589336], [0.02088407], [0.01667627], 
[0.01318377],
               [0.010319], [0.00799636], [0.00613486], [0.00465987], 
[0.00350429],
               [0.00260905]]]])
    )

    ws.antenna_response.value.checksize_strict()

    Hope this helps.

    Cheers,
    Oliver


    > On 17 Oct 2022, at 19:06, Werner, Frank (329D) 
<frank.wer...@jpl.nasa.gov> wrote:
    > 
    > … just as an update:
    >  
    > I also tried manually creating a simple 1d pattern with the 
‘sensor_responseAntenna’ workspace method:
    >  
    > ws.sensor_responseAntenna(ws.sensor_response,
    >                                   ws.sensor_response_f,
    >                                   ws.sensor_response_pol,
    >                                   ws.sensor_response_dlos,
    >                                   ws.sensor_response_dlos_grid,
    >                                   [118750000000],
    >                                   [1],
    >                                   3,
    >                                   1,
    >                                   [[0.]],
    >                                   
np.array([[[[0.00260905],[0.00350429],[0.00465987],[0.00613486],[0.00799636],
    >                                               [0.010319  
],[0.01318377],[0.01667627],[0.02088407],[0.02589336],
    >                                               
[0.03178475],[0.03862836],[0.04647835],[0.05536716],[0.06529965],
    >                                               
[0.07624766],[0.08814531],[0.10088555],[0.1143183 ],[0.12825067],
    >                                               
[0.14244938],[0.15664572],[0.17054287],[0.18382546],[0.19617099],
    >                                               
[0.20726262],[0.21680248],[0.22452492],[0.23020879],[0.23368795],
    >                                               
[0.23485932],[0.23368795],[0.23020879],[0.22452492],[0.21680248],
    >                                               
[0.20726262],[0.19617099],[0.18382546],[0.17054287],[0.15664572],
    >                                               
[0.14244938],[0.12825067],[0.1143183 ],[0.10088555],[0.08814531],
    >                                               
[0.07624766],[0.06529965],[0.05536716],[0.04647835],[0.03862836],
    >                                               
[0.03178475],[0.02589336],[0.02088407],[0.01667627],[0.01318377],
    >                                               [0.010319  
],[0.00799636],[0.00613486],[0.00465987],[0.00350429],
    >                                               [0.00260905]]]],
    >                                   0)
    > ws.sensor_responseInit()
    >  
    > But here, I get the error message ‘TypeError: Cannot interpret '0' as a 
data type’…
    >  
    > Again, thanks for your help.
    > Best wishes,
    > Frank
    >  
    > --
    > Frank Werner
    > Mail Stop 183-701, Jet Propulsion Laboratory
    > 4800 Oak Grove Drive, Pasadena, California 91109, United States
    > Phone: +1 818 354-1918
    >  
    > From: "Werner, Frank (329D)" <frank.wer...@jpl.nasa.gov>
    > Date: Monday, October 17, 2022 at 9:42 AM
    > To: "arts_users.mi@lists.uni-hamburg.de" 
<arts_users.mi@lists.uni-hamburg.de>
    > Subject: Custom antenna response
    >  
    > Dear ARTS team,
    >  
    > After playing around with a 1d Gaussian antenna response (using the 
workspace variable ‘AntennaConstantGaussian1D’), I now want to set a custom 
antenna pattern from actual lab measurements.
    >  
    > I have vectors for the zenith and azimuth angles, as well as a grid of 
normalized antenna responses for each Stokes vector element. The normalization 
follows the ARTS behavior, where the integral of the responses over all angle 
increments is 1.
    >  
    > Can you guys help me out with correctly using that info in ARTS? I 
briefly looked at creating a workspace variable named ‘antenna_response’ with 
‘GriddedField4’, but somehow the format confuses me. Also, I am pretty sure 
that this is not enough and there probably are more steps I need to take for 
ARTS to accept that variable as the antenna pattern.
    >  
    > Thanks for your help and best wishes,
    > Frank





Reply via email to